aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/helper-classes/3D/math-utils.js33
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js32
-rw-r--r--js/panels/presets/style-presets.reel/style-presets.js4
-rw-r--r--js/panels/presets/transitions-presets.reel/transitions-presets.html1
-rwxr-xr-xjs/tools/LineTool.js9
-rwxr-xr-xjs/tools/OvalTool.js20
-rwxr-xr-xjs/tools/RectTool.js19
-rwxr-xr-xjs/tools/SelectionTool.js282
-rwxr-xr-xjs/tools/TranslateObject3DTool.js7
-rwxr-xr-xjs/tools/modifier-tool-base.js7
10 files changed, 330 insertions, 84 deletions
diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js
index 37044763..de63f880 100755
--- a/js/helper-classes/3D/math-utils.js
+++ b/js/helper-classes/3D/math-utils.js
@@ -538,6 +538,39 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
538 } 538 }
539 }, 539 },
540 540
541 isIdentityMatrix: {
542 value: function( mat )
543 {
544 if(!mat)
545 {
546 return false;
547 }
548 else
549 {
550 if(mat[0] !== 1) return false;
551 if(mat[1] !== 0) return false;
552 if(mat[2] !== 0) return false;
553 if(mat[3] !== 0) return false;
554
555 if(mat[4] !== 0) return false;
556 if(mat[5] !== 1) return false;
557 if(mat[6] !== 0) return false;
558 if(mat[7] !== 0) return false;
559
560 if(mat[8] !== 0) return false;
561 if(mat[9] !== 0) return false;
562 if(mat[10] !== 1) return false;
563 if(mat[11] !== 0) return false;
564
565 if(mat[12] !== 0) return false;
566 if(mat[13] !== 0) return false;
567 if(mat[14] !== 0) return false;
568 if(mat[15] !== 1) return false;
569 }
570 return true;
571 }
572 },
573
541 rectsOverlap: 574 rectsOverlap:
542 { 575 {
543 value: function( pt, width, height, elt ) 576 value: function( pt, width, height, elt )
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 372be345..596ba56a 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -40,6 +40,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
40 40
41 // keep a reference to the most recent hitRecord. Used for drawing feedback on the stage 41 // keep a reference to the most recent hitRecord. Used for drawing feedback on the stage
42 _lastHit : { value: null, writable: true }, 42 _lastHit : { value: null, writable: true },
43 _hitRecords : { value: [], writable: true },
43 44
44 // keep a list of objects to avoid snapping to 45 // keep a list of objects to avoid snapping to
45 _avoidList : { value: [], writable: true }, 46 _avoidList : { value: [], writable: true },
@@ -274,6 +275,11 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
274 } //if (hitRecArray.length == 0) 275 } //if (hitRecArray.length == 0)
275 276
276 var rtnHit; 277 var rtnHit;
278
279 // Save reference to hit records to verify last hit record's element matches browser's elementFromPoint
280 this._hitRecords.length = 0;
281 this._hitRecords = hitRecArray;
282
277 if (hitRecArray.length > 0) 283 if (hitRecArray.length > 0)
278 { 284 {
279 this.sortHitRecords( hitRecArray ); 285 this.sortHitRecords( hitRecArray );
@@ -2246,6 +2252,30 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
2246 drawUtils.setDrawingSurfaceElement(saveContext); 2252 drawUtils.setDrawingSurfaceElement(saveContext);
2247 } 2253 }
2248 } 2254 }
2249 } 2255 },
2256
2257 findHitRecordForElement: {
2258 value: function(elt) {
2259 var rtnHit;
2260
2261 if (!this._hitRecords) return;
2262 var nHits = this._hitRecords.length;
2263
2264 for (var i=0; i<nHits; i++)
2265 {
2266 var hi = this._hitRecords[i];
2267 if(hi.getElement() === elt)
2268 {
2269 rtnHit = hi;
2270 break;
2271 }
2272 }
2273 // catch-all to turn off drag plane snapping
2274 this.deactivateDragPlane();
2275
2276 this.setLastHit( rtnHit );
2277 return rtnHit;
2278 }
2279 }
2250 2280
2251}); 2281});
diff --git a/js/panels/presets/style-presets.reel/style-presets.js b/js/panels/presets/style-presets.reel/style-presets.js
index 7871683e..11f41822 100644
--- a/js/panels/presets/style-presets.reel/style-presets.js
+++ b/js/panels/presets/style-presets.reel/style-presets.js
@@ -47,9 +47,11 @@ exports.StylesLibrary = Montage.create(Component, {
47 selection.forEach(function(el) { 47 selection.forEach(function(el) {
48 el._element.style.webkitTransition = "all 450ms linear"; 48 el._element.style.webkitTransition = "all 450ms linear";
49 49
50 el._element.addEventListener("webkitTransitionEnd", function(e) { 50 el._element.addEventListener("webkitTransitionEnd", function presetTransition(e) {
51 el._element.style.webkitTransition = ''; 51 el._element.style.webkitTransition = '';
52 setStopRuleSelector("*"); 52 setStopRuleSelector("*");
53 this.removeEventListener("webkitTransitionEnd", presetTransition, true);
54
53 }, true); 55 }, true);
54 setStopRuleSelector("transitionStopRule"); 56 setStopRuleSelector("transitionStopRule");
55 el._element.classList.add(selectorBase); 57 el._element.classList.add(selectorBase);
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.html b/js/panels/presets/transitions-presets.reel/transitions-presets.html
index c22ed351..5dc28edf 100644
--- a/js/panels/presets/transitions-presets.reel/transitions-presets.html
+++ b/js/panels/presets/transitions-presets.reel/transitions-presets.html
@@ -40,6 +40,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
40 "element" : {"#": "libraryContainer"}, 40 "element" : {"#": "libraryContainer"},
41 "branchComponent" : {"@": "branch" }, 41 "branchComponent" : {"@": "branch" },
42 "contentController": {"@": "presetsController"}, 42 "contentController": {"@": "presetsController"},
43 "activationEvent" : "dblclick",
43 "showRoot": false 44 "showRoot": false
44 } 45 }
45 }, 46 },
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 0a7c0534..32572af1 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -206,10 +206,13 @@ exports.LineTool = Montage.create(ShapeTool, {
206 // for default stroke and fill/no materials 206 // for default stroke and fill/no materials
207 var strokeMaterial = null; 207 var strokeMaterial = null;
208 208
209 var strokeM = this.options.strokeMaterial; 209 if(this.options.use3D)
210 if(strokeM)
211 { 210 {
212 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); 211 var strokeM = this.options.strokeMaterial;
212 if(strokeM)
213 {
214 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM));
215 }
213 } 216 }
214 217
215 var world = this.getGLWorld(canvas, this.options.use3D); 218 var world = this.getGLWorld(canvas, this.options.use3D);
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 14655312..911059a7 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -43,19 +43,21 @@ exports.OvalTool = Montage.create(ShapeTool, {
43 var strokeMaterial = null; 43 var strokeMaterial = null;
44 var fillMaterial = null; 44 var fillMaterial = null;
45 45
46 var strokeM = this.options.strokeMaterial; 46 if(this.options.use3D)
47 if(strokeM)
48 { 47 {
49 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); 48 var strokeM = this.options.strokeMaterial;
50 } 49 if(strokeM)
50 {
51 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM));
52 }
51 53
52 var fillM = this.options.fillMaterial; 54 var fillM = this.options.fillMaterial;
53 if(fillM) 55 if(fillM)
54 { 56 {
55 fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); 57 fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM));
58 }
56 } 59 }
57 60
58
59 var world = this.getGLWorld(canvas, this.options.use3D); 61 var world = this.getGLWorld(canvas, this.options.use3D);
60 62
61 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 63 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 31ac7faa..5e148de3 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -62,16 +62,19 @@ exports.RectTool = Montage.create(ShapeTool, {
62 var strokeMaterial = null; 62 var strokeMaterial = null;
63 var fillMaterial = null; 63 var fillMaterial = null;
64 64
65 var strokeM = this.options.strokeMaterial; 65 if(this.options.use3D)
66 if(strokeM)
67 { 66 {
68 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); 67 var strokeM = this.options.strokeMaterial;
69 } 68 if(strokeM)
69 {
70 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM));
71 }
70 72
71 var fillM = this.options.fillMaterial; 73 var fillM = this.options.fillMaterial;
72 if(fillM) 74 if(fillM)
73 { 75 {
74