summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor/MediaEditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/editor/MediaEditor.js')
-rw-r--r--public/assets/javascripts/ui/editor/MediaEditor.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/public/assets/javascripts/ui/editor/MediaEditor.js b/public/assets/javascripts/ui/editor/MediaEditor.js
index cb57b69..eaa3134 100644
--- a/public/assets/javascripts/ui/editor/MediaEditor.js
+++ b/public/assets/javascripts/ui/editor/MediaEditor.js
@@ -3,7 +3,7 @@ var MediaEditor = FormView.extend({
el: "#mediaEditor",
events: {
- "keydown": 'stopPropagation',
+ "keydown": 'taint',
"focus [name]": "clearMinotaur",
"click [data-role=play-media]": "togglePaused",
"mousedown [name=keyframe]": "stopPropagation",
@@ -58,12 +58,16 @@ var MediaEditor = FormView.extend({
this.bind(scenery)
this.$el.addClass("active")
+// app.controller.toolbar.resetMode()
+ app.controller.toolbar.resetControls()
Scenery.resize.show(scenery)
Scenery.hovering = true
var media = scenery.media
- this.$name.val(media.title)
+ console.log(media)
+
+ this.$name.val(media.title || filenameFromUrl(media.url) )
this.$description.val(media.description)
this.setDimensions()
this.$units.val( "ft" )
@@ -101,12 +105,14 @@ var MediaEditor = FormView.extend({
seek: function(){
var n = parseFloat( this.$keyframe.val() )
this.scenery.seek(n)
+ this.tainted = true
this.scenery.media.keyframe = n
},
setAutoplay: function(){
var checked = this.$autoplay.prop('checked')
this.scenery.media.autoplay = checked
+ this.tainted = true
if (checked && this.scenery.paused()) {
this.togglePaused()
}
@@ -114,17 +120,20 @@ var MediaEditor = FormView.extend({
setLoop: function(){
var checked = this.$loop.prop('checked')
this.scenery.setLoop(checked)
+ this.tainted = true
},
setMute: function(){
var checked = this.$mute.prop('checked')
this.scenery.media.mute = checked
this.scenery.mute(checked)
+ this.tainted = true
},
setDimensions: function(){
if (! this.scenery) return
this.$width.unitVal( Number(this.scenery.naturalDimensions.a * this.scenery.scale) || "" )
this.$height.unitVal( Number(this.scenery.naturalDimensions.b * this.scenery.scale) || "" )
+ this.tainted = true
},
changeWidth: function(e){
e.stopPropagation()
@@ -140,6 +149,11 @@ var MediaEditor = FormView.extend({
app.units = this.$units.val()
this.$('.units').resetUnitVal()
},
+
+ taint: function(e){
+ e.stopPropagation()
+ this.tainted = true
+ },
bind: function(scenery){
this.scenery = scenery
@@ -148,7 +162,7 @@ var MediaEditor = FormView.extend({
},
unbind: function(){
- if (this.scenery) {
+ if (this.scenery && this.tainted) {
this.scenery.media.title = this.$name.val()
this.scenery.media.description = this.$description.val()
Minotaur.watch( app.router.editorView.settings )
@@ -158,11 +172,12 @@ var MediaEditor = FormView.extend({
this.scenery.mx.el.classList.remove("picked")
}
}
+ this.tainted = false
this.scenery = null
},
destroy: function(){
- ConfirmModal.confirm("Are you sure you want delete to this media?", function(){
+ ConfirmModal.confirm("Are you sure you want delete this object?", function(){
var scenery = this.scenery
this.hide()
Scenery.remove(scenery.id)