aboutsummaryrefslogtreecommitdiff
path: root/js/tools/SelectionTool.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-09 13:23:07 -0800
committerNivesh Rajbhandari2012-02-09 13:23:07 -0800
commit148e6f7c00e54b0ec6fa6bb6791f0ac0920af511 (patch)
tree889719cf024d73e2e1e93d73a40f96a2a8d27dc6 /js/tools/SelectionTool.js
parenta9a02ef8a206082ea9ea0cb66f3fb70e1f4256df (diff)
parent666ae3e9119410cbf7fa974274d95336aaff091c (diff)
downloadninja-148e6f7c00e54b0ec6fa6bb6791f0ac0920af511.tar.gz
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Conflicts: js/helper-classes/RDGE/GLMaterial.js js/helper-classes/RDGE/GLRectangle.js js/helper-classes/RDGE/GLWorld.js js/helper-classes/RDGE/Materials/FlatMaterial.js js/helper-classes/RDGE/Materials/IridescentScalesMaterial.js js/helper-classes/RDGE/Materials/JuliaMaterial.js js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js js/helper-classes/RDGE/Materials/MandelMaterial.js js/helper-classes/RDGE/Materials/PlasmaMaterial.js js/helper-classes/RDGE/Materials/PulseMaterial.js js/helper-classes/RDGE/Materials/RadialBlurMaterial.js js/helper-classes/RDGE/Materials/RadialGradientMaterial.js js/helper-classes/RDGE/Materials/TunnelMaterial.js js/helper-classes/RDGE/Materials/TwistMaterial.js js/helper-classes/RDGE/rdge-compiled.js js/helper-classes/RDGE/src/core/script/renderer.js js/panels/Materials/Materials.xml Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/tools/SelectionTool.js')
-rw-r--r--js/tools/SelectionTool.js40
1 files changed, 33 insertions, 7 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index 862b2e88..48548271 100644
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -135,18 +135,16 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
135 var box = []; 135 var box = [];
136 selectedItems = []; 136 selectedItems = [];
137 137
138 box[0] = this.downPoint.x - this.application.ninja.stage.documentOffsetLeft + this.application.ninja.stage.scrollLeft; 138 box[0] = this.downPoint.x;
139 box[1] = this.downPoint.y - this.application.ninja.stage.documentOffsetTop + this.application.ninja.stage.scrollTop; 139 box[1] = this.downPoint.y;
140 box[2] = box[0] + (point.x - this.downPoint.x); 140 box[2] = point.x;
141 box[3] = box[1] + (point.y - this.downPoint.y); 141 box[3] = point.y;
142 box = this.absoluteRectangle(box[0], box[1],box[2],box[3]);
143
144 142
145 //selectionManagerModule.selectionManager.marqueeSelection(box); 143 //selectionManagerModule.selectionManager.marqueeSelection(box);
146 var childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; 144 var childNodes = this.application.ninja.currentDocument.documentRoot.childNodes;
147 childNodes = Array.prototype.slice.call(childNodes, 0); 145 childNodes = Array.prototype.slice.call(childNodes, 0);
148 childNodes.forEach(function(item) { 146 childNodes.forEach(function(item) {
149 if(item.nodeType == 1 && SelectionTool._simpleCollisionDetection(item, box)) { 147 if(item.nodeType == 1 && SelectionTool._complicatedCollisionDetection(item, box)) {
150 selectedItems.push(item); 148 selectedItems.push(item);
151 } 149 }
152 }); 150 });
@@ -803,6 +801,34 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
803 }, 801 },
804 802
805 // TODO : Use the new element mediator to get element offsets 803 // TODO : Use the new element mediator to get element offsets
804 _complicatedCollisionDetection:
805 {
806 value: function(elt, box)
807 {
808 var left, top, width, height;
809
810 left = box[0];
811 width = box[2] - left;
812 if (width < 0)
813 {
814 left = box[2];
815 width = -width;
816 }
817 top = box[1];
818 height = box[3] - top;
819 if (height < 0)
820 {
821 top = box[3];
822 height = -height;
823 }
824
825 var rtnVal = MathUtils.rectsOverlap( [left,top], width, height, elt );
826
827 return rtnVal;
828 }
829 },
830
831 // TODO : Use the new element mediator to get element offsets
806 _simpleCollisionDetection: { 832 _simpleCollisionDetection: {
807 value: function(ele, box){ 833 value: function(ele, box){
808 var left1, left2, right1, right2, top1, top2, bottom1, bottom2; 834 var left1, left2, right1, right2, top1, top2, bottom1, bottom2;