diff options
Diffstat (limited to 'public/assets/javascripts/rectangles/models')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/room.js | 14 | ||||
| -rw-r--r-- | public/assets/javascripts/rectangles/models/wall.js | 36 |
2 files changed, 35 insertions, 15 deletions
diff --git a/public/assets/javascripts/rectangles/models/room.js b/public/assets/javascripts/rectangles/models/room.js index 1a4606c..b0344a1 100644 --- a/public/assets/javascripts/rectangles/models/room.js +++ b/public/assets/javascripts/rectangles/models/room.js @@ -158,19 +158,7 @@ }) return collision } - - Room.prototype.setFloorColor = function(rgbColor) { - this.mx_floor.map(function(mx){ - mx.el.style.backgroundColor = rgbColor - }) - } - - Room.prototype.setCeilingColor = function(rgbColor) { - this.mx_ceiling.map(function(mx){ - mx.el.style.backgroundColor = rgbColor - }) - } - + if ('window' in this) { window.Room = Room } diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js index eb445a7..75814dc 100644 --- a/public/assets/javascripts/rectangles/models/wall.js +++ b/public/assets/javascripts/rectangles/models/wall.js @@ -67,7 +67,39 @@ } }, */ + contextmenu: function(e){ + if (! (e.ctrlKey || e.metaKey || e.shiftKey) ) { + e.preventDefault() + } + if (Scenery.nextMedia) { + e.preventDefault() + Scenery.nextMedia = null + app.tube('cancel-scenery') + } + else if (Scenery.nextWallpaper) { + e.preventDefault() + Scenery.nextWallpaper = null + app.tube('cancel-wallpaper') + } + }, + mousedown: function(e){ + + // right-click + if (e.which == 3) { + if (Scenery.nextMedia) { + e.preventDefault() + Scenery.nextMedia = null + app.tube('cancel-scenery') + } + else if (Scenery.nextWallpaper) { + e.preventDefault() + Scenery.nextWallpaper = null + app.tube('cancel-wallpaper') + } + return + } + var offset = offsetFromPoint(e, mx.el) if (! offset) { return } @@ -120,7 +152,7 @@ else { app.controller.pickWall(base, pos) } - } + }, }) }) @@ -250,7 +282,7 @@ url = "url(" + url + ")" } this.mx.forEach(function(mx){ - mx.el.style.backgroundImage = url + if (mx.el) mx.el.style.backgroundImage = url }) } |
