summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles')
-rw-r--r--public/assets/javascripts/rectangles/engine/map/ui_editor.js2
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/_walls.js23
-rw-r--r--public/assets/javascripts/rectangles/models/room.js14
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js36
4 files changed, 49 insertions, 26 deletions
diff --git a/public/assets/javascripts/rectangles/engine/map/ui_editor.js b/public/assets/javascripts/rectangles/engine/map/ui_editor.js
index 9d69990..1ab9c73 100644
--- a/public/assets/javascripts/rectangles/engine/map/ui_editor.js
+++ b/public/assets/javascripts/rectangles/engine/map/ui_editor.js
@@ -235,7 +235,7 @@ Map.UI.Editor = function(map){
}, 250)
}
else {
- map.set_zoom(map.zoom_exponent - deltaY/20)
+ map.set_zoom(map.zoom_exponent + deltaY/20)
}
}
diff --git a/public/assets/javascripts/rectangles/engine/rooms/_walls.js b/public/assets/javascripts/rectangles/engine/rooms/_walls.js
index fe5913d..653278c 100644
--- a/public/assets/javascripts/rectangles/engine/rooms/_walls.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/_walls.js
@@ -126,11 +126,10 @@
var ceilingColor = rgb_string(Walls.colors.ceiling)
Walls.list.forEach(function(wall){
wall.outline(wallColor, outlineColor)
- // TODO: SET WALLPAPER HERE
})
- Rooms.forEach(function(room){
- room.setFloorColor(floorColor)
- room.setCeilingColor(ceilingColor)
+ Walls.floors.forEach(function(floor){
+ if (floor.ceiling) floor.color(ceilingColor)
+ else floor.color(floorColor)
})
}
@@ -181,16 +180,18 @@
wall.wallpaper("none")
})
},
+ outline: function(){
+ },
floor: function(){
Walls.floors.forEach(function(floor){
if (floor.ceiling) return
- wall.wallpaper("none")
+ floor.wallpaper("none")
})
},
ceiling: function(){
Walls.floors.forEach(function(floor){
if (! floor.ceiling) return
- wall.wallpaper("none")
+ floor.wallpaper("none")
})
},
}
@@ -223,16 +224,18 @@
floor: function(rgb){
var rgbColor = rgb_string(rgb)
Walls.colors.floor = rgb
- Rooms.forEach(function(room){
- room.setFloorColor(rgbColor)
+ Walls.floors.forEach(function(floor){
+ if (floor.ceiling) return
+ floor.color(rgbColor)
})
},
ceiling: function(rgb){
var rgbColor = rgb_string(rgb)
Walls.colors.ceiling = rgb
- Rooms.forEach(function(room){
- room.setCeilingColor(rgbColor)
+ Walls.floors.forEach(function(floor){
+ if (! floor.ceiling) return
+ floor.color(rgbColor)
})
},
}
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
})
}