Permalink
Browse files

add the ratio option to Drag object

  • Loading branch information...
1 parent 26468cb commit 370032cafbe70ec4d31bc4e044a6777f90f46a78 @challet committed Dec 6, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 Source/Drag/Drag.js
View
@@ -182,7 +182,15 @@ var Drag = new Class({
this.value.now[z] = this.limit[z][0];
}
}
-
+
+ if(options.ratio) {
+ if(this.value.now.x / this.value.now.y < options.ratio) {
+ this.value.now.y = this.value.now.x / options.ratio;
+ } else {
+ this.value.now.x = options.ratio * this.value.now.y;
+ }
+ }
+
if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]);
if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit);

0 comments on commit 370032c

Please sign in to comment.