From a11ef2eed7049835c8bdfa50a2b893632c46eaa0 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 4 Apr 2012 11:11:58 -0700 Subject: Squashed commit of Preparing for the montage undo-manager: Architecture changes Reworked the add and remove elements into 1 function which can take 1 or more elements. Removed the _element from the selection array Many other changes related to those 2 changes Undo/Redo shortcuts are now using montage undo/redo manager. Signed-off-by: Valerio Virgillito --- js/stage/layout.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'js/stage/layout.js') diff --git a/js/stage/layout.js b/js/stage/layout.js index 6be2df1d..ae9260fc 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -53,12 +53,8 @@ exports.Layout = Montage.create(Component, { this.ctx.lineWidth = this.ctxLineWidth; this.ctx.fillStyle = this.drawFillColor; -// this.eventManager.addEventListener("elementAdded", this, false); - this.eventManager.addEventListener("elementDeleted", this, false); - this.eventManager.addEventListener("selectionChange", this, false); - - this.eventManager.addEventListener("deleteSelection", this, false); + this.eventManager.addEventListener("elementsRemoved", this, false); } }, @@ -76,7 +72,7 @@ exports.Layout = Montage.create(Component, { }, // Redraw stage only once after all deletion is completed - handleDeleteSelection: { + handleElementsRemoved: { value: function(event) { this.draw(); this.draw3DInfo(false); @@ -110,10 +106,8 @@ exports.Layout = Montage.create(Component, { // Draw the non selected elements if(!event.detail.isDocument) { - var tmp = event.detail.elements.map(function(element){ return element._element}); - this.elementsToDraw = this.domTree.filter(function(value) { - return (tmp.indexOf(value) === -1); + return (event.detail.elements.indexOf(value) === -1); }); } else { this.elementsToDraw = Array.prototype.slice.call(this.domTree, 0); @@ -345,7 +339,11 @@ exports.Layout = Montage.create(Component, { _elementName: { value: function(item) { - return this.application.ninja.elementMediator.getNJProperty(item, "selection"); + if(item.elementModel && item.elementModel.hasOwnProperty("selection")) { + return item.elementModel['selection']; + } else { + return ""; + } } } -- cgit v1.2.3