From a696dffcc84b4d2719f8fa918676f9575858ca9a Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 17 May 2012 16:52:16 -0700 Subject: Timeline: Multiselect improvements. New convenience methods. Multiselect drag and drop. --- js/mediators/element-mediator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 06514076..9c8a9ac4 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -524,9 +524,9 @@ exports.ElementMediator = Montage.create(Component, { length = layersDraggedArray.length; for(var i=0; documentRoot.children[i]; i++) { - if(documentRoot.children[i] === layerDroppedAfter.layerData.elementsList[0]) { + if(documentRoot.children[i] === layerDroppedAfter.layerData.stageElement) { if(length >0){ - documentRoot.children[i].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0], documentRoot.children[i]); + documentRoot.children[i].parentNode.insertBefore(layersDraggedArray[length-1].layerData.stageElement, documentRoot.children[i]); } /* Will require for Multiple Drag n Drop */ -- cgit v1.2.3 From 82b0c1b8ee197e23fbd5184cbb0522ca76e651c8 Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Thu, 31 May 2012 14:27:51 -0700 Subject: Color Chip Signed-off-by: Kruti Shah --- js/mediators/element-mediator.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 7d5040ef..6449a625 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -315,10 +315,10 @@ exports.ElementMediator = Montage.create(Component, { @param stageRedraw: *OPTIONAL*: True. If set to false the stage will not redraw the selection/outline */ setColor: { - value: function(els, value, isFill, eventType, source, currentValue) { + value: function(els, value, isFill, eventType, source, currentValue,borderSide) { if(eventType === "Changing") { - this._setColor(els, value, isFill, eventType, source); + this._setColor(els, value, isFill, eventType, source,borderSide); } else { // Calculate currentValue if not found for each element if(!currentValue) { @@ -337,11 +337,12 @@ exports.ElementMediator = Montage.create(Component, { _source: { value: "undo-redo"}, description: { value: "Set Color"}, receiver: { value: this}, + _borderSide: { value: borderSide}, execute: { value: function(senderObject) { if(senderObject) this._source = senderObject; - this.receiver._setColor(this._els, this._value, this._isFill, this._eventType, this._source); + this.receiver._setColor(this._els, this._value, this._isFill, this._eventType, this._source,this._borderSide); this._source = "undo-redo"; return ""; } @@ -363,9 +364,9 @@ exports.ElementMediator = Montage.create(Component, { }, _setColor: { - value: function(els, value, isFill, eventType, source) { + value: function(els, value, isFill, eventType, source,borderSide) { for(var i=0, item; item = els[i]; i++) { - item.elementModel.controller["setColor"](item, value, isFill); + item.elementModel.controller["setColor"](item, value, isFill,borderSide); } NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); -- cgit v1.2.3 From bedb38e14887b29eae3cdf1c8d435259c920257c Mon Sep 17 00:00:00 2001 From: Kruti Shah Date: Tue, 12 Jun 2012 13:05:12 -0700 Subject: Sub Props Signed-off-by: Kruti Shah --- js/mediators/element-mediator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 6449a625..67f2a562 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -369,7 +369,7 @@ exports.ElementMediator = Montage.create(Component, { item.elementModel.controller["setColor"](item, value, isFill,borderSide); } - NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill}, redraw: null}); + NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill, "borderSide":borderSide}, redraw: null}); } }, -- cgit v1.2.3 From 85dfdc9d46847d5fdd1b6fc6aaf35e93b09e9935 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Fri, 15 Jun 2012 00:28:24 -0700 Subject: F6 support for keyframes Signed-off-by: Jonathan Duran --- js/mediators/keyboard-mediator.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'js/mediators') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 4fd4bd4c..d1f8e221 100755 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -50,6 +50,7 @@ var Keyboard = exports.Keyboard = { X:88, Y:89, Z:90, + F6:117, PLUS:187, MINUS:189 }; @@ -210,6 +211,12 @@ exports.KeyboardMediator = Montage.create(Component, { return; } + // F6 keyboard shortcut to add a keyframe to the timeline + if (evt.keyCode == Keyboard.F6) { + this.application.ninja.timeline.handleKeyframeShortcut(); + return; + } + // Check if cmd+a/ctrl+a for Select All if((evt.keyCode == Keyboard.A) && (evt.ctrlKey || evt.metaKey)) { NJevent("selectAll"); -- cgit v1.2.3 From 0da75e4de7373ed361b5d76be4ee192453146dde Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Tue, 19 Jun 2012 18:04:06 -0700 Subject: Timeline: Re-enable drag-and-drop of layers, now with bonus DOM manipulation! --- js/mediators/element-mediator.js | 43 ++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index bd0ae3cb..99d2f822 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -483,30 +483,25 @@ exports.ElementMediator = Montage.create(Component, { }, reArrangeDOM:{ - value: function(layersDraggedArray, layerDroppedAfter) { - var documentRoot,length; - - documentRoot = this.application.ninja.currentDocument.model.documentRoot; - length = layersDraggedArray.length; - - for(var i=0; documentRoot.children[i]; i++) { - if(documentRoot.children[i] === layerDroppedAfter.layerData.stageElement) { - if(length >0){ - documentRoot.children[i].parentNode.insertBefore(layersDraggedArray[length-1].layerData.stageElement, documentRoot.children[i]); - } - - /* Will require for Multiple Drag n Drop */ - //length = length-1; - //index = i; - //if(length>0) { - //while(layersDraggedArray[length]) { - //documentRoot.children[index].parentNode.insertBefore(layersDraggedArray[length-1].layerData.elementsList[0],documentRoot.children[k].nextSibling); - //length--; - //index++; - //} - //} - } - } + value: function(arrLayersDragged, dropTargetElement) { + var i = 0, + arrLayersDraggedLength = arrLayersDragged.length, + targetParentNode, + targetElement; + + if (arrLayersDraggedLength === 0) { + // Nothing was dragged, so return. + return; + } + + // Get the target parent node (this will be the parentNode of any of the dragging items) + targetParentNode = arrLayersDragged[0].parentNode; + + + // Loop through arrLayersDragged and insertBefore the drop target element + for (i = 0; i < arrLayersDraggedLength; i++) { + targetParentNode.insertBefore(arrLayersDragged[i], dropTargetElement); + } } } }); \ No newline at end of file -- cgit v1.2.3 From eb228e0489928f0464c295a024f0d45cf0a147c8 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 20 Jun 2012 11:24:13 -0700 Subject: remove unneeded files Signed-off-by: Jonathan Duran --- js/mediators/element-mediator.js | 350 +++++++++++++++++++-------------------- 1 file changed, 175 insertions(+), 175 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 99d2f822..ca7aadaf 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -1,42 +1,42 @@ /* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. + */ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; var ElementController = require("js/controllers/elements/element-controller").ElementController, - Command = require("js/controllers/undo-controller").Command, + Command = require("js/controllers/undo-controller").Command, NJUtils = require("js/lib/NJUtils").NJUtils; exports.ElementMediator = Montage.create(Component, { - addDelegate: { - enumerable: false, - value: null + addDelegate:{ + enumerable:false, + value:null }, - deleteDelegate: { - enumerable: false, - value: null + deleteDelegate:{ + enumerable:false, + value:null }, - addElements: { - value: function(elements, rules, notify) { - if(Array.isArray(elements)) { - elements.forEach(function(element) { + addElements:{ + value:function (elements, rules, notify) { + if (Array.isArray(elements)) { + elements.forEach(function (element) { ElementController.addElement(element, rules); - element.elementModel.props3D.init(element, false); + element.elementModel.props3D.init(element, false); }); } else { ElementController.addElement(elements, rules); - elements.elementModel.props3D.init(elements, false); + elements.elementModel.props3D.init(elements, false); - } + } - if(this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { + if (this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { this.addDelegate['onAddElements'].call(this.addDelegate, elements); } @@ -46,23 +46,23 @@ exports.ElementMediator = Montage.create(Component, { this.application.ninja.currentDocument.model.needsSave = true; - if(notify || notify === undefined) { + if (notify || notify === undefined) { NJevent("elementAdded", elements); } } }, - removeElements: { - value: function(elements, notify /* Used for the add undo */) { + removeElements:{ + value:function (elements, notify /* Used for the add undo */) { - if(this.deleteDelegate && (typeof this.deleteDelegate.handleDelete === 'function')) { + if (this.deleteDelegate && (typeof this.deleteDelegate.handleDelete === 'function')) { return this.deleteDelegate.handleDelete(); // this.handleDelete.call(deleteDelegate); } - if(Array.isArray(elements)) { + if (Array.isArray(elements)) { elements = Array.prototype.slice.call(elements, 0); - elements.forEach(function(element) { + elements.forEach(function (element) { ElementController.removeElement(element); }); } else { @@ -79,8 +79,8 @@ exports.ElementMediator = Montage.create(Component, { } }, - replaceElement: { - value: function(newChild, oldChild, notify) { + replaceElement:{ + value:function (newChild, oldChild, notify) { this.application.ninja.currentDocument.model.documentRoot.replaceChild(newChild, oldChild); if (newChild.getAttribute) newChild.setAttribute('data-ninja-node', 'true'); @@ -91,15 +91,15 @@ exports.ElementMediator = Montage.create(Component, { this.application.ninja.currentDocument.model.needsSave = true; - if(notify || notify === undefined) { - NJevent("elementReplaced", {type : "replaceElement", data: {"newChild": newChild, "oldChild": oldChild}}); + if (notify || notify === undefined) { + NJevent("elementReplaced", {type:"replaceElement", data:{"newChild":newChild, "oldChild":oldChild}}); } } }, - getProperty: { - value: function(el, prop, valueMutator) { - if(valueMutator && typeof valueMutator === "function") { + getProperty:{ + value:function (el, prop, valueMutator) { + if (valueMutator && typeof valueMutator === "function") { return valueMutator(el.elementModel.controller["getProperty"](el, prop)); } else { return el.elementModel.controller["getProperty"](el, prop, valueMutator); @@ -107,28 +107,28 @@ exports.ElementMediator = Montage.create(Component, { } }, - getShapeProperty: { - value: function(el, prop) { + getShapeProperty:{ + value:function (el, prop) { return el.elementModel.controller["getShapeProperty"](el, prop); } }, - setShapeProperty: { - value: function(el, prop, value) { + setShapeProperty:{ + value:function (el, prop, value) { return el.elementModel.controller["setShapeProperty"](el, prop, value); } }, /** - Set a property change command for an element or array of elements - @param element: Element - @param attribute: Attribute to set - @param value: Value to be set. - @param currentValue: current value - @param source: String for the source object making the call - */ - setAttribute: { - value: function(element, attribute, value, currentValue, source) { + Set a property change command for an element or array of elements + @param element: Element + @param attribute: Attribute to set + @param value: Value to be set. + @param currentValue: current value + @param source: String for the source object making the call + */ + setAttribute:{ + value:function (element, attribute, value, currentValue, source) { element.elementModel.controller["setAttribute"](element, attribute, value); // Add to the undo @@ -149,40 +149,40 @@ exports.ElementMediator = Montage.create(Component, { @param currentValue *OPTIONAL*: current value array. If not found the current value is calculated @param stageRedraw: *OPTIONAL*: True. If set to false the stage will not redraw the selection/outline */ - setProperty: { - value: function(els, p, value, eventType, source, currentValue) { - if(eventType === "Changing") { + setProperty:{ + value:function (els, p, value, eventType, source, currentValue) { + if (eventType === "Changing") { this._setProperty(els, p, value, eventType, source); } else { // Calculate currentValue if not found for each element - if(!currentValue) { + if (!currentValue) { var that = this; - currentValue = els.map(function(item) { + currentValue = els.map(function (item) { return that.getProperty((item), p); }); } var command = Montage.create(Command, { - _els: { value: els }, - _p: { value: p }, - _value: { value: value }, - _previous: { value: currentValue }, - _eventType: { value: eventType}, - _source: { value: "undo-redo"}, - description: { value: "Set Property"}, - receiver: { value: this}, - - execute: { - value: function(senderObject) { - if(senderObject) this._source = senderObject; + _els:{ value:els }, + _p:{ value:p }, + _value:{ value:value }, + _previous:{ value:currentValue }, + _eventType:{ value:eventType}, + _source:{ value:"undo-redo"}, + description:{ value:"Set Property"}, + receiver:{ value:this}, + + execute:{ + value:function (senderObject) { + if (senderObject) this._source = senderObject; this.receiver._setProperty(this._els, this._p, this._value, this._eventType, this._source); this._source = "undo-redo"; return ""; } }, - unexecute: { - value: function() { + unexecute:{ + value:function () { this.receiver._setProperty(this._els, this._p, this._previous, this._eventType, this._source); return ""; } @@ -196,15 +196,15 @@ exports.ElementMediator = Montage.create(Component, { } }, - _setProperty: { - value: function(els, p, value, eventType, source) { + _setProperty:{ + value:function (els, p, value, eventType, source) { var el; - for(var i=0, item; item = els[i]; i++) { + for (var i = 0, item; item = els[i]; i++) { item.elementModel.controller["setProperty"](item, p, value[i], eventType, source); } - NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); + NJevent("element" + eventType, {type:"setProperty", source:source, data:{"els":els, "prop":p, "value":value}, redraw:null}); } }, @@ -214,16 +214,16 @@ exports.ElementMediator = Montage.create(Component, { @param eventType: Change/Changing. Will be passed to the dispatched event @param source: String for the source object making the call */ - setProperties: { - value: function(elements, eventType, source) { + setProperties:{ + value:function (elements, eventType, source) { - elements.forEach(function(elementObject) { + elements.forEach(function (elementObject) { elementObject.element.elementModel.controller["setProperties"](elementObject.element, elementObject.properties); }); - if(eventType !== "Changing") { + if (eventType !== "Changing") { var undoLabel = "Properties change"; - elements.forEach(function(elementObject) { + elements.forEach(function (elementObject) { var swap = elementObject.properties; elementObject.properties = elementObject.previousProperties; elementObject.previousProperties = swap; @@ -233,52 +233,52 @@ exports.ElementMediator = Montage.create(Component, { // Map the elements for the event data // TODO: Clean this up - var els = elements.map(function(element) { + var els = elements.map(function (element) { return element.element; }); // Dispatch the element change/changing event. - NJevent("element" + eventType, {type : "setProperties", source: source, data: {"els": els, "prop": elements[0].properties, "value": elements}, redraw: null}); + NJevent("element" + eventType, {type:"setProperties", source:source, data:{"els":els, "prop":elements[0].properties, "value":elements}, redraw:null}); } }, - set3DProperties: { - value: function(elements, eventType, source) { + set3DProperties:{ + value:function (elements, eventType, source) { var update3DModel = false; - if(eventType === "Change") { + if (eventType === "Change") { update3DModel = true; } - for(var i=0, item; item = elements[i]; i++) { + for (var i = 0, item; item = elements[i]; i++) { item.element.elementModel.controller["set3DProperties"](item.element, item.properties, update3DModel); } /* - if(eventType === "Change") { - var undoLabel = "3D Properties change"; - elements.forEach(function(elementObject) { - var swap = elementObject.properties; - elementObject.properties = elementObject.previousProperties; - elementObject.previousProperties = swap; - }); - document.application.undoManager.add(undoLabel, this.set3DProperties, this, elements, eventType, source); - } - */ - - var els = elements.map(function(element) { + if(eventType === "Change") { + var undoLabel = "3D Properties change"; + elements.forEach(function(elementObject) { + var swap = elementObject.properties; + elementObject.properties = elementObject.previousProperties; + elementObject.previousProperties = swap; + }); + document.application.undoManager.add(undoLabel, this.set3DProperties, this, elements, eventType, source); + } + */ + + var els = elements.map(function (element) { return element.element; }); - NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": elements}, redraw: null}); + NJevent("element" + eventType, {type:"set3DProperties", source:source, data:{"els":els, "prop":"matrix", "value":elements}, redraw:null}); } }, //-------------------------------------------------------------------------------------------------------- // Routines to get/set color - getColor: { - value: function(el, isFill, borderSide) { + getColor:{ + value:function (el, isFill, borderSide) { return el.elementModel.controller["getColor"](el, isFill, borderSide); } }, @@ -293,42 +293,42 @@ exports.ElementMediator = Montage.create(Component, { @param currentValue *OPTIONAL*: current value array. If not found the current value is calculated @param stageRedraw: *OPTIONAL*: True. If set to false the stage will not redraw the selection/outline */ - setColor: { - value: function(els, value, isFill, eventType, source, currentValue,borderSide) { + setColor:{ + value:function (els, value, isFill, eventType, source, currentValue, borderSide) { - if(eventType === "Changing") { - this._setColor(els, value, isFill, eventType, source,borderSide); + if (eventType === "Changing") { + this._setColor(els, value, isFill, eventType, source, borderSide); } else { // Calculate currentValue if not found for each element - if(!currentValue) { + if (!currentValue) { var that = this; - currentValue = els.map(function(item) { + currentValue = els.map(function (item) { return that.getColor(item, isFill); }); } var command = Montage.create(Command, { - _els: { value: els }, - _value: { value: value }, - _isFill: { value: isFill }, - _previous: { value: currentValue }, - _eventType: { value: eventType}, - _source: { value: "undo-redo"}, - description: { value: "Set Color"}, - receiver: { value: this}, - _borderSide: { value: borderSide}, - - execute: { - value: function(senderObject) { - if(senderObject) this._source = senderObject; - this.receiver._setColor(this._els, this._value, this._isFill, this._eventType, this._source,this._borderSide); + _els:{ value:els }, + _value:{ value:value }, + _isFill:{ value:isFill }, + _previous:{ value:currentValue }, + _eventType:{ value:eventType}, + _source:{ value:"undo-redo"}, + description:{ value:"Set Color"}, + receiver:{ value:this}, + _borderSide:{ value:borderSide}, + + execute:{ + value:function (senderObject) { + if (senderObject) this._source = senderObject; + this.receiver._setColor(this._els, this._value, this._isFill, this._eventType, this._source, this._borderSide); this._source = "undo-redo"; return ""; } }, - unexecute: { - value: function() { + unexecute:{ + value:function () { this.receiver._setColor(this._els, this._previous, this._isFill, this._eventType, this._source); return ""; } @@ -342,18 +342,18 @@ exports.ElementMediator = Montage.create(Component, { } }, - _setColor: { - value: function(els, value, isFill, eventType, source,borderSide) { - for(var i=0, item; item = els[i]; i++) { - item.elementModel.controller["setColor"](item, value, isFill,borderSide); + _setColor:{ + value:function (els, value, isFill, eventType, source, borderSide) { + for (var i = 0, item; item = els[i]; i++) { + item.elementModel.controller["setColor"](item, value, isFill, borderSide); } - NJevent("element" + eventType, {type : "setColor", source: source, data: {"els": els, "prop": "color", "value": value, "isFill": isFill, "borderSide":borderSide}, redraw: null}); + NJevent("element" + eventType, {type:"setColor", source:source, data:{"els":els, "prop":"color", "value":value, "isFill":isFill, "borderSide":borderSide}, redraw:null}); } }, - getStroke: { - value: function(el, strokeProperties) { + getStroke:{ + value:function (el, strokeProperties) { return el.elementModel.controller["getStroke"](el, strokeProperties); } }, @@ -366,31 +366,31 @@ exports.ElementMediator = Montage.create(Component, { @param source: String for the source object making the call @param currentValue *OPTIONAL*: current value array. If not found the current value is calculated */ - setStroke: { - value: function(els, value, eventType, source, currentValue) { + setStroke:{ + value:function (els, value, eventType, source, currentValue) { - if(eventType !== "Changing") { + if (eventType !== "Changing") { // Calculate currentValue if not found for each element - if(!currentValue) { + if (!currentValue) { var that = this, val = value; - currentValue = els.map(function(item) { + currentValue = els.map(function (item) { return that.getStroke(item, val); }); } document.application.undoManager.add("Set stroke", this.setStroke, this, els, currentValue, eventType, source, value); } - for(var i=0, item; item = els[i]; i++) { + for (var i = 0, item; item = els[i]; i++) { item.elementModel.controller["setStroke"](item, (value[i] || value), eventType, source); } - NJevent("element" + eventType, {type : "setStroke", source: source, data: {"els": els, "prop": "stroke", "value": value}, redraw: null}); + NJevent("element" + eventType, {type:"setStroke", source:source, data:{"els":els, "prop":"stroke", "value":value}, redraw:null}); } }, - getFill: { - value: function(el, fillProperties) { + getFill:{ + value:function (el, fillProperties) { return el.elementModel.controller["getFill"](el, fillProperties); } }, @@ -403,39 +403,39 @@ exports.ElementMediator = Montage.create(Component, { @param source: String for the source object making the call @param currentValue *OPTIONAL*: current value array. If not found the current value is calculated */ - setFill: { - value: function(els, value, eventType, source, currentValue) { + setFill:{ + value:function (els, value, eventType, source, currentValue) { - if(eventType !== "Changing") { + if (eventType !== "Changing") { // Calculate currentValue if not found for each element - if(!currentValue) { + if (!currentValue) { var that = this, val = value; - currentValue = els.map(function(item) { + currentValue = els.map(function (item) { return that.getFill(item, val); }); } document.application.undoManager.add("Set fill", this.setFill, this, els, currentValue, eventType, source, value); } - for(var i=0, item; item = els[i]; i++) { + for (var i = 0, item; item = els[i]; i++) { item.elementModel.controller["setFill"](item, (value[i] || value)); } - NJevent("element" + eventType, {type : "setFill", source: source, data: {"els": els, "prop": "fill", "value": value}, redraw: null}); + NJevent("element" + eventType, {type:"setFill", source:source, data:{"els":els, "prop":"fill", "value":value}, redraw:null}); } }, //-------------------------------------------------------------------------------------------------------- // Routines to get/set 3D properties - get3DProperty: { - value: function(el, prop) { + get3DProperty:{ + value:function (el, prop) { return el.elementModel.controller["get3DProperty"](el, prop); } }, - get3DProperties: { - value: function(el) { + get3DProperties:{ + value:function (el) { // var mat = this.getMatrix(el); // var dist = this.getPerspectiveDist(el); var mat = el.elementModel.controller["getMatrix"](el); @@ -444,64 +444,64 @@ exports.ElementMediator = Montage.create(Component, { } }, - getMatrix: { - value: function(el) { + getMatrix:{ + value:function (el) { return el.elementModel.controller["getMatrix"](el); } }, - getPerspectiveDist: { - value: function(el) { + getPerspectiveDist:{ + value:function (el) { return el.elementModel.controller["getPerspectiveDist"](el); } }, - getPerspectiveMode: { - value: function(el) { + getPerspectiveMode:{ + value:function (el) { return this.getProperty(el, "-webkit-transform-style"); } }, - setMatrix: { - value: function(el, mat, isChanging, source) { + setMatrix:{ + value:function (el, mat, isChanging, source) { var dist = el.elementModel.controller["getPerspectiveDist"](el); el.elementModel.controller["set3DProperties"](el, {mat:mat, dist:dist}, !isChanging); - if(isChanging) { - NJevent("elementChanging", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); + if (isChanging) { + NJevent("elementChanging", {type:"setMatrix", source:source, data:{"els":[el], "prop":"matrix", "value":mat}, redraw:null}); } else { - NJevent("elementChange", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); + NJevent("elementChange", {type:"setMatrix", source:source, data:{"els":[el], "prop":"matrix", "value":mat}, redraw:null}); } } }, - has3D: { - value: function(el) { + has3D:{ + value:function (el) { var str = this.getProperty(el, "-webkit-transform"); return str && str.length; } }, reArrangeDOM:{ - value: function(arrLayersDragged, dropTargetElement) { - var i = 0, - arrLayersDraggedLength = arrLayersDragged.length, - targetParentNode, - targetElement; - - if (arrLayersDraggedLength === 0) { - // Nothing was dragged, so return. - return; - } - - // Get the target parent node (this will be the parentNode of any of the dragging items) - targetParentNode = arrLayersDragged[0].parentNode; - - - // Loop through arrLayersDragged and insertBefore the drop target element - for (i = 0; i < arrLayersDraggedLength; i++) { - targetParentNode.insertBefore(arrLayersDragged[i], dropTargetElement); - } + value:function (arrLayersDragged, dropTargetElement) { + var i = 0, + arrLayersDraggedLength = arrLayersDragged.length, + targetParentNode, + targetElement; + + if (arrLayersDraggedLength === 0) { + // Nothing was dragged, so return. + return; + } + + // Get the target parent node (this will be the parentNode of any of the dragging items) + targetParentNode = arrLayersDragged[0].parentNode; + + + // Loop through arrLayersDragged and insertBefore the drop target element + for (i = 0; i < arrLayersDraggedLength; i++) { + targetParentNode.insertBefore(arrLayersDragged[i], dropTargetElement); + } } } }); \ No newline at end of file -- cgit v1.2.3