From 9d17dc8dab12aa661ab321567f024406f4972abb Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 15:34:14 -0800 Subject: cleanup of the breadcrumb Signed-off-by: Valerio Virgillito --- .../bread-crumb-button.reel/bread-crumb-button.js | 35 +++---- .../layout/bread-crumb.reel/bread-crumb.js | 112 ++++++--------------- 2 files changed, 44 insertions(+), 103 deletions(-) diff --git a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js index 65e5b7c8..3f5b87e1 100755 --- a/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js +++ b/js/components/layout/bread-crumb-button.reel/bread-crumb-button.js @@ -7,45 +7,38 @@ var Montage = require("montage/core/core").Montage; var Component = require("montage/ui/component").Component; - exports.BreadcrumbButton = Montage.create(Component, { - button: { value: null }, + button: { + value: null + }, - data: { value: null }, + data: { + value: null + }, prepareForDraw: { - enumerable: false, value: function() { this.element.addEventListener("mousedown", this, false); } }, draw: { - enumerable: false, value: function() { - - if(this.data.element.id==="UserContent"){ - - this.button.innerHTML = "Body"; - } - - else{ - this.button.innerHTML=this.data.element.nodeName; - } - + if(this.data.element.id === "UserContent") { + this.button.innerHTML = "Body"; + } else { + this.button.innerHTML = this.data.element.nodeName; + } } }, handleMousedown: { value: function(event) { - if(event.which===1){ - - this.data.selected=true; - NJevent('breadCrumbTrail',this.data); - this.data.selected=false; - } + //this.data.selected=true; + NJevent('breadCrumbTrail',this.data); + //this.data.selected=false; } } diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index ead7c764..1290aaac 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -1,6 +1,6 @@ -var Montage = require("montage/core/core").Montage -var Component = require("montage/ui/component").Component +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { @@ -8,15 +8,12 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { value:null }, - container: { set: function(value) { - if(this._container !== value) { - this._container = value; - this.createContainerElements(); - } - - + if(this._container !== value) { + this._container = value; + this.createContainerElements(); + } }, get: function() { return this._container; @@ -25,7 +22,6 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { containerElements: { value: [] - }, @@ -33,14 +29,12 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { value: function() { this.eventManager.addEventListener( "appLoaded", this, false); this.eventManager.addEventListener( "breadCrumbTrail", this, false); - }, - enumerable : false + } }, handleAppLoaded : { value: function() { - Object.defineBinding(this, "container", { boundObject: this.application.ninja, boundObjectPropertyPath: "currentSelectedContainer", @@ -50,107 +44,61 @@ var Breadcrumb = exports.Breadcrumb = Montage.create(Component, { } }, - prepareForDraw: { - value: function() { - - } - }, - - draw: { - value: function() { - - } - }, - - didDraw:{ - value:function(){ - } - }, - createContainerElements: { value: function() { - var parentNode; - while(this.containerElements.pop()){ - // To empty the array to get the new parentNode of the new currentLevel - } - - if(this.container.id === "UserContent"){ - - this.containerElements.push({selected:false,element:this.container}); - + this.containerElements.length = 0 - } - else{ - - parentNode= this.container; - - while(parentNode.id!=="UserContent"){ - - this.containerElements.unshift ({selected:false,element:parentNode}); - parentNode=parentNode.parentNode; + if(this.container.id === "UserContent") { + this.containerElements.push({selected:false, element:this.container}); + } else { + parentNode = this.container; - } - - this.containerElements.unshift({selected:false,element:parentNode}); + while(parentNode.id!=="UserContent") { + this.containerElements.unshift({selected:false,element:parentNode}); + parentNode = parentNode.parentNode; + } + this.containerElements.unshift({selected:false,element:parentNode}); } NJevent('layerBinding',{selected:false ,element:this.container}) - - } }, - - handleBreadCrumbTrail: { + handleBreadCrumbTrail: { value: function(event) { + var newLength,revaluatedLength,tmpvalue; + var i=0; - var newLength,revaluatedLength,tmpvalue - var i=0; - if(event.detail.setFlag){ - this.application.ninja.currentSelectedContainer = event.detail.element; - return; + if(event.detail.setFlag ){ + this.application.ninja.currentSelectedContainer = event.detail.element; + return; } newLength = this.containerElements.length; while(i < newLength ){ - - if(this.containerElements[i].selected){ - - tmpvalue = i ; - break; - - } - + if(this.containerElements[i].selected){ + tmpvalue = i; + break; + } i++; } - - - for(i = newLength -1 ; i >= 1 ; i--){ - - if(tmpvalue!==i){ - + for(i = newLength -1 ; i >= 1 ; i--) { + if(tmpvalue !== i) { this.containerElements.pop(); - } - - else{ - + } else { break; } - } revaluatedLength = this.containerElements.length; this.application.ninja.currentSelectedContainer = this.containerElements[revaluatedLength-1].element; - } } - - }); -- cgit v1.2.3 From a4526e4b97608bd0a6797a493f797df737449182 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 15:35:09 -0800 Subject: formatting cleanup Signed-off-by: Valerio Virgillito --- js/tools/modifier-tool-base.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index 67b217c4..54bc06be 100755 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js @@ -791,8 +791,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { HandleLeftButtonDown: { value: function(event) { - var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, - new WebKitPoint(event.pageX, event.pageY)); + var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); this.downPoint.x = point.x; this.downPoint.y = point.y; -- cgit v1.2.3 From 31781742ad40854a48ede88cf3c7a6d700b35cbb Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 15:35:09 -0800 Subject: formatting cleanup Signed-off-by: Valerio Virgillito --- js/tools/SelectionTool.js | 13 +------------ js/tools/modifier-tool-base.js | 3 +-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 48548271..f76a6d85 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js @@ -115,8 +115,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { HandleLeftButtonUp: { value: function(event) { var selectedItems, - point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, - new WebKitPoint(event.pageX, event.pageY)); + point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); this.isDrawing = false; this.application.ninja.stage.showSelectionBounds = true; @@ -186,21 +185,11 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { HandleDoubleClick: { value: function(event) { - /* - var selectedObject = stageManagerModule.stageManager.GetObjectFromPoint(event.layerX, event.layerY, this._canOperateOnStage); - - if(selectedObject) { - if(selectionManagerModule.selectionManager.findSelectedElement(selectedObject) === -1) { - selectionManagerModule.selectionManager.setSingleSelection(selectedObject); - } - } - */ // Temporary Code for Breadcrumb if(this.application.ninja.selectedElements.length > 0) { this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0]._element; } else { - console.log(this.application.ninja.currentDocument.documentRoot.uuid); this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; } diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index 67b217c4..54bc06be 100755 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js @@ -791,8 +791,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { HandleLeftButtonDown: { value: function(event) { - var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, - new WebKitPoint(event.pageX, event.pageY)); + var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, new WebKitPoint(event.pageX, event.pageY)); this.downPoint.x = point.x; this.downPoint.y = point.y; -- cgit v1.2.3 From 736956ebba6db338127caeadb429d16bdf6bc375 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 21:52:57 -0800 Subject: Removing the timeline selection code. Timeline selection code is now handled by the selection controller and current container change Signed-off-by: Valerio Virgillito --- js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js index 44129743..07fee19d 100755 --- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js +++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js @@ -429,9 +429,13 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this._LayerUndoIndex = thingToPush.layerID; this._LayerUndoStatus = true; this._TrackUndoObject = newTrack; + + // Removing clearing the selection - Handled by the selection-controller + /* if(_firstLayerDraw){ - this.application.ninja.selectionController.executeSelectElement(); + this.application.ninja.selectionController.executeSelectElement(); } + */ } } @@ -753,9 +757,12 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, { this.trackRepetition.selectedIndexes = [layerIndex]; this.currentLayerSelected = this.arrLayers[layerIndex]; this.currentTrackSelected = this.arrTracks[layerIndex]; + // Selection is being handled by the selection controller + /* if(this._captureSelection){ - this.application.ninja.selectionController.selectElements(this.currentLayerSelected.element) + this.application.ninja.selectionController.selectElements(this.currentLayerSelected.element) } + */ this._captureSelection = true; } else { this.layerRepetition.selectedIndexes = null; -- cgit v1.2.3 From d03a7d460b8998fdee8ebac10397f0c014adeef6 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 21:53:21 -0800 Subject: Removing the log of the url requests Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 1f339fe7..c2aa1b6b 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -70,7 +70,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value: function (request) { if (request.url.indexOf('js/document/templates/montage-html') !== -1) { - console.log(request); + //console.log(request); //TODO: Figure out why active document is not available here -- cgit v1.2.3 From 1b1a51370feffc1abbd1ad558cbf4d5d8163ef6f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 22:23:28 -0800 Subject: cleanup Signed-off-by: Valerio Virgillito --- js/mediators/element-mediator.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 95aec2a3..8481f557 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -28,13 +28,7 @@ exports.ElementMediator = Montage.create(NJComponent, { // TODO use the specific controller to be able to subclass the functionality handleElementAdding: { value: function(event) { - /* - var cmd = ElementControllerCommands.addElementCommand(event.detail.el, event.detail.data); - NJevent("sendToUndo", cmd); - cmd.execute(); - */ this.addElement(event.detail.el, event.detail.data); - } }, @@ -97,8 +91,7 @@ exports.ElementMediator = Montage.create(NJComponent, { value: function(el, rules, noEvent) { ElementController.addElement(el, rules); var p3d = this.get3DProperties(el); - if(p3d) - { + if(p3d) { el.elementModel.controller["set3DProperties"](el, [p3d], 0, true); } if(!noEvent) NJevent("elementAdded", el); -- cgit v1.2.3 From 9e566515f7e3a4ae26b39a2581008a15cf662c95 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 22:35:28 -0800 Subject: formatting and removing un-used code from the stage Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 48 +++++++++++++------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 37b1df35..44e14827 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -19,8 +19,6 @@ exports.Stage = Montage.create(Component, { zoomFactor: {value : 1 }, _canvasSelectionPrefs: { value: { "thickness" : 1.0, "color" : "#46a1ff" } }, - _editSymbolPrefs: { value: { "thickness" : 2.0, "color" : "#C61F00" } }, - _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, @@ -260,7 +258,6 @@ exports.Stage = Montage.create(Component, { this.application.ninja.toolsData.selectedToolInstance._configure(true); this.addEventListener("change@appModel.show3dGrid", this, false); - } }, @@ -533,8 +530,7 @@ exports.Stage = Montage.create(Component, { drawUtils.updatePlanes(); //TODO Set this variable in the needs draw so that it does not have to be calculated again for each draw for selection change - if(this.application.ninja.selectedElements.length) - { + if(this.application.ninja.selectedElements.length) { // drawUtils.drawSelectionBounds handles the single selection case as well, // so we don't have to special-case the single selection case. // TODO drawUtils.drawSelectionBounds expects an array of elements. @@ -542,8 +538,7 @@ exports.Stage = Montage.create(Component, { // TODO to work on _element instead of re-creating a new Array here. var selArray = new Array(); - for(var i = 0; this.application.ninja.selectedElements[i];i++) - { + for(var i = 0; this.application.ninja.selectedElements[i];i++) { var curElement = this.application.ninja.selectedElements[i]._element; // Add element to array that is used to calculate 3d-bounding box of all elements @@ -576,7 +571,7 @@ exports.Stage = Montage.create(Component, { * @params: x, y, w, h */ draw3DSelectionRectangle: { - value:function(x0,y0, x1,y1, x2,y2, x3,y3){ + value:function(x0,y0, x1,y1, x2,y2, x3,y3) { // this.clearCanvas(); this.clearDrawingCanvas(); this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; @@ -621,7 +616,7 @@ exports.Stage = Montage.create(Component, { * Draws selection highlight and reg. point for a given element */ drawElementBoundingBox: { - value: function(elt, editMode) { + value: function(elt) { this.stageDeps.viewUtils.setViewportObj( elt ); var bounds3D = this.stageDeps.viewUtils.getElementViewBounds3D( elt ); @@ -632,18 +627,16 @@ exports.Stage = Montage.create(Component, { // } var zoomFactor = 1; - if (this._viewport.style && this._viewport.style.zoom) - { + if (this._viewport.style && this._viewport.style.zoom) { zoomFactor = Number(this._viewport.style.zoom); } + var tmpMat = this.stageDeps.viewUtils.getLocalToGlobalMatrix( elt ); - for (var j=0; j<4; j++) - { + for (var j=0; j<4; j++) { var localPt = bounds3D[j]; var tmpPt = this.stageDeps.viewUtils.localToGlobal2(localPt, tmpMat); - if(zoomFactor !== 1) - { + if(zoomFactor !== 1) { tmpPt = vecUtils.vecScale(3, tmpPt, zoomFactor); tmpPt[0] += this._scrollLeft*(zoomFactor - 1); @@ -653,13 +646,9 @@ exports.Stage = Montage.create(Component, { } // draw it - if(editMode) { - this.context.strokeStyle = this._editSymbolPrefs.color; - this.context.lineWidth = this._editSymbolPrefs.thickness; - } else { - this.context.strokeStyle = this._canvasSelectionPrefs.color; - this.context.lineWidth = this._canvasSelectionPrefs.thickness; - } + this.context.strokeStyle = this._canvasSelectionPrefs.color; + this.context.lineWidth = this._canvasSelectionPrefs.thickness; + this.context.beginPath(); @@ -673,13 +662,6 @@ exports.Stage = Montage.create(Component, { this.context.closePath(); this.context.stroke(); - - /** Bug #25 - Do Not Draw the Registration point anymore on the top left since it's assumed there. - this.context.beginPath(); - this.context.arc(bounds3D[0][0], bounds3D[0][1] , 5, 0, Math.PI*2, false); - this.context.stroke(); - */ - } }, @@ -691,10 +673,8 @@ exports.Stage = Montage.create(Component, { * * @params: x, y, w, h */ - draw3DProjectedAndUnprojectedRectangles: - { - value:function(unProjPts, projPts) - { + draw3DProjectedAndUnprojectedRectangles: { + value:function(unProjPts, projPts) { this.clearDrawingCanvas(); this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness; @@ -748,7 +728,7 @@ exports.Stage = Montage.create(Component, { * @params: x0, y0, x1, y1 */ drawLine: { - value:function(x0, y0, x1, y1, strokeSize, strokeColor){ + value:function(x0, y0, x1, y1, strokeSize, strokeColor) { this.clearDrawingCanvas(); this._drawingContext.strokeStyle = strokeColor; this._drawingContext.lineWidth = strokeSize; -- cgit v1.2.3 From f9d34a54baf61ccdf77732b1aaedb29d296b8c2e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 23:03:48 -0800 Subject: enabling nested selection Signed-off-by: Valerio Virgillito --- js/controllers/elements/element-controller.js | 3 +++ js/controllers/selection-controller.js | 37 ++++++++++++++++++++++----- js/ninja.reel/ninja.html | 10 +++++++- js/stage/layout.js | 29 +++++++++++++++++---- js/tools/SelectionTool.js | 23 +++++++++-------- 5 files changed, 80 insertions(+), 22 deletions(-) diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 65d26bdd..ac14def4 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -12,6 +12,9 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, addElement: { value: function(el, styles) { this.application.ninja.currentDocument.documentRoot.appendChild(el); + // Nested elements - + // TODO make sure the CSS is correct before nesting elements + // this.application.ninja.currentSelectedContainer.appendChild(el); this.application.ninja.stylesController.setElementStyles(el, styles); } }, diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 833e6f04..fed9affd 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -20,6 +20,27 @@ exports.SelectionController = Montage.create(Component, { } }, + /* + * Bound property to the ninja currentSelectedContainer + */ + _selectionContainer: { + value: null + }, + + selectionContainer: { + get: function() { + return this._selectionContainer + }, + set: function(value) { + if(this._selectionContainer && this._selectionContainer !== value) { + console.log("setting container in the selection tool"); + this.executeSelectElement(); + } + + this._selectionContainer = value; + } + }, + deserializedFromTemplate: { value: function() { this.eventManager.addEventListener("openDocument", this, false); @@ -53,7 +74,9 @@ exports.SelectionController = Montage.create(Component, { } } - this.dispatchEvent(selectionEvent.event); + // + this._selectionContainer = this.application.ninja.currentSelectedContainer; + } }, @@ -66,13 +89,10 @@ exports.SelectionController = Montage.create(Component, { handleElementDeleted: { value: function(event) { if(!this._isDocument) { - if(this.findSelectedElement(event.detail) !== -1) { this.executeSelectElement(); } - } - } }, @@ -130,12 +150,17 @@ exports.SelectionController = Montage.create(Component, { this.executeSelectElement(); // Else execute selection with no item } else { - if(item.parentNode.id == "UserContent") { +// if(item.parentNode.id === "UserContent") { + if(item.parentNode.uuid === this.selectionContainer.uuid) { this.executeSelectElement(item); } else { var outerElement = item.parentNode; - while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { + while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { + //while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { + // If element is higher up than current container then return + if(outerElement.id === "UserContent") return; + // else keep going up the chain outerElement = outerElement.parentNode; } diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index c9f17e3b..65cbfc28 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -228,7 +228,15 @@ "selectionController1": { "module": "js/controllers/selection-controller", - "name": "SelectionController" + "name": "SelectionController", + "bindings" : { + "selectionContainer": { + "boundObject": {"@": "owner"}, + "boundObjectPropertyPath": "currentSelectedContainer", + "oneway": true + } + } + }, "documentController1": { diff --git a/js/stage/layout.js b/js/stage/layout.js index 1a491210..56bb70bf 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -195,11 +195,30 @@ exports.Layout = Montage.create(Component, { bounds3D[j] = tmpPt; } - // Draw the Item ouline - this._dashedLine(bounds3D[3][0] - 0.5,bounds3D[3][1]- 0.5,bounds3D[0][0] + 2.5, bounds3D[0][1] - 0.5,[5,5]); - this._dashedLine(bounds3D[0][0] - 0.5, bounds3D[0][1] - 0.5, bounds3D[1][0]- 0.5, bounds3D[1][1] + 0.5, [5,5] ); - this._dashedLine(bounds3D[1][0] - 0.5 , bounds3D[1][1] + 0.5, bounds3D[2][0]+ 0.5, bounds3D[2][1] + 0.5, [5,5] ); - this._dashedLine(bounds3D[2][0] + 0.5, bounds3D[2][1] + 0.5, bounds3D[3][0] + 0.5, bounds3D[3][1] - 0.5, [5,5] ); + if(item.uuid === this.application.ninja.currentSelectedContainer.uuid) { + this.ctx.save(); + this.ctx.strokeStyle = "#C61F00"; + + this.ctx.beginPath(); + + this.ctx.moveTo( bounds3D[3][0] + 0.5 , bounds3D[3][1] - 0.5 ); + + this.ctx.lineTo( bounds3D[0][0] - 0.5 , bounds3D[0][1] - 0.5 ); + this.ctx.lineTo( bounds3D[1][0] - 0.5 , bounds3D[1][1] + 0.5 ); + this.ctx.lineTo( bounds3D[2][0] + 0.5 , bounds3D[2][1] + 0.5 ); + this.ctx.lineTo( bounds3D[3][0] + 0.5 , bounds3D[3][1] + 0.5 ); + + this.ctx.closePath(); + this.ctx.stroke(); + + this.ctx.restore(); + } else { + // Draw the Item ouline + this._dashedLine(bounds3D[3][0] - 0.5,bounds3D[3][1]- 0.5,bounds3D[0][0] + 2.5, bounds3D[0][1] - 0.5,[5,5]); + this._dashedLine(bounds3D[0][0] - 0.5, bounds3D[0][1] - 0.5, bounds3D[1][0]- 0.5, bounds3D[1][1] + 0.5, [5,5] ); + this._dashedLine(bounds3D[1][0] - 0.5 , bounds3D[1][1] + 0.5, bounds3D[2][0]+ 0.5, bounds3D[2][1] + 0.5, [5,5] ); + this._dashedLine(bounds3D[2][0] + 0.5, bounds3D[2][1] + 0.5, bounds3D[3][0] + 0.5, bounds3D[3][1] - 0.5, [5,5] ); + } // Draw the Label is all mode if(this.layoutView === "layoutAll") { diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index f76a6d85..37029e8c 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js @@ -183,18 +183,21 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { } }, + /** + * Double click handler + * + * Sets the currentSelectionContainer to the current selected element. If no elements are selected set the + * currentSelectionContainer to the userDocument div. + */ HandleDoubleClick: { - value: function(event) { - - // Temporary Code for Breadcrumb - if(this.application.ninja.selectedElements.length > 0) { - this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0]._element; - } else { - this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; - } - + value: function(event) { + if(this.application.ninja.selectedElements.length > 0) { + this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0]._element; + } else { + this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; } - }, + } + }, HandleKeyPress: { value: function(event){ -- cgit v1.2.3