Permalink
Browse files

Add function to align views to pixels

  • Loading branch information...
Koen Bok
Koen Bok committed May 30, 2013
1 parent 4b8be87 commit ae64324571ad69e1f34131b3c0b1e3045f705186
Showing with 13 additions and 2 deletions.
  1. +9 −2 build/framer.js
  2. +4 −0 src/views/view.coffee
@@ -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) {
@@ -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);
@@ -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)}
#############################################################################

0 comments on commit ae64324

Please sign in to comment.