From 3987b73569e58843f2a91c0c6c4e4132f51ac247 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 21 Mar 2012 17:13:56 -0700 Subject: Do not set webkit-transform styles on elements unless 3d is used on them. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index d62fa1f8..eac0ca54 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -90,9 +90,12 @@ exports.ElementMediator = Montage.create(NJComponent, { _addElement: { value: function(el, rules, noEvent) { ElementController.addElement(el, rules); - var p3d = this.get3DProperties(el); - if(p3d) { - el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); +// var p3d = this.get3DProperties(el); +// if(p3d) { +// el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); +// } + if(el.elementModel && el.elementModel.props3D) { + el.elementModel.props3D.init(el, false); } if(!noEvent) { this.application.ninja.documentController.activeDocument.needsSave = true; -- cgit v1.2.3 From bead8ce9e292f030a4b2fba6ad7fd38fb4fe5199 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 22 Mar 2012 11:16:39 -0700 Subject: IKNINJA-758 - The rotation value of the stage is not updated in the properties panel. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index eac0ca54..a2440fb4 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -673,17 +673,17 @@ exports.ElementMediator = Montage.create(NJComponent, { }, setMatrix: { - value: function(el, mat, isChanging) { + value: function(el, mat, isChanging, source) { var dist = el.elementModel.controller["getPerspectiveDist"](el); el.elementModel.controller["set3DProperties"](el, [{mat:mat, dist:dist}], 0, !isChanging); if(isChanging) { - NJevent("elementChanging", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); + NJevent("elementChanging", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } else { - NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); + NJevent("elementChange", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } } }, -- cgit v1.2.3 From 350d290d5fd0903289d55a7f4a6e643040e3d65e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 3 Apr 2012 10:56:53 -0700 Subject: IKNinja-1375 - After WebGL conversion from PI, Selection tool gets deactivated or becomes non-functional to the shape. Need to set elementModel.isIn2DSnapCache to false when replacing element. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index d62fa1f8..3eeab9c4 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -132,6 +132,7 @@ exports.ElementMediator = Montage.create(NJComponent, { value: function(el, el2) { el2.elementModel = el.elementModel; this.application.ninja.currentDocument.documentRoot.replaceChild(el2, el); + el2.elementModel.isIn2DSnapCache = false; } }, -- cgit v1.2.3 From df0389e6a191ebbff4e4b5d6625007873c0737bd Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 4 Apr 2012 10:21:20 -0700 Subject: Adjusting line's width and height when changing stroke size. Signed-off-by: Nivesh Rajbhandari --- 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 3eeab9c4..3182d5ec 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -319,7 +319,7 @@ exports.ElementMediator = Montage.create(NJComponent, { for(var i=0, item; item = els[i]; i++) { el = item._element || item; - el.elementModel.controller["setProperty"](el, p, value[i]); + el.elementModel.controller["setProperty"](el, p, value[i], eventType, source); } NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); -- cgit v1.2.3 From db0fa4e454b76d8a2bd6ba47c6f10166761179e7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 4 Apr 2012 14:06:38 -0700 Subject: Adding replaceElement routine and event so Timeline can avoid removing and adding layers and PI and SelectionController can avoid deselecting and reselecting the element. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 09f2aeed..b0efc02b 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -84,6 +84,23 @@ exports.ElementMediator = Montage.create(Component, { } }, + replaceElement: { + value: function(newChild, oldChild, notify) { + + this.application.ninja.currentDocument.documentRoot.replaceChild(newChild, oldChild); + + var undoLabel = "replace element"; + + document.application.undoManager.add(undoLabel, this.replaceElement, this, oldChild, newChild); + + this.application.ninja.documentController.activeDocument.needsSave = true; + + if(notify || notify === undefined) { + NJevent("elementReplaced", {type : "replaceElement", data: {"newChild": newChild, "oldChild": oldChild}}); + } + } + }, + getProperty: { value: function(el, prop, valueMutator) { if(!el.elementModel) { -- cgit v1.2.3 From 4ae2fd54e3844d788536dd00814c6aad0aa9f121 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 5 Apr 2012 10:31:23 -0700 Subject: Removing unnecessary code element = element. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 05e5093b..a26fba79 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -28,7 +28,6 @@ exports.ElementMediator = Montage.create(Component, { value: function(elements, rules, notify) { if(Array.isArray(elements)) { elements.forEach(function(element) { - element = element; ElementController.addElement(element, rules); }); } else { -- cgit v1.2.3 From f38b97c6134242831e203f7036219aa2f7fad71e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 5 Apr 2012 11:01:07 -0700 Subject: Fixing curly brackets from auto-merge. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index a26fba79..c153101e 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -37,12 +37,12 @@ exports.ElementMediator = Montage.create(Component, { var prop3d = this.get3DProperties(elements); if(prop3d) { elements.elementModel.controller["set3DProperties"](elements, [prop3d], 0, true); - } - } + } + } if(this.addDelegate && typeof (this.addDelegate['onAddElements']) === "function") { this.addDelegate['onAddElements'].call(this.addDelegate, elements); - } + } var undoLabel = "add element"; @@ -52,9 +52,9 @@ exports.ElementMediator = Montage.create(Component, { if(notify || notify === undefined) { NJevent("elementAdded", elements); - } + } } - }, + }, removeElements: { value: function(elements, notify /* Used for the add undo */) { @@ -62,7 +62,7 @@ exports.ElementMediator = Montage.create(Component, { if(this.deleteDelegate && (typeof this.deleteDelegate.handleDelete === 'function')) { return this.deleteDelegate.handleDelete(); // this.handleDelete.call(deleteDelegate); - } + } if(Array.isArray(elements)) { elements = Array.prototype.slice.call(elements, 0); @@ -77,10 +77,10 @@ exports.ElementMediator = Montage.create(Component, { document.application.undoManager.add(undoLabel, this.addElements, this, elements, null, notify); - this.application.ninja.documentController.activeDocument.needsSave = true; + this.application.ninja.documentController.activeDocument.needsSave = true; NJevent("elementsRemoved", elements); - } + } }, replaceElement: { @@ -96,8 +96,8 @@ exports.ElementMediator = Montage.create(Component, { if(notify || notify === undefined) { NJevent("elementReplaced", {type : "replaceElement", data: {"newChild": newChild, "oldChild": oldChild}}); + } } - } }, getProperty: { @@ -620,8 +620,8 @@ exports.ElementMediator = Montage.create(Component, { value: function(el) { var str = this.getProperty(el, "-webkit-transform"); return str && str.length; - } - } + } + } -- cgit v1.2.3 From 0798df3eba23fad4d48dd3a59e20451a406569e1 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 5 Apr 2012 11:48:57 -0700 Subject: Adding back fix in mediator to not set 3d styles unless necessary. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index c153101e..a05ca631 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -29,14 +29,14 @@ exports.ElementMediator = Montage.create(Component, { if(Array.isArray(elements)) { elements.forEach(function(element) { ElementController.addElement(element, rules); + if(element.elementModel && element.elementModel.props3D) { + element.elementModel.props3D.init(element, false); + } }); } else { ElementController.addElement(elements, rules); - - // TODO - Check with webgl branch - Props seem to be already there. - var prop3d = this.get3DProperties(elements); - if(prop3d) { - elements.elementModel.controller["set3DProperties"](elements, [prop3d], 0, true); + if(elements.elementModel && elements.elementModel.props3D) { + elements.elementModel.props3D.init(elements, false); } } -- cgit v1.2.3