Skip to content

Commit

Permalink
Add function to align views to pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Bok committed May 30, 2013
1 parent 4b8be87 commit ae64324
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions build/framer.js
@@ -1,7 +1,7 @@
// Framer 2.0-16-g538806f (c) 2013 Koen Bok
// Framer 2.0-17-g4b8be87 (c) 2013 Koen Bok
// https://github.com/koenbok/Framer

window.FramerVersion = "2.0-16-g538806f";
window.FramerVersion = "2.0-17-g4b8be87";


(function(){var require = function (file, cwd) {
Expand Down Expand Up @@ -2464,6 +2464,13 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam
return this.frame = this.centerFrame();
};

View.prototype.pixelAlign = function() {
return this.frame = {
x: parseInt(this.x),
y: parseInt(this.y)
};
};

View.define("width", {
get: function() {
return parseFloat(this.style.width);
Expand Down
4 changes: 4 additions & 0 deletions src/views/view.coffee
Expand Up @@ -124,6 +124,10 @@ class View extends Frame
centerX: -> @x = @centerFrame().x
centerY: -> @y = @centerFrame().y
center: -> @frame = @centerFrame()

pixelAlign: ->
# Put this view exactly on the pixel
@frame = {x:parseInt(@x), y:parseInt(@y)}


#############################################################################
Expand Down

0 comments on commit ae64324

Please sign in to comment.