summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/javascripts/mx/extensions/mx.movements.js6
-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/floor.js36
-rw-r--r--public/assets/javascripts/rectangles/models/room.js14
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js2
-rw-r--r--public/assets/javascripts/ui/_router.js1
-rw-r--r--public/assets/javascripts/ui/builder/BuilderInfo.js21
-rw-r--r--public/assets/javascripts/ui/builder/BuilderView.js5
-rw-r--r--public/assets/javascripts/ui/editor/Presets.js11
-rw-r--r--public/assets/javascripts/ui/lib/UploadView.js4
-rw-r--r--public/assets/javascripts/ui/reader/MediaPlayer.js2
-rw-r--r--public/assets/javascripts/util.js55
-rwxr-xr-xpublic/assets/stylesheets/app.css33
-rw-r--r--views/controls/editor/media-drawer.ejs2
-rw-r--r--views/controls/editor/wallpaper.ejs17
16 files changed, 167 insertions, 67 deletions
diff --git a/public/assets/javascripts/mx/extensions/mx.movements.js b/public/assets/javascripts/mx/extensions/mx.movements.js
index 6b082d1..2993fb6 100644
--- a/public/assets/javascripts/mx/extensions/mx.movements.js
+++ b/public/assets/javascripts/mx/extensions/mx.movements.js
@@ -139,15 +139,15 @@ MX.Movements = function (cam) {
app.controller.mediaViewer.hide()
$(".inuse").removeClass("inuse")
}
- else if (app.controller.colorControl.$el.hasClass('active')) {
+ else if (app.controller.colorControl && app.controller.colorControl.$el.hasClass('active')) {
app.controller.colorControl.hide()
$(".inuse").removeClass("inuse")
}
- else if (app.controller.wallpaperPicker.$el.hasClass('active')) {
+ else if (app.controller.wallpaperPicker && app.controller.wallpaperPicker.$el.hasClass('active')) {
app.controller.wallpaperPicker.hide()
$(".inuse").removeClass("inuse")
}
- else if (app.controller.presets.$el.hasClass('active')) {
+ else if (app.controller.presets && app.controller.presets.$el.hasClass('active')) {
app.controller.presets.hide()
$(".inuse").removeClass("inuse")
}
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/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
})
}
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js
index 794079e..bda0960 100644
--- a/public/assets/javascripts/ui/_router.js
+++ b/public/assets/javascripts/ui/_router.js
@@ -212,7 +212,6 @@ var SiteRouter = Router.extend({
// this.documentModal.destroy(name)
},
-
testWallpaper: function(e){
var content = document.getElementById("content")
content.style.width = "680px"
diff --git a/public/assets/javascripts/ui/builder/BuilderInfo.js b/public/assets/javascripts/ui/builder/BuilderInfo.js
index 67834e7..4fd145d 100644
--- a/public/assets/javascripts/ui/builder/BuilderInfo.js
+++ b/public/assets/javascripts/ui/builder/BuilderInfo.js
@@ -10,8 +10,11 @@ var BuilderInfo = View.extend({
"change [name=width]": 'changeWidth',
"change [name=depth]": 'changeDepth',
"change [name=height]": 'changeHeight',
+ "keydown [name=width]": 'enterWidth',
+ "keydown [name=depth]": 'enterDepth',
+ "keydown [name=height]": 'enterHeight',
"change [name=units]": 'changeUnits',
- "change [name=resolution]": 'changeResolution',
+ "keydown [name=viewHeight]": 'enterViewHeight',
"change [name=viewHeight]": 'changeViewHeight',
"click [data-role=destroy-room]": 'destroy',
},
@@ -85,16 +88,27 @@ var BuilderInfo = View.extend({
this.hide()
},
+ enterWidth: function(e){
+ if (e.keyCode == 13) this.changeWidth(e)
+ },
changeWidth: function(e){
e.stopPropagation()
this.room.rect.x.setLength( this.$width.unitVal() )
Rooms.rebuild()
},
+
+ enterDepth: function(e){
+ if (e.keyCode == 13) this.changeDepth(e)
+ },
changeDepth: function(e){
e.stopPropagation()
this.room.rect.y.setLength( this.$depth.unitVal() )
Rooms.rebuild()
},
+
+ enterHeight: function(e){
+ if (e.keyCode == 13) this.changeHeight(e)
+ },
changeHeight: function(e){
e.stopPropagation()
this.room.height = this.$height.unitVal()
@@ -114,7 +128,10 @@ var BuilderInfo = View.extend({
app.units = this.$units.val()
this.$('.units').resetUnitVal()
},
- changeViewHeight: function(){
+ enterViewHeight: function(e){
+ if (e.keyCode == 13) this.changeViewHeight(e)
+ },
+ changeViewHeight: function(){
window.viewHeight = this.$viewHeight.unitVal( )
},
diff --git a/public/assets/javascripts/ui/builder/BuilderView.js b/public/assets/javascripts/ui/builder/BuilderView.js
index 735274e..9b7e1a2 100644
--- a/public/assets/javascripts/ui/builder/BuilderView.js
+++ b/public/assets/javascripts/ui/builder/BuilderView.js
@@ -31,6 +31,9 @@ var BuilderView = View.extend({
},
hideExtras: function(){
- }
+ },
+
+ pickWall: function(wall, pos){
+ },
})
diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js
index be86af3..ab311ef 100644
--- a/public/assets/javascripts/ui/editor/Presets.js
+++ b/public/assets/javascripts/ui/editor/Presets.js
@@ -84,15 +84,12 @@ var Presets = View.extend({
this.parent.colorControl.modes.forEach(function(mode){
if (! preset[mode].length) {
Walls.setWallpaper[mode](preset[mode])
- Walls.setColor[mode](preset[mode].color)
}
else {
- if (preset[mode].length) {
- Walls.clearWallpaper[mode]()
- }
- Walls.setColor[mode](preset[mode])
- this.parent.colorControl.$swatch[ mode ].css("background-color", rgb_string(preset[mode]))
- }
+ Walls.clearWallpaper[mode]()
+ }
+ Walls.setColor[mode](preset[mode])
+ this.parent.colorControl.$swatch[ mode ].css("background-color", rgb_string(preset[mode]))
}.bind(this))
this.parent.colorControl.setMode(preset.wall.color ? "wall" : "floor")
Walls.setBodyColor()
diff --git a/public/assets/javascripts/ui/lib/UploadView.js b/public/assets/javascripts/ui/lib/UploadView.js
index efaa8c9..2d2c2c7 100644
--- a/public/assets/javascripts/ui/lib/UploadView.js
+++ b/public/assets/javascripts/ui/lib/UploadView.js
@@ -4,12 +4,12 @@ var UploadView = View.extend({
// define uploadAction
events: {
- "change .file": "handleFileSelect",
+ "change [type=file]": "handleFileSelect",
"submit form": "preventDefault",
},
initialize: function(){
- this.$file = this.$(".file")
+ this.$file = this.$("[type=file]")
this.$upload = this.$(".upload-icon")
},
diff --git a/public/assets/javascripts/ui/reader/MediaPlayer.js b/public/assets/javascripts/ui/reader/MediaPlayer.js
index 6195ab6..7f73e1b 100644
--- a/public/assets/javascripts/ui/reader/MediaPlayer.js
+++ b/public/assets/javascripts/ui/reader/MediaPlayer.js
@@ -44,7 +44,7 @@ var MediaPlayer = FormView.extend({
this.unbind()
}
if (media.type == "image") {
- if ((! media.title || ! media.title.length) && (! media.description || ! media.description.length)) {
+ if ((! media.title || ! media.title.length) && (! media.description || ! media.description.length) || (media.title == filenameFromUrl(media.url)) ) {
this.hide()
return
}
diff --git a/public/assets/javascripts/util.js b/public/assets/javascripts/util.js
index 367e20e..2fa994a 100644
--- a/public/assets/javascripts/util.js
+++ b/public/assets/javascripts/util.js
@@ -185,3 +185,58 @@ function bitcount(v) {
v = (v & 0x33333333) + ((v >>> 2) & 0x33333333);
return ((v + (v >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24;
}
+
+// Function.bind polyfill
+if (!Function.prototype.bind) {
+ Function.prototype.bind = function(oThis) {
+ if (typeof this !== 'function') {
+ // closest thing possible to the ECMAScript 5
+ // internal IsCallable function
+ throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
+ }
+
+ var aArgs = Array.prototype.slice.call(arguments, 1),
+ fToBind = this,
+ fNOP = function() {},
+ fBound = function() {
+ return fToBind.apply(this instanceof fNOP && oThis
+ ? this
+ : oThis,
+ aArgs.concat(Array.prototype.slice.call(arguments)));
+ };
+
+ fNOP.prototype = this.prototype;
+ fBound.prototype = new fNOP();
+
+ return fBound;
+ };
+}
+
+// rAF polyfill
+(function() {
+ var lastTime = 0;
+ var vendors = ['ms', 'moz', 'webkit', 'o'];
+ for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
+ window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
+ window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
+ || window[vendors[x]+'CancelRequestAnimationFrame'];
+ }
+
+ if (!window.requestAnimationFrame)
+ window.requestAnimationFrame = function(callback, element) {
+ var currTime = new Date().getTime();
+ var timeToCall = Math.max(0, 16 - (currTime - lastTime));
+ var id = window.setTimeout(function() { callback(currTime + timeToCall); },
+ timeToCall);
+ lastTime = currTime + timeToCall;
+ return id;
+ };
+
+ if (!window.cancelAnimationFrame)
+ window.cancelAnimationFrame = function(id) {
+ clearTimeout(id);
+ };
+}());
+
+
+
diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css
index 28eabd9..226fe98 100755
--- a/public/assets/stylesheets/app.css
+++ b/public/assets/stylesheets/app.css
@@ -1507,9 +1507,12 @@ border-left: 1px solid black;
.toolButton {
border: 1px solid;
- display: inline-block;
- width: 100%;
- margin-top: 5px;
+ position: relative;
+ display: block;
+ float: right;
+ margin-left: 3px;
+ width: 35px;
+ height: 35px;
font-size: 14px;
font-weight: 300;
}
@@ -1524,9 +1527,9 @@ border-left: 1px solid black;
}
.wallpaper form {
position: relative;
- padding: 2px 0 0 0;
font-size: 14px;
font-weight: 300;
+ overflow: hidden;
}
.toolButton:hover {
background:black;
@@ -1550,14 +1553,19 @@ border-left: 1px solid black;
.wallpaper .wallpaperRemove:hover img {
-webkit-filter:invert(100%);
}
+.wallpaperUpload .upload-icon {
+ margin: 0 8px;
+}
.wallpaperUpload .upload-icon.uploading {
}
.wallpaperUpload .upload-icon.uploading:before {
content: ' ' !important;
background-image: url("/assets/img/loader.gif");
background-repeat: no-repeat;
- width: 40px;
- height: 40px;
+ background-position: center;
+ width: 100%;
+ height: 100%;
+ position:absolute;top:0;left:0;
}
.wallpaperUpload input[type="text"]{
border: 1px solid #ccc;
@@ -1575,7 +1583,7 @@ border-left: 1px solid black;
top: 0;
left: 0;
background: blue;
- height: 28px;
+ height: 100%;
width: 100%;
opacity: 0;
cursor: pointer;
@@ -1922,8 +1930,8 @@ input[type="range"]::-webkit-slider-thumb {
}
.playButton,.muteButton {
- border-radius: 50px;
- font-size: 22px;
+ border-radius: 50%;
+ font-size: 23px;
padding: 5px 0;
cursor: pointer;
margin-right: 5px;
@@ -1934,6 +1942,8 @@ input[type="range"]::-webkit-slider-thumb {
}
.playButton .on {
display: inline;
+ position: relative;
+ left: 1px;
}
.playButton.paused .on {
display: none;
@@ -1948,6 +1958,8 @@ input[type="range"]::-webkit-slider-thumb {
.muteButton .on {
display: inline;
padding-right: 3px;
+ position: relative;
+ left: 2px;
}
.muteButton.muted .on {
display: none;
@@ -1958,6 +1970,9 @@ input[type="range"]::-webkit-slider-thumb {
.muteButton.muted .off {
display: inline;
padding-right: 3px;
+ position: relative;
+ left: 2px;
+ top: -1px;
}
.btn, button {
diff --git a/views/controls/editor/media-drawer.ejs b/views/controls/editor/media-drawer.ejs
index d1e2c99..1404d86 100644
--- a/views/controls/editor/media-drawer.ejs
+++ b/views/controls/editor/media-drawer.ejs
@@ -26,7 +26,7 @@
<form>
<span class="ion-ios7-upload-outline upload-icon"></span><br>
Upload File
- <input type="file" accept="image/*" class="file" multiple>
+ <input type="file" accept="image/*" multiple>
</form>
<small>~ or ~</small><br>
<input type="text" placeholder="Enter Vimeo or YouTube or image link" class="url">
diff --git a/views/controls/editor/wallpaper.ejs b/views/controls/editor/wallpaper.ejs
index ed175ae..69a60ec 100644
--- a/views/controls/editor/wallpaper.ejs
+++ b/views/controls/editor/wallpaper.ejs
@@ -9,31 +9,20 @@
<span class="swatch" style="background-image:url(/assets/img/plainpattern.png)"></span>
<span class="swatch" style="background-image:url(/assets/img/plainpattern2.png)"></span>
</span>
+
+ <input type="text" class="url" placeholder="enter a url">
<div class="wallpaperUpload toolButton">
<form>
<span class="ion-ios7-upload-outline upload-icon"></span>
- <label>Upload Wallpaper</label>
- <input type="file" accept="image/*" class="file" multiple>
+ <input type="file" accept="image/*" multiple>
</form>
-<!--
- <input type="text" placeholder="Enter Image URL" class="url">
- -->
</div>
<div class="wallpaperRemove toolButton">
<span class="ion-scissors"></span>
- <label>Remove Wallpaper</label>
</div>
-<!--
- <div class="wallpaperResize toolButton">
- <span class="ion-arrow-resize"></span>
- <label>Resize Wallpaper</label>
- </div>
--->
- <input type="text" class="url" placeholder="enter a url">
-
<div class="wallpaperResizeControls">
<span data-role="wallpaper-position" class="ion-arrow-expand"></span>
<input data-role="wallpaper-scale" type="range" min="0.01" max="8.0" step="0.1" value="1.0">