diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-04-01 21:42:40 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-04-01 21:42:40 -0400 |
| commit | f9112718b560d4cc8380dd905d6cb60c497230bb (patch) | |
| tree | 6ddc1c39d3e92d7781e3f82aed8ec35581ff2513 | |
| parent | 39f1a7136567ae7e0afbf085732853cc86123393 (diff) | |
get x/z position when clicking floor
| -rw-r--r-- | public/assets/javascripts/rectangles/models/floor.js | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/public/assets/javascripts/rectangles/models/floor.js b/public/assets/javascripts/rectangles/models/floor.js index 439c16a..7b020a9 100644 --- a/public/assets/javascripts/rectangles/models/floor.js +++ b/public/assets/javascripts/rectangles/models/floor.js @@ -69,9 +69,41 @@ return } + + var offset = offsetFromPoint(e, mx.el) + if (! offset) { return } + + var x = mx.x + mx.width * (offset.left-0.5) + var z = mx.z + mx.height * (0.5-offset.top) + if (Scenery.nextMedia) { e.preventDefault() - // + + var sculpture = Sculpture.addNextToWall({ + index: index, + position: pos, + }) + + // scenery was not placed + if (! sculpture) { + e.stopPropagation() + return + } + + app.controller.toolbar.resetPermissions() + Sculpture.resize.show(sculpture) + Sculpture.hovering = true + + // app.controller.pick(sculpture) + + UndoStack.push({ + type: 'create-sculpture', + undo: { id: sculpture.id }, + redo: sculpture.serialize(), + }) + + // TODO: watch individual sculpture object here + Minotaur.watch( app.router.editorView.settings ) } else if (Scenery.nextWallpaper) { var oldState = base.serialize() @@ -102,7 +134,7 @@ this.mx.reverse() } } - + Floor.prototype.color = function(color){ this.$els.css("background-color", color) } |
