diff options
| author | Julie Lala <jules@okfoc.us> | 2014-08-19 21:08:20 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-08-19 21:08:20 -0400 |
| commit | 287d180afe42bfc1a4fe20832cb7714593b50fbb (patch) | |
| tree | 953d82339e105718dd2525854fb5a079f0bd6f17 /public/assets/javascripts/rectangles | |
| parent | ca54810c810e8dd08b20dce5e901630d0d36fe25 (diff) | |
| parent | 24870ab6ebd31c18b3533ec96ff04ad16153c844 (diff) | |
Merge branch 'walls' of github.com:okfocus/vvalls into walls
Diffstat (limited to 'public/assets/javascripts/rectangles')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/rect.js | 1 | ||||
| -rw-r--r-- | public/assets/javascripts/rectangles/models/surface.js | 4 | ||||
| -rw-r--r-- | public/assets/javascripts/rectangles/util/mouse.js | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/public/assets/javascripts/rectangles/models/rect.js b/public/assets/javascripts/rectangles/models/rect.js index f23ab9e..67852b4 100644 --- a/public/assets/javascripts/rectangles/models/rect.js +++ b/public/assets/javascripts/rectangles/models/rect.js @@ -139,6 +139,7 @@ } Rect.prototype.width = function(){ return this.x.length() } Rect.prototype.height = function(){ return this.y.length() } + Rect.prototype.delta = function(){ return new vec2( this.x.magnitude(), this.y.magnitude() ) } Rect.prototype.toString = function(){ var sides = sidesToString(this.sides) var s = "[" + this.x.toString() + " " + this.y.toString() + "] " + sides diff --git a/public/assets/javascripts/rectangles/models/surface.js b/public/assets/javascripts/rectangles/models/surface.js index 7001ee3..eebd566 100644 --- a/public/assets/javascripts/rectangles/models/surface.js +++ b/public/assets/javascripts/rectangles/models/surface.js @@ -113,7 +113,9 @@ return old_bounds } - var center_index = this.index_for_x( position.a + dimension.a/2 + delta.a, 0 ) + var left_index = this.index_for_x( position.a + dimension.a/2 + delta.a, 0 ) + var center_index = this.index_for_x( position.a + dimension.a/2 + delta.a, left_index ) + var right_index = this.index_for_x( position.a + dimension.a/2 + delta.a, center_index ) var new_bounds = this.bounds_at_index_with_dimensions(center_index, dimension) this.clamp_delta(new_bounds, dimension, position, delta) diff --git a/public/assets/javascripts/rectangles/util/mouse.js b/public/assets/javascripts/rectangles/util/mouse.js index 06958af..fea3376 100644 --- a/public/assets/javascripts/rectangles/util/mouse.js +++ b/public/assets/javascripts/rectangles/util/mouse.js @@ -8,7 +8,7 @@ // cursor.x.a // cursor.y.a }, - move: function(e, cursor, delta){ + move: function(e, cursor){ // delta.a (x) // delta.b (y) }, |
