diff options
author | hwc487 | 2012-04-05 17:09:51 -0700 |
---|---|---|
committer | hwc487 | 2012-04-05 17:09:51 -0700 |
commit | 2d21b01d6dd64af643f5f38818b57fcace05ea0b (patch) | |
tree | 44fac83294dae2efad48389ddb44cb1dbe06caad | |
parent | 7656b6eac7aec59697c6cddbe2a507fe9e4aa187 (diff) | |
parent | 96bfeee2e6b735b87e8482d6e2cf24d5224c6417 (diff) | |
download | ninja-2d21b01d6dd64af643f5f38818b57fcace05ea0b.tar.gz |
Merge branch 'Snapping' of github.com:ericmueller/ninja-internal into Snapping_II
-rwxr-xr-x | js/helper-classes/3D/hit-record.js | 46 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 1 | ||||
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 45 | ||||
-rwxr-xr-x | js/panels/Splitter.js | 2 | ||||
-rw-r--r-- | js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css | 4 | ||||
-rw-r--r-- | js/panels/presets/animations-presets.reel/animations-presets.js | 47 | ||||
-rw-r--r-- | js/panels/presets/default-animation-presets.js | 2 | ||||
-rw-r--r-- | js/panels/presets/default-style-presets.js | 11 | ||||
-rw-r--r-- | js/panels/presets/default-transition-presets.js | 8 | ||||
-rw-r--r-- | js/panels/presets/style-presets.reel/style-presets.js | 49 | ||||
-rw-r--r-- | js/panels/presets/transitions-presets.reel/transitions-presets.js | 20 | ||||
-rw-r--r-- | js/panels/resize-composer.js | 34 | ||||
-rwxr-xr-x | js/tools/Translate3DToolBase.js | 178 | ||||
-rwxr-xr-x | js/tools/TranslateObject3DTool.js | 22 | ||||
-rwxr-xr-x | js/tools/modifier-tool-base.js | 29 |
15 files changed, 341 insertions, 157 deletions
diff --git a/js/helper-classes/3D/hit-record.js b/js/helper-classes/3D/hit-record.js index 2c60adc6..96f87c24 100755 --- a/js/helper-classes/3D/hit-record.js +++ b/js/helper-classes/3D/hit-record.js | |||
@@ -284,6 +284,50 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype, | |||
284 | 284 | ||
285 | return str; | 285 | return str; |
286 | } | 286 | } |
287 | } | 287 | }, |
288 | |||
289 | test: | ||
290 | { | ||
291 | value: function() | ||
292 | { | ||
293 | var elt = this.getElement(); | ||
294 | var stage = viewUtils.getStage(); | ||
295 | if (elt === stage) return; | ||
296 | |||
297 | var localPt = this.calculateElementPreTransformScreenPoint(); | ||
298 | var stageWorldPt = this.calculateStageWorldPoint(); | ||
299 | var globalPt = this.getScreenPoint(); | ||
300 | var err = false; | ||
301 | |||
302 | var test1 = viewUtils.localToGlobal( localPt, elt ); | ||
303 | var dist = vecUtils.vecDist(3, test1, globalPt); | ||
304 | if (MathUtils.fpSign(dist) != 0) | ||
305 | { | ||
306 | err = true; | ||
307 | console.log( "**** transform error 1 ***** " + dist + ", localPt: " + localPt ); | ||
308 | } | ||
309 | |||
310 | var stageWorldToGlobal = viewUtils.getStageWorldToGlobalMatrix(); | ||
311 | var test2 = MathUtils.transformAndDivideHomogeneousPoint( stageWorldPt, stageWorldToGlobal ); | ||
312 | dist = vecUtils.vecDist(3, test2, globalPt); | ||
313 | if (MathUtils.fpSign(dist) != 0) | ||
314 | { | ||
315 | err = true; | ||
316 | console.log( "**** transform error 2 ***** " + dist + ", localPt: " + localPt ); | ||
317 | } | ||
318 | |||
319 | var localToGlobal = viewUtils.getLocalToGlobalMatrix( elt ); | ||
320 | var globalToLocal = glmat4.inverse( localToGlobal, [] ); | ||
321 | var test3 = MathUtils.transformAndDivideHomogeneousPoint( globalPt, globalToLocal ); | ||
322 | dist = vecUtils.vecDist(3, test3, localPt); | ||
323 | if (MathUtils.fpSign( vecUtils.vecDist(3, test3, localPt)) != 0) | ||
324 | { | ||
325 | err = true; | ||
326 | console.log( "**** transform error 3 ***** " + dist + ", localPt: " + localPt ); | ||
327 | } | ||
328 | |||
329 | if (!err) console.log( "no hitRecord error" ); | ||
330 | } | ||
331 | } | ||
288 | }); | 332 | }); |
289 | 333 | ||
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 9f6b9ed1..8eafa7e9 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -300,6 +300,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
300 | this.deactivateDragPlane(); | 300 | this.deactivateDragPlane(); |
301 | 301 | ||
302 | this.setLastHit( rtnHit ); | 302 | this.setLastHit( rtnHit ); |
303 | //rtnHit.test(); // DEBUG CODE. REMOVE THIS | ||
303 | return rtnHit; | 304 | return rtnHit; |
304 | } | 305 | } |
305 | }, | 306 | }, |
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index a72b7906..392de0be 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -112,6 +112,13 @@ exports.ViewUtils = Montage.create(Component, { | |||
112 | var mat = this.getMatrixFromElement(elt); | 112 | var mat = this.getMatrixFromElement(elt); |
113 | var plane = [mat[8], mat[9], mat[10], mat[11]]; | 113 | var plane = [mat[8], mat[9], mat[10], mat[11]]; |
114 | 114 | ||
115 | var stage = this.application.ninja.currentDocument.documentRoot; | ||
116 | if (elt === stage) | ||
117 | { | ||
118 | xVec = [1,0,0]; | ||
119 | yVec = [0,1,0]; | ||
120 | } | ||
121 | |||
115 | // The translation value is a point on the plane | 122 | // The translation value is a point on the plane |
116 | this.pushViewportObj( elt ); | 123 | this.pushViewportObj( elt ); |
117 | var ptOnPlane = this.getCenterOfProjection(); | 124 | var ptOnPlane = this.getCenterOfProjection(); |
@@ -137,6 +144,12 @@ exports.ViewUtils = Montage.create(Component, { | |||
137 | var stageMat = this.getMatrixFromElement(stage); | 144 | var stageMat = this.getMatrixFromElement(stage); |
138 | var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; | 145 | var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; |
139 | 146 | ||
147 | if (elt === stage) | ||
148 | { | ||
149 | xVec = [1,0,0]; | ||
150 | yVec = [0,1,0]; | ||
151 | } | ||
152 | |||
140 | var xDot = Math.abs(vecUtils.vecDot(3, xVec, stagePlane)); | 153 | var xDot = Math.abs(vecUtils.vecDot(3, xVec, stagePlane)); |
141 | var yDot = Math.abs(vecUtils.vecDot(3, yVec, stagePlane)); | 154 | var yDot = Math.abs(vecUtils.vecDot(3, yVec, stagePlane)); |
142 | 155 | ||
@@ -788,35 +801,23 @@ exports.ViewUtils = Montage.create(Component, { | |||
788 | } | 801 | } |
789 | }, | 802 | }, |
790 | 803 | ||
791 | getStageWorldToGlobalMatrix: { | 804 | getStageWorldToGlobalMatrix: |
792 | value: function() { | 805 | { |
806 | value: function() | ||
807 | { | ||
793 | var stage = this.application.ninja.currentDocument.documentRoot; | 808 | var stage = this.application.ninja.currentDocument.documentRoot; |
794 | this.pushViewportObj( stage ); | 809 | this.pushViewportObj( stage ); |
795 | 810 | ||
796 | // get the matrix to the parent | 811 | // put the point into screen space of the stage - requires |
797 | var mat = Matrix.I(4); | 812 | // a translation to the top/left only |
798 | //var projMat = Matrix.I(4).multiply( this.getPerspectiveDistFromElement(stage) ); | ||
799 | var p = this.getPerspectiveDistFromElement(stage); | ||
800 | var projMat = glmat4.scale( Matrix.I(4), [p,p,p], [] ); | ||
801 | projMat[11] = -1; | ||
802 | var cop = this.getCenterOfProjection(); | 813 | var cop = this.getCenterOfProjection(); |
803 | var v2s = Matrix.Translation([cop[0], cop[1], 0]); | 814 | var v2s = Matrix.Translation([cop[0], cop[1], 0]); |
804 | 815 | ||
805 | //mat = v2s.multiply( projMat ); | ||
806 | mat = glmat4.multiply( v2s, projMat, [] ); | ||
807 | |||
808 | // offset to the parent | ||
809 | var offset = this.getElementOffset( stage ); | ||
810 | var offMat = Matrix.Translation([offset[0], offset[1], 0]); | ||
811 | //mat = offMat.multiply( mat ); | ||
812 | glmat4.multiply( offMat, mat, mat ); | ||
813 | |||
814 | this.popViewportObj(); | 816 | this.popViewportObj(); |
815 | 817 | ||
816 | // var mat2 = this.getLocalToGlobalMatrix( stage.parentElement ); | 818 | // append the localToGlobal matrix of the stage. |
817 | var mat2 = this.getLocalToGlobalMatrix( this._rootElement ); | 819 | var mat = this.getLocalToGlobalMatrix( stage ); |
818 | //var mat = mat2.multiply( mat ); | 820 | glmat4.multiply( mat, v2s ); |
819 | glmat4.multiply( mat2, mat, mat ); | ||
820 | 821 | ||
821 | return mat; | 822 | return mat; |
822 | } | 823 | } |
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index ac45b4ba..98ebb36a 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js | |||
@@ -55,7 +55,7 @@ exports.Splitter = Montage.create(Component, { | |||
55 | }, | 55 | }, |
56 | set: function(value) { | 56 | set: function(value) { |
57 | this._collapsed = value; | 57 | this._collapsed = value; |
58 | this.needsDraw = true; | 58 | |
59 | this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); | 59 | this.application.localStorage.setItem(this.element.getAttribute("data-montage-id"), {"version": this.version, "value": value}); |
60 | } | 60 | } |
61 | }, | 61 | }, |
diff --git a/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css b/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css index 067285ae..129b9771 100644 --- a/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css +++ b/js/panels/Timeline/TimelinePanel.reel/css/TimelinePanel.css | |||
@@ -10,12 +10,12 @@ | |||
10 | height: 100%; | 10 | height: 100%; |
11 | } | 11 | } |
12 | .maintimeline{ | 12 | .maintimeline{ |
13 | border-style: double; | ||
13 | -webkit-box-flex: 1; | 14 | -webkit-box-flex: 1; |
14 | display: -webkit-box; | 15 | display: -webkit-box; |
15 | -webkit-box-orient: horizontal; | 16 | -webkit-box-orient: horizontal |
16 | height : 100%; | 17 | height : 100%; |
17 | position: relative; | 18 | position: relative; |
18 | margin-top:1px; | ||
19 | } | 19 | } |
20 | .leftinside{ | 20 | .leftinside{ |
21 | height: 100%; | 21 | height: 100%; |
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.js b/js/panels/presets/animations-presets.reel/animations-presets.js index 92437cfd..272f6c5b 100644 --- a/js/panels/presets/animations-presets.reel/animations-presets.js +++ b/js/panels/presets/animations-presets.reel/animations-presets.js | |||
@@ -22,7 +22,52 @@ exports.AnimationsLibrary = Montage.create(Component, { | |||
22 | }, | 22 | }, |
23 | handleNodeActivation: { | 23 | handleNodeActivation: { |
24 | value: function(presetData) { | 24 | value: function(presetData) { |
25 | this.application.ninja.presetsController.applyPreset(presetData); | 25 | //debugger; |
26 | var selection = this.application.ninja.selectedElements, | ||
27 | stylesController = this.application.ninja.stylesController, | ||
28 |