From bc4517c6b09e03f52161dc38ca591ed0cc227d5d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 13 Nov 2014 18:33:39 -0500 Subject: toggle global height --- public/assets/javascripts/rectangles/engine/map/ui_editor.js | 1 + 1 file changed, 1 insertion(+) (limited to 'public/assets/javascripts/rectangles/engine/map/ui_editor.js') diff --git a/public/assets/javascripts/rectangles/engine/map/ui_editor.js b/public/assets/javascripts/rectangles/engine/map/ui_editor.js index c838b8b..44ca91d 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 -- cgit v1.2.3-70-g09d2 From af2673a3fd976327e9a92fd6b497f5f5cd82d7b3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 13 Nov 2014 18:40:50 -0500 Subject: global room height toggle --- .../javascripts/rectangles/engine/map/ui_editor.js | 27 +++++++++++++++++++++- .../javascripts/rectangles/engine/scenery/undo.js | 12 +++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'public/assets/javascripts/rectangles/engine/map/ui_editor.js') diff --git a/public/assets/javascripts/rectangles/engine/map/ui_editor.js b/public/assets/javascripts/rectangles/engine/map/ui_editor.js index 44ca91d..d1b0b89 100644 --- a/public/assets/javascripts/rectangles/engine/map/ui_editor.js +++ b/public/assets/javascripts/rectangles/engine/map/ui_editor.js @@ -227,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 ) diff --git a/public/assets/javascripts/rectangles/engine/scenery/undo.js b/public/assets/javascripts/rectangles/engine/scenery/undo.js index 6ad9e0d..8b85d02 100644 --- a/public/assets/javascripts/rectangles/engine/scenery/undo.js +++ b/public/assets/javascripts/rectangles/engine/scenery/undo.js @@ -111,7 +111,17 @@ Rooms.rebuild() }, }, - + + { + type: "update-rooms-height", + undo: function(state){ + var rooms = Rooms.values() + rooms.forEach(function(room){ + room.height = state + }) + }, + }, + // { -- cgit v1.2.3-70-g09d2