diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-11-13 18:40:50 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-11-13 18:40:50 -0500 |
| commit | af2673a3fd976327e9a92fd6b497f5f5cd82d7b3 (patch) | |
| tree | 6b8abf27448abd82084f37b397aefe9323169b66 | |
| parent | bc4517c6b09e03f52161dc38ca591ed0cc227d5d (diff) | |
global room height toggle
| -rw-r--r-- | public/assets/javascripts/rectangles/engine/map/ui_editor.js | 27 | ||||
| -rw-r--r-- | public/assets/javascripts/rectangles/engine/scenery/undo.js | 12 |
2 files changed, 37 insertions, 2 deletions
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 + }) + }, + }, + // { |
