diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-10-02 17:22:05 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-10-02 17:22:05 -0400 |
| commit | 1ca354257049dd9bf69a3542e2274c50e85ca788 (patch) | |
| tree | 3583b1af1a7178eb448eab9640ef1546227200d7 /public/assets/javascripts/rectangles/models/wall.js | |
| parent | b1556ef6f9854e08f5bb20907c57a9558005af95 (diff) | |
| parent | e271f9d7c0b2cf3998d1d8921f1f830bd7bab3ef (diff) | |
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/wall.js | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js index 1b37aa0..fdc8d8c 100644 --- a/public/assets/javascripts/rectangles/models/wall.js +++ b/public/assets/javascripts/rectangles/models/wall.js @@ -50,13 +50,36 @@ index: index, }) }, +/* mousemove: function(e){ + var offset = offsetFromPoint(e, mx.el) + if (offset) { + var pos = base.mxOffsetToPosition( offset, index ) + + var mx_pos = base.positionToMx(pos, new vec2(5,5)) + var mx_dot = new MX.Object3D + mx_dot.move(mx_pos) + mx_dot.width = 5 + mx_dot.height = 5 + mx_dot.rotationY = wall_rotation[base.side] + mx_dot.el.style.backgroundColor = "red" + scene.add(mx_dot) + } }, +*/ mousedown: function(e){ - if (Scenery.nextMedia) { + if (Scenery.nextText) { + } + else if (Scenery.nextMedia) { + var offset = offsetFromPoint(e, mx.el) + if (! offset) { return } + + var pos = base.mxOffsetToPosition( offset, index ) + var scenery = Scenery.addNextToWall({ wall: base, - index: index + index: index, + position: pos, }) // scenery was not placed @@ -176,7 +199,16 @@ } return position } - + Wall.prototype.mxOffsetToPosition = function( offset, index ) { + var face = this.surface.faces[index] + var shouldFlip = this.side & (RIGHT | FRONT) + var position = new vec2(0,0) + position.a = face.x.lerp(shouldFlip ? 1-offset.left : offset.left) + position.b = face.y.lerp(1-offset.top) + position.round() + return position + } + Wall.prototype.color = function(color){ this.$walls.css("background-color", color) } |
