From b88ebb47d82fc1ffebea49c3bf182aaf3c9419af Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 15:53:11 -0800 Subject: Fixed issue with elements not drawing in the correct plane. When first adding an element, force the 3d model to update with the element's webkit transform values. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 91b09475..a6f31703 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -92,6 +92,11 @@ 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); + } if(!noEvent) NJevent("elementAdded", el); } }, -- cgit v1.2.3 From affafafc4db16e5f918c74dfc919025d4c563cc6 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 17:30:53 -0800 Subject: Updated color code to handle shapes. 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 91b09475..4c34e668 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -457,7 +457,7 @@ exports.ElementMediator = Montage.create(NJComponent, { if(!currentValue) { var that = this; currentValue = els.map(function(item) { - return that.getColor(item._element); + return that.getColor(item._element, isFill); }); } -- cgit v1.2.3 From 830b011d94d728882286d72e129f7405134957c7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 1 Feb 2012 17:05:07 -0800 Subject: Updated color code in the PI to go through element mediator. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 4c34e668..7c5c161c 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -431,7 +431,7 @@ exports.ElementMediator = Montage.create(NJComponent, { getColor: { value: function(el, isFill) { if(!el.elementModel) { - NJUtils.makeElementModel(el, "Div", "block"); + NJUtils.makeElementModel2(el); } return el.elementModel.controller["getColor"](el, isFill); } @@ -589,6 +589,15 @@ exports.ElementMediator = Montage.create(NJComponent, { } }, + getColor2: { + value: function(el, prop, mutator) { + if(!el.elementModel) { + NJUtils.makeElementModel2(el); + } + + return this.getColor(el, (prop === "background")); + } + }, //-------------------------------------------------------------------------------------------------------- // Routines to get/set 3D properties -- cgit v1.2.3 From 737169d194fc29c82ee784b561065f287e259f88 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 2 Feb 2012 15:35:27 -0800 Subject: Fixing keyboard shortcut and tooltip for hand and 3d tools. Signed-off-by: Nivesh Rajbhandari --- js/mediators/keyboard-mediator.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/mediators') diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js index 144932c0..a1fdead3 100644 --- a/js/mediators/keyboard-mediator.js +++ b/js/mediators/keyboard-mediator.js @@ -178,6 +178,12 @@ exports.KeyboardMediator = Montage.create(Component, { return; } + if(evt.keyCode === Keyboard.H ) { + evt.preventDefault(); + this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[15]}); + return; + } + if(evt.keyCode === Keyboard.Z ) { evt.preventDefault(); this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[16]}); -- cgit v1.2.3 From 854a6d1be334782c8e232601e6d562a11296e55a Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 3 Feb 2012 14:06:26 -0800 Subject: Update grid and planes when elementChange event signifies the "matrix", "left", "top", "width" or "height" properties have changed. 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 1d0aef44..b2bc5355 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -425,7 +425,7 @@ exports.ElementMediator = Montage.create(NJComponent, { el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); } - NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); + NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null}); } }, @@ -660,11 +660,11 @@ exports.ElementMediator = Montage.create(NJComponent, { if(isChanging) { - NJevent("elementChanging", {type : "setMatrix", source: null, data: {"el": el, "prop": "matrix", "value": mat}, redraw: null}); + NJevent("elementChanging", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } else { - NJevent("elementChange", {type : "setMatrix", source: null, data: {"el": el, "prop": "matrix", "value": mat}, redraw: null}); + NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } } }, -- cgit v1.2.3 From d7ad2659d7ef8d0fffbb1cba8218061ebd516dd0 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 3 Feb 2012 15:09:54 -0800 Subject: Handle delete of multiple objects. Also, have deletion go through the mediator so elementDeleted event is fired for SnapManager, DrawUtils, etc. to clean up after deleted element(s). Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index b2bc5355..992ac620 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -44,12 +44,16 @@ exports.ElementMediator = Montage.create(NJComponent, { this.deleteDelegate.handleDelete(); } else { // Add the Undo/Redo - var els = []; + var els = [], + len = this.application.ninja.selectedElements.length; - if(this.application.ninja.selectedElements.length > 0) { - for(var i=0, item; item = this.application.ninja.selectedElements[i]; i++) { - ElementController.removeElement(item._element); - els.push(item._element); + if(len) { + for(var i = 0; i --- js/mediators/drag-drop-mediator.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'js/mediators') diff --git a/js/mediators/drag-drop-mediator.js b/js/mediators/drag-drop-mediator.js index 07e4a50c..aacb228c 100644 --- a/js/mediators/drag-drop-mediator.js +++ b/js/mediators/drag-drop-mediator.js @@ -62,7 +62,7 @@ exports.DragDropMediator = Montage.create(Component, { handleDropEvent: { value: function(evt){ - var xferString, component; + var xferString, component, file, files, idx, len; this.baseX = evt.offsetX - this.application.ninja.stage.userContentLeft; this.baseY = evt.offsetY - this.application.ninja.stage.userContentTop; @@ -85,11 +85,8 @@ exports.DragDropMediator = Montage.create(Component, { return; } - var file; - const files = evt.dataTransfer.files; - var idx; - const len = files.length; - + files = evt.dataTransfer.files; + len = files.length; // Loop over all dragged files... for (idx = 0; idx < len; idx++) { -- cgit v1.2.3 From 1b0c5c0e7ebf9dda95a624da546aaece268631ad Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 6 Feb 2012 10:59:51 -0800 Subject: Fixing format of for loop. Signed-off-by: Nivesh Rajbhandari --- 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 992ac620..c44e1cb5 100644 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -48,10 +48,10 @@ exports.ElementMediator = Montage.create(NJComponent, { len = this.application.ninja.selectedElements.length; if(len) { - for(var i = 0; i