summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/sculpture/move.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/sculpture/move.js')
-rw-r--r--public/assets/javascripts/rectangles/engine/sculpture/move.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/public/assets/javascripts/rectangles/engine/sculpture/move.js b/public/assets/javascripts/rectangles/engine/sculpture/move.js
index f968bcf..4f6d176 100644
--- a/public/assets/javascripts/rectangles/engine/sculpture/move.js
+++ b/public/assets/javascripts/rectangles/engine/sculpture/move.js
@@ -2,8 +2,9 @@
Sculpture.move = function(base){
var x, y, z, position, dimension, bounds
- var dragging = false, moved = false
+ var dragging = false, shiftPressed = false, moved = false
var oldState
+ var height, width
this.bind = function(){
Sculpture.mouse.bind_el(base.mx.el)
@@ -39,11 +40,13 @@ Sculpture.move = function(base){
e.clickAccepted = false
return
}
+ shiftPressed = e.shiftKey
dragging = true
moved = false
x = base.mx.x
y = base.mx.y
z = base.mx.z
+ height = base.mx.height * base.mx.scale
bounds = base.bounds
dimension = base.dimensions
@@ -63,9 +66,14 @@ Sculpture.move = function(base){
// 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 (e.shiftKey) {
+ base.mx.y = clamp( y + delta.b, height/2 + sculpture_distance_from_floor, Infinity )
+ }
+ else {
+ 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()
}