diff options
| -rw-r--r-- | assets/javascripts/mx/extensions/mx.movements.js | 12 | ||||
| -rw-r--r-- | assets/javascripts/rectangles/map/ui.js | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/assets/javascripts/mx/extensions/mx.movements.js b/assets/javascripts/mx/extensions/mx.movements.js index 6837637..a177c1e 100644 --- a/assets/javascripts/mx/extensions/mx.movements.js +++ b/assets/javascripts/mx/extensions/mx.movements.js @@ -15,10 +15,12 @@ MX.Movements = function (cam, viewHeight) { jumping = false, creeping = false, locked = false, - gravity = false + gravity = false, + rotationX_min = PI/-2, + rotationX_max = PI/2 var v = 15, - vr = Math.PI * 0.015 + vr = Math.PI * 0.015, jumpV = 23, vx = vy = vz = 0, creepFactor = 0.3 @@ -171,7 +173,7 @@ MX.Movements = function (cam, viewHeight) { var dx = (e.pageX - mouseX) / window.innerWidth * Math.PI/3 var dy = (e.pageY - mouseY) / window.innerHeight * Math.PI/3 cam.rotationY = rotY + dx - cam.rotationX = rotX - dy + cam.rotationX = clamp( rotX - dy, rotationX_min, rotationX_max ) }) document.addEventListener('mouseup', function (e) { @@ -222,10 +224,10 @@ MX.Movements = function (cam, viewHeight) { } if (turnUp) { - cam.rotationX -= vrrrr + cam.rotationX = clamp( cam.rotationX - vrrrr, rotationX_min, rotationX_max) } if (turnDown) { - cam.rotationX += vrrrr + cam.rotationX = clamp( cam.rotationX + vrrrr, rotationX_min, rotationX_max) } if (turnLeft) { cam.rotationY += vrrrr diff --git a/assets/javascripts/rectangles/map/ui.js b/assets/javascripts/rectangles/map/ui.js index 4e03125..caa2a81 100644 --- a/assets/javascripts/rectangles/map/ui.js +++ b/assets/javascripts/rectangles/map/ui.js @@ -2,6 +2,8 @@ map.ui = new function(){ var base = this + var height_min = 200, + height_max = 2000 base.creating = base.dragging = false @@ -96,7 +98,7 @@ map.ui = new function(){ }) if (intersects.length) { - intersects[0].height = clamp( ~~(intersects[0].height - delta), 200, 800 ) + intersects[0].height = clamp( ~~(intersects[0].height - delta), height_min, height_max ) clipper.update() } else { |
