diff options
author | Armen Kesablyan | 2012-06-11 11:17:41 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-11 11:17:41 -0700 |
commit | 278769df00ced8620fd73371e38fe2e43f07ca3b (patch) | |
tree | deb505c8a66b660eee1f17a2c6c4c575c7939f6f /js/helper-classes/3D/snap-manager.js | |
parent | 555fd6efa605b937800b3979a4c68fa7eb8666ae (diff) | |
parent | 0f040acabfb7a4bf3138debec5aff869487ceb11 (diff) | |
download | ninja-278769df00ced8620fd73371e38fe2e43f07ca3b.tar.gz |
Merge branch 'refs/heads/master' into binding
Conflicts:
js/document/models/html.js
js/document/views/design.js
js/ninja.reel/ninja.js
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/helper-classes/3D/snap-manager.js')
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 069c6022..a8b6e739 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -21,8 +21,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
21 | /////////////////////////////////////////////////////////////////////// | 21 | /////////////////////////////////////////////////////////////////////// |
22 | // Instance variables | 22 | // Instance variables |
23 | /////////////////////////////////////////////////////////////////////// | 23 | /////////////////////////////////////////////////////////////////////// |
24 | drawingCanvas: { value: null, writable: true}, | 24 | |
25 | 25 | currentStage: { value: null }, | |
26 | |||
26 | // we keep a stack of working planes to facilitate working on other planes temporarily | 27 | // we keep a stack of working planes to facilitate working on other planes temporarily |
27 | _workingPlaneStack : { value: [], writable: true }, | 28 | _workingPlaneStack : { value: [], writable: true }, |
28 | 29 | ||
@@ -83,14 +84,14 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
83 | popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }}, | 84 | popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }}, |
84 | 85 | ||
85 | getStageWidth : { value: function () { | 86 | getStageWidth : { value: function () { |
86 | return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetWidth); | 87 | return parseInt(this.currentStage.offsetWidth); |
87 | }}, | 88 | }}, |
88 | 89 | ||
89 | getStageHeight : { value: function () { | 90 | getStageHeight : { value: function () { |
90 | return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetHeight); | 91 | return parseInt(this.currentStage.offsetHeight); |
91 | }}, | 92 | }}, |
92 | 93 | ||
93 | getStage : { value: function() { return this.application.ninja.currentDocument.model.documentRoot; }}, | 94 | getStage : { value: function() { return this.currentStage; }}, |
94 | 95 | ||
95 | getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }}, | 96 | getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }}, |
96 | getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }}, | 97 | getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }}, |
@@ -480,10 +481,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
480 | { | 481 | { |
481 | var snapRec = this._elementCache[i]; | 482 | var snapRec = this._elementCache[i]; |
482 | var elt = snapRec.getElement(); | 483 | var elt = snapRec.getElement(); |
483 | if (elt.elementModel) | 484 | elt.elementModel.isIn2DSnapCache = false; |
484 | elt.elementModel.isIn2DSnapCache = false; | 485 | |
485 | else | ||
486 | console.log( "element in the 2D cache does not have an elementModel" ); | ||
487 | } | 486 | } |
488 | 487 | ||
489 | this._elementCache = null; | 488 | this._elementCache = null; |
@@ -540,10 +539,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
540 | snapRec.init( elt ); | 539 | snapRec.init( elt ); |
541 | this._elementCache.push( snapRec ); | 540 | this._elementCache.push( snapRec ); |
542 | 541 | ||
543 | if (!elt.elementModel) | ||
544 | { | ||
545 | NJUtils.makeModelFromElement(elt); | ||
546 | } | ||
547 | elt.elementModel.isIn2DSnapCache = true; | 542 | elt.elementModel.isIn2DSnapCache = true; |
548 | } | 543 | } |
549 | else if (elt.elementModel) | 544 | else if (elt.elementModel) |
@@ -612,10 +607,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
612 | snapRec.init( elt ); | 607 | snapRec.init( elt ); |
613 | this._elementCache.push( snapRec ); | 608 | this._elementCache.push( snapRec ); |
614 | 609 | ||
615 | if (!elt.elementModel) | ||
616 | { | ||
617 | NJUtils.makeModelFromElement(elt); | ||
618 | } | ||
619 | elt.elementModel.isIn2DSnapCache = true; | 610 | elt.elementModel.isIn2DSnapCache = true; |
620 | } | 611 | } |
621 | else if (elt.elementModel) | 612 | else if (elt.elementModel) |
@@ -2124,7 +2115,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
2124 | if (hitRec) | 2115 | if (hitRec) |
2125 | { | 2116 | { |
2126 | var saveContext = drawUtils.getDrawingSurfaceElement(); | 2117 | var saveContext = drawUtils.getDrawingSurfaceElement(); |
2127 | drawUtils.setDrawingSurfaceElement(this.drawingCanvas); | 2118 | drawUtils.setDrawingSurfaceElement(this.application.ninja.stage.drawingCanvas); |
2128 | var context = drawUtils.getDrawingContext(); | 2119 | var context = drawUtils.getDrawingContext(); |
2129 | if (context) | 2120 | if (context) |
2130 | { | 2121 | { |