summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/models')
-rw-r--r--public/assets/javascripts/rectangles/models/floor.js36
-rw-r--r--public/assets/javascripts/rectangles/models/room.js14
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js2
3 files changed, 37 insertions, 15 deletions
diff --git a/public/assets/javascripts/rectangles/models/floor.js b/public/assets/javascripts/rectangles/models/floor.js
index a144ecd..2fb870f 100644
--- a/public/assets/javascripts/rectangles/models/floor.js
+++ b/public/assets/javascripts/rectangles/models/floor.js
@@ -36,8 +36,40 @@
this.mx.forEach(function(mx, index){
$(mx.el).bind({
+ 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){
- if (Scenery.nextWallpaper) {
+
+ // 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
+ }
+
+ if (Scenery.nextWallpaper) {
var oldState = base.serialize()
base.wallpaper(Scenery.nextWallpaper)
// Scenery.nextWallpaper = null
@@ -50,6 +82,8 @@
// TODO: watch individual scenery object here
Minotaur.watch( app.router.editorView.settings )
+
+ app.controller.pickWall(base, null)
}
else {
app.controller.pickWall(base, null)
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 cead2e4..75814dc 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -282,7 +282,7 @@
url = "url(" + url + ")"
}
this.mx.forEach(function(mx){
- mx.el.style.backgroundImage = url
+ if (mx.el) mx.el.style.backgroundImage = url
})
}