From e28eb9158a50d7e6d97dbc68066e591ac600c241 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 5 Jun 2012 21:40:44 -0700 Subject: removing all model creators. The elementModel is now a getter that will create a new model when needed. Signed-off-by: Valerio Virgillito --- .../components-panel.reel/components-panel.js | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'js/panels') diff --git a/js/panels/components-panel.reel/components-panel.js b/js/panels/components-panel.reel/components-panel.js index 0b453c4a..e6b7a6e3 100755 --- a/js/panels/components-panel.reel/components-panel.js +++ b/js/panels/components-panel.reel/components-panel.js @@ -292,8 +292,6 @@ exports.ComponentsPanel = Montage.create(Component, { } } -// that.application.ninja.currentDocument.model.setComponentInstance(instance, element); - //that.application.ninja.elementMediator.addElements(element, styles); ElementController.addElement(element, styles); }); @@ -303,11 +301,6 @@ exports.ComponentsPanel = Montage.create(Component, { componentInstanceOnFirstDraw: { value: function(instance) { - // Temporary hack until the element model rework goes into place - // TODO: Remove this once we have the element model define property code in place. - if(!instance.element.elementModel) { - this.application.njUtils.makeModelFromElement(instance.element); - } this.application.ninja.elementMediator.addElements(instance.element); } }, @@ -319,75 +312,60 @@ exports.ComponentsPanel = Montage.create(Component, { switch(name) { case "anchor": el = document.application.njUtils.make("a", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Anchor"); el.setAttribute("href", "http://www.motorola.com"); el.innerHTML = "link"; break; case "button": el = document.application.njUtils.make(name, null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Button"); el.setAttribute("type", "button"); el.innerHTML = "Button"; break; case "checkbox": el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Checkbox"); el.setAttribute("type", "checkbox"); break; case "imageComponent": el = document.application.njUtils.make("image", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Image"); el.setAttribute("width", 200); el.setAttribute("height", 200); break; case "numberInput": el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Number Input"); el.setAttribute("type", "number"); break; case "select": el = document.application.njUtils.make("select", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "SelectInput"); break; case "radioButton": el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Radio Button"); el.setAttribute("type", "radio"); break; case "rangeInput": el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Range Input"); el.setAttribute("type", "range"); break; case "textfield": el = document.application.njUtils.make("input", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Textfield"); el.setAttribute("type", "text"); break; case "textarea": el = document.application.njUtils.make("textarea", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Textarea"); break; case "toggleButton": el = document.application.njUtils.make("button", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Toggle Button"); el.innerHTML = "Off"; break; case "map": el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Map"); break; case "feedreader": el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Feed Reader"); break; case "picasa-carousel": el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Picasa Carousel"); break; case "youtube-channel": el = document.application.njUtils.make("div", null, this.application.ninja.currentDocument); - document.application.njUtils.createModelForComponent(el, "Youtube Channel"); break; } -- cgit v1.2.3 From 25d639e6c7dd737f4671011faf07091c86c0e324 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 7 Jun 2012 13:13:01 -0700 Subject: fixing the body color chip for non banners templates Signed-off-by: Valerio Virgillito --- js/panels/properties.reel/properties.js | 4 ++-- js/panels/properties.reel/sections/custom.reel/custom.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'js/panels') diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index 934a3851..cc99ca6c 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -243,8 +243,8 @@ exports.Properties = Montage.create(Component, { controls = this.customSections[n].content.controls; if(controls["colorSelect"]) { controls["colorSelect"].destroy(); - } else if(controls["background"]) { - controls["background"].destroy(); + } else if(controls["background-color"]) { + controls["background-color"].destroy(); } } diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js index ae408f11..9df16112 100755 --- a/js/panels/properties.reel/sections/custom.reel/custom.js +++ b/js/panels/properties.reel/sections/custom.reel/custom.js @@ -400,7 +400,7 @@ exports.CustomSection = Montage.create(Component, { this.controls[aField.id] = obj; // TODO - Hack for now to reference the color select object to unregister color chips - this.controls["background"] = obj; + this.controls["background-color"] = obj; return obj; } -- cgit v1.2.3 From 4070475b8da7257eca629be7288bf7a31d5e384e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 7 Jun 2012 15:33:50 -0700 Subject: IKNINJA-1702: Fix the timeline resized throwing a debugger error Signed-off-by: Valerio Virgillito --- js/panels/resize-composer.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/panels') diff --git a/js/panels/resize-composer.js b/js/panels/resize-composer.js index 0d1774cd..57126690 100644 --- a/js/panels/resize-composer.js +++ b/js/panels/resize-composer.js @@ -105,6 +105,8 @@ exports.ResizeComposer = Montage.create(Composer, { captureMouseup: { value: function(e) { e.preventDefault(); + e.stopImmediatePropagation(); + e.stopPropagation(); window.removeEventListener("mousemove", this, true); window.removeEventListener("mouseup", this, true); this._executeEvent("resizeEnd"); -- cgit v1.2.3 From 0e18d3d973da09d636e848820e30d22a5e554fc9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 8 Jun 2012 13:02:48 -0700 Subject: IKNINJA-1702: Fix the timeline resized throwing a debugger error part 2 Signed-off-by: Valerio Virgillito --- js/panels/resize-composer.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/panels') diff --git a/js/panels/resize-composer.js b/js/panels/resize-composer.js index 57126690..2278623f 100644 --- a/js/panels/resize-composer.js +++ b/js/panels/resize-composer.js @@ -115,6 +115,9 @@ exports.ResizeComposer = Montage.create(Composer, { captureMousemove: { value: function(e) { + e.preventDefault(); + e.stopImmediatePropagation(); + e.stopPropagation(); if (this.xAxis) { this._deltaX = e.clientX - this._startX; } -- cgit v1.2.3 From 806974142d44afdd23534bf2d18eff0a8e701e0c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 8 Jun 2012 16:59:59 -0700 Subject: rewrite: currentSelectedContainer -> domContainer Fixed the currentSelectedContainer by removing bindings and using property change on the current document added the red outline back. Signed-off-by: Valerio Virgillito --- .../Timeline/TimelinePanel.reel/TimelinePanel.js | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'js/panels') diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index d7329ac7..f7ab5117 100644 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -53,6 +53,14 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { } } }, + + handleChange: { + value: function() { + if(this.currentDocument && this.currentDocument.model.getProperty("domContainer")) { + this.currentSelectedContainer = this.currentDocument.model.getProperty("domContainer"); + } + } + }, _currentSelectedContainer: { value: null @@ -405,13 +413,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.tl_configbutton.addEventListener("click", this.handleConfigButtonClick.bind(this), false); document.addEventListener("click", this.handleDocumentClick.bind(this), false); - - // Bind some bindings - Object.defineBinding(this, "currentSelectedContainer", { - boundObject:this.application.ninja, - boundObjectPropertyPath:"currentSelectedContainer", - oneway:true - }); + this.addPropertyChangeListener("currentDocument.model.domContainer", this); } }, @@ -512,7 +514,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { if (this._boolCacheArrays) { // ... but only if we're supposed to. this.application.ninja.currentDocument.tlArrLayers = this.arrLayers; - this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; + this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentDocument.model.domContainer; this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; this.application.ninja.currentDocument.tlCurrentLayerSelected = this.currentLayerSelected; this.application.ninja.currentDocument.tlCurrentLayersSelected = this.currentLayersSelected; @@ -525,7 +527,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // Initialize the currentDocument for a new set of timeline data. this.application.ninja.currentDocument.isTimelineInitialized = true; this.application.ninja.currentDocument.tlArrLayers = []; - this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.application.ninja.currentSelectedContainer; + this.application.ninja.currentDocument.tlCurrentSelectedContainer = this.currentDocument.model.domContainer; this.application.ninja.currentDocument.tllayerNumber = this.currentLayerNumber; this.application.ninja.currentDocument.tlCurrentLayerSelected = false; this.application.ninja.currentDocument.tlCurrentLayersSelected = false; @@ -669,7 +671,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { // console.log('TimelinePanel.initTimelineForDocument: breadCrumbClick'); // Information stored, but we're moving up or down in the breadcrumb. // Get the current selection and restore timeline info for its children. - var parentNode = this.application.ninja.currentSelectedContainer, + var parentNode = this.currentDocument.model.domContainer, storedCurrentLayerNumber = this.application.ninja.currentDocument.tllayerNumber; this.temparrLayers = []; @@ -708,7 +710,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { //debugger; if (typeof(this.application.ninja.currentDocument.tlCurrentSelectedContainer) !== "undefined") { -// this.application.ninja.currentSelectedContainer=this.application.ninja.currentDocument.tlCurrentSelectedContainer; +// this.currentDocument.model.domContainer = this.application.ninja.currentDocument.tlCurrentSelectedContainer; } // Are we only showing animated layers? @@ -984,7 +986,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { thingToPush.layerData.layerName = newLayerName; thingToPush.layerData.layerTag = "<" + object.nodeName.toLowerCase() + ">"; thingToPush.layerData.layerID = this.currentLayerNumber; - thingToPush.parentElement = this.application.ninja.currentSelectedContainer; + thingToPush.parentElement = this.currentDocument.model.domContainer; thingToPush.layerData.isSelected = true; thingToPush.layerData._isFirstDraw = true; thingToPush.layerData.created = true; @@ -1032,7 +1034,7 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { thingToPush.layerData.layerName = newLayerName; thingToPush.layerData.layerID = this.currentLayerNumber; thingToPush.layerData.layerTag = "<" + ele.nodeName.toLowerCase() + ">"; - thingToPush.parentElement = this.application.ninja.currentSelectedContainer; + thingToPush.parentElement = this.currentDocument.model.domContainer; if (this.checkable_animated.classList.contains("checked")) { thingToPush.layerData.isVisible = false; } -- cgit v1.2.3