Skip to content

Commit

Permalink
Add centeredFrame function
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Bok committed May 3, 2013
1 parent 5b23d4e commit 3ad0dc0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 30 deletions.
22 changes: 9 additions & 13 deletions build/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) {
Expand Down Expand Up @@ -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", {
Expand Down
10 changes: 6 additions & 4 deletions src/views/view.coffee
Expand Up @@ -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
Expand Down
22 changes: 9 additions & 13 deletions 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) {
Expand Down Expand Up @@ -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", {
Expand Down

0 comments on commit 3ad0dc0

Please sign in to comment.