Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add centeredFrame function
- Loading branch information
Showing
with
24 additions
and
30 deletions.
-
+9
−13
build/framer.js
-
+6
−4
src/views/view.coffee
-
+9
−13
template/framer.js
|
|
@@ -1,7 +1,7 @@ |
|
|
// Framer v2.0.0b1-33-gc02eef3 (c) 2013 Koen Bok |
|
|
// Framer v2.0.0b1-35-g5b23d4e (c) 2013 Koen Bok |
|
|
// https://github.com/koenbok/Framer |
|
|
|
|
|
window.FramerVersion = "v2.0.0b1-33-gc02eef3"; |
|
|
window.FramerVersion = "v2.0.0b1-35-g5b23d4e"; |
|
|
|
|
|
|
|
|
(function(){var require = function (file, cwd) { |
|
@@ -2403,21 +2403,17 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam |
|
|
}); |
|
|
}; |
|
|
|
|
|
View.prototype.centerX = function() { |
|
|
View.prototype.centeredFrame = function() { |
|
|
var frame; |
|
|
|
|
|
frame = this.frame; |
|
|
if (this.superView) { |
|
|
return this.midX = this.superView.width / 2.0; |
|
|
frame.midX = this.superView.width / 2.0; |
|
|
} |
|
|
}; |
|
|
|
|
|
View.prototype.centerY = function() { |
|
|
if (this.superView) { |
|
|
return this.midY = this.superView.height / 2.0; |
|
|
frame.midY = this.superView.height / 2.0; |
|
|
} |
|
|
}; |
|
|
|
|
|
View.prototype.center = function() { |
|
|
this.centerX(); |
|
|
return this.centerY(); |
|
|
return frame; |
|
|
}; |
|
|
|
|
|
View.define("width", { |
|
|
|
@@ -104,10 +104,12 @@ class View extends Frame |
|
|
width: maxX - minX |
|
|
height: maxY - minY |
|
|
|
|
|
|
|
|
centerX: -> @midX = @superView.width / 2.0 if @superView |
|
|
centerY: -> @midY = @superView.height / 2.0 if @superView |
|
|
center: -> @centerX(); @centerY() |
|
|
centeredFrame: -> |
|
|
# Get the centered frame for it's superview |
|
|
frame = @frame |
|
|
frame.midX = @superView.width / 2.0 if @superView |
|
|
frame.midY = @superView.height / 2.0 if @superView |
|
|
frame |
|
|
|
|
|
############################################################################# |
|
|
## Geometry |
|
|
|
|
@@ -1,7 +1,7 @@ |
|
|
// Framer v2.0.0b1-33-gc02eef3 (c) 2013 Koen Bok |
|
|
// Framer v2.0.0b1-35-g5b23d4e (c) 2013 Koen Bok |
|
|
// https://github.com/koenbok/Framer |
|
|
|
|
|
window.FramerVersion = "v2.0.0b1-33-gc02eef3"; |
|
|
window.FramerVersion = "v2.0.0b1-35-g5b23d4e"; |
|
|
|
|
|
|
|
|
(function(){var require = function (file, cwd) { |
|
@@ -2403,21 +2403,17 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam |
|
|
}); |
|
|
}; |
|
|
|
|
|
View.prototype.centerX = function() { |
|
|
View.prototype.centeredFrame = function() { |
|
|
var frame; |
|
|
|
|
|
frame = this.frame; |
|
|
if (this.superView) { |
|
|
return this.midX = this.superView.width / 2.0; |
|
|
frame.midX = this.superView.width / 2.0; |
|
|
} |
|
|
}; |
|
|
|
|
|
View.prototype.centerY = function() { |
|
|
if (this.superView) { |
|
|
return this.midY = this.superView.height / 2.0; |
|
|
frame.midY = this.superView.height / 2.0; |
|
|
} |
|
|
}; |
|
|
|
|
|
View.prototype.center = function() { |
|
|
this.centerX(); |
|
|
return this.centerY(); |
|
|
return frame; |
|
|
}; |
|
|
|
|
|
View.define("width", { |
|
|