summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/map/ui_editor.js
diff options
context:
space:
mode:
authorryderr <r@okfoc.us>2014-11-17 11:23:53 -0500
committerryderr <r@okfoc.us>2014-11-17 11:23:53 -0500
commit21e23e63e089685a558d2e5c74439e9de5c33c4f (patch)
tree6ee8cf44e00aca897ec02d48a1e398c4e41092cb /public/assets/javascripts/rectangles/engine/map/ui_editor.js
parent39fa1a5b835797deb4b28d7ba6faae766a979dca (diff)
parent84d606cc4c56778ae7e6b8b7d86e100131717a53 (diff)
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/map/ui_editor.js')
-rw-r--r--public/assets/javascripts/rectangles/engine/map/ui_editor.js28
1 files changed, 27 insertions, 1 deletions
diff --git a/public/assets/javascripts/rectangles/engine/map/ui_editor.js b/public/assets/javascripts/rectangles/engine/map/ui_editor.js
index c838b8b..d1b0b89 100644
--- a/public/assets/javascripts/rectangles/engine/map/ui_editor.js
+++ b/public/assets/javascripts/rectangles/engine/map/ui_editor.js
@@ -42,6 +42,7 @@ Map.UI.Editor = function(map){
cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b)
if (e.ctrlKey || e.which === 3) {
+ if (Rooms.regions.length == 0) return
cursor.quantize(1/map.zoom)
map.center.a = cursor.x.a
map.center.b = -cursor.y.a
@@ -226,7 +227,32 @@ Map.UI.Editor = function(map){
return r.focused // = r.rect.contains(cursor.x.a, cursor.y.a)
})
- if (intersects.length) {
+ if (intersects.length && window.heightIsGlobal) {
+ var rooms = Rooms.values()
+ wheelState = wheelState || rooms[0].height
+ var height = clamp( ~~(rooms[0].height + deltaY * 2), height_min, height_max )
+ rooms.forEach(function(room){
+ room.height = height
+ })
+
+ app.tube("builder-pick-room", intersects[0])
+
+ clearTimeout(wheelTimeout)
+ wheelTimeout = setTimeout(function(){
+ UndoStack.push({
+ type: "update-rooms-height",
+ undo: wheelState,
+ redo: height
+ })
+ Rooms.rebuild()
+
+ // TODO: watch individual scenery object here
+ Minotaur.watch( app.router.editorView.settings )
+
+ wheelState = null
+ }, 250)
+ }
+ else if (intersects.length) {
wheelState = wheelState || intersects[0].copy()
intersects[0].height = clamp( ~~(intersects[0].height + deltaY * 2), height_min, height_max )