diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-04-03 20:23:30 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-04-03 20:23:30 -0400 |
| commit | d7c461e09e9ed644e35be86f067ccbe6d19e8b8c (patch) | |
| tree | 715e0ec16a54430352963cb4278b8c1da6fe63c5 | |
| parent | 519ff21e00c5c48d06e1ddee0cdc1dc3d90a26f8 (diff) | |
moving statues
| -rw-r--r-- | public/assets/javascripts/rectangles/engine/sculpture/move.js | 77 |
1 files changed, 7 insertions, 70 deletions
diff --git a/public/assets/javascripts/rectangles/engine/sculpture/move.js b/public/assets/javascripts/rectangles/engine/sculpture/move.js index b5a4b40..28d707e 100644 --- a/public/assets/javascripts/rectangles/engine/sculpture/move.js +++ b/public/assets/javascripts/rectangles/engine/sculpture/move.js @@ -8,7 +8,6 @@ Sculpture.move = function(base){ this.bind = function(){ Sculpture.mouse.bind_el(base.mx.el) Sculpture.mouse.on("down", down) - Sculpture.mouse.on("enter", switch_wall) Sculpture.mouse.on("drag", drag) Sculpture.mouse.on("up", up) } @@ -17,7 +16,6 @@ Sculpture.move = function(base){ base.focused = false Sculpture.mouse.unbind_el(base.mx.el) Sculpture.mouse.off("down", down) - Sculpture.mouse.off("enter", switch_wall) Sculpture.mouse.off("drag", drag) Sculpture.mouse.off("up", up) } @@ -49,7 +47,6 @@ Sculpture.move = function(base){ bounds = base.bounds dimension = base.dimensions - position = base.wall.mxToPosition( base.mx, dimension ) oldState = base.serialize() document.body.classList.add("dragging") @@ -60,32 +57,18 @@ Sculpture.move = function(base){ moved = true - var flipX = base.wall.side & (FRONT | RIGHT) - var delta = cursor.delta() delta.mul( cursor_amp ) // TODO: this should be proportional to your distance from the wall - if (flipX) { delta.a *= -1 } delta.b *= -1 - var new_bounds = base.wall.surface.translate( bounds, dimension, position, delta ) - if (new_bounds) bounds = new_bounds - if (flipX) { delta.a *= -1 } - - base.mx.y = position.b + delta.b + dimension.b / 2 - switch (base.wall.side) { - case FRONT: - case BACK: - base.mx.x = position.a + delta.a * cos(base.wall.rotationY) + dimension.a / 2 - break - case LEFT: - case RIGHT: - base.mx.z = position.a + delta.a * sin(base.wall.rotationY) + dimension.a / 2 - break - } + // here we need to move the element based on the XY coords, as + // base.mx.y = position.b + delta.b + dimension.b / 2 + base.mx.x = x + delta.a * cos(cam.rotationY) - delta.b * sin(cam.rotationY) + base.mx.z = z + delta.a * sin(cam.rotationY) + delta.b * cos(cam.rotationY) - if (editor.permissions.resize) { - Sculpture.resize.move_dots() - } +// if (editor.permissions.resize) { +// Sculpture.resize.move_dots() +// } } function up (e, cursor){ @@ -107,52 +90,6 @@ Sculpture.move = function(base){ document.body.classList.remove("dragging") } - function switch_wall (e, target, cursor){ - if (! dragging) return - if (target.wall.id == base.wall.id) return - - var old_wall_side = base.wall.side - var wall_group = old_wall_side | target.wall.side - var new_bounds = target.wall.surface.bounds_at_index_with_dimensions(target.index || 0, dimension) - - if (! new_bounds) return - - base.wall = target.wall - base.bounds = bounds = new_bounds - - position.a = bounds.x.midpoint() - dimension.a / 2 - - if (old_wall_side !== target.wall.side && wall_group !== FRONT_BACK && wall_group !== LEFT_RIGHT) { - switch (old_wall_side) { - case FRONT: - position.a = bounds.x.a + dimension.a / 2 - break - case BACK: - position.a = bounds.x.b - dimension.a / 2 - break - case LEFT: - position.a = bounds.x.a + dimension.a / 2 - break - case RIGHT: - position.a = bounds.x.b - dimension.a / 2 - break - } - } - - var mx_delta = base.wall.positionToMx( position, dimension ) - base.mx.move(mx_delta) - - if (editor.permissions.resize) { - Sculpture.resize.rotate_dots() - Sculpture.resize.move_dots() - } - - cursor.x.a = cursor.x.b - //var delta = cursor.delta() - drag(e, cursor) - - } - return this }
\ No newline at end of file |
