diff options
author | Nivesh Rajbhandari | 2012-07-19 10:55:22 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-07-19 10:55:22 -0700 |
commit | fc13ef1e806116bb7ece5bb06604fa4f5714a6ed (patch) | |
tree | 8e8d87b31fffb7163aff0634ba4128f08be66343 /js/stage/stage.reel/stage.js | |
parent | 16d06bac95ce8334f8c5586750e98360dbc9cbd9 (diff) | |
download | ninja-fc13ef1e806116bb7ece5bb06604fa4f5714a6ed.tar.gz |
Squashed commit of the following:
commit 0285afe3d4bd458a51f11241f13ea6ffdb0283ed
Merge: 2f9f5e3 16d06ba
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Thu Jul 19 10:54:25 2012 -0700
Merge branch 'refs/heads/ninja-mqg734-master' into StageToolDrawingOptimizations
commit 2f9f5e369eb96f6c81b5e4bcbe09b418825e2864
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Wed Jul 18 17:15:19 2012 -0700
Fixed selection bounds not drawing in nested tags.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit b0a3507f9d27579ad511c69314a09136d7f7c6a0
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Wed Jul 18 11:07:44 2012 -0700
Layout info needs to redraw if stage is updated.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 63c5e0bf52c33706ba597cb69f7794e287bd0f06
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Tue Jul 17 15:40:54 2012 -0700
Per feedback from QE, we are still going to draw tool feedback on each mouse move so the selection bounds are not out of sync with the elements.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 0599a742092b985c4002977e501e3b457173f1d9
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Tue Jul 17 15:28:25 2012 -0700
Fixed grid not drawing correctly when switching documents and when adding/removing elements.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit fd9410606ee6358910d65b2cb5f71812fd44a7c4
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Tue Jul 17 11:36:09 2012 -0700
Updated drawing feedback to handle matrix 2d values entered via CSS Panel.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 559c16c7ac8c9f40b94a011a6f932d4f97df66a7
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Mon Jul 16 17:14:28 2012 -0700
IKNinja-751 - Selection boundary doesn't follow the transform applied in the CSS Panel.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit e2da5340159db5cd6f75bf6c9b7eb9cbf959e5cd
Merge: 7cc5de3 5146f22
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Mon Jul 16 15:36:28 2012 -0700
Merge branch 'refs/heads/ninja-mqg734-master' into StageToolDrawingOptimizations
commit 7cc5de39e41b4220f53c91b15b0cf0ed53e0b0f6
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Mon Jul 16 14:52:06 2012 -0700
Check if ownerDocument.defaultValue is null.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 5ae97995a28a4b06fb7f8703eb8090ea16d88acd
Merge: d17974d 0ede302
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Mon Jul 16 09:27:22 2012 -0700
Merge branch 'refs/heads/ninja-mqg734-master' into StageToolDrawingOptimizations
commit d17974d77273bb635311cb6466f4427cf4d9e5d4
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Mon Jul 16 08:45:05 2012 -0700
Pass in selectedElements array directly to drawUtils when drawing selection bounds instead of creating a duplicate array.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 0b1ea3144cb3e2c1d272f60da32423d0604ace3b
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Fri Jul 13 14:03:40 2012 -0700
Fixed line tool not drawing the width and height info.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit b9c70e8d9ae324aa21fa5490edc71d8503bcefbc
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Fri Jul 13 12:42:25 2012 -0700
Used cached offsetWidth and offsetHeight.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 9e17ac7124745ba745014efe149b31dee4fe658f
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Thu Jul 12 16:25:41 2012 -0700
Converting tabs to spaces … again!
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 351726c951bb73c28f0e15ea1ab32e85cc735688
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Thu Jul 12 16:14:31 2012 -0700
Tabs should be 4 spaces.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 250c419aa2dbcb10f012817ee7039aca77cb2518
Merge: 3f8d61a 2880e1d
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Thu Jul 12 16:08:31 2012 -0700
Merge branch 'refs/heads/ninja-mqg734-master' into StageToolDrawingOptimizations
commit 3f8d61a676da3992947ed9a2ed0e449780fcfbe0
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Thu Jul 12 15:53:44 2012 -0700
Rotate tool was not working immediately after switching selection and selection bounds were not drawing after resizing canvases.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit e2e1f81e3b6917e1032e1b99b79c266937f3bb25
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Thu Jul 12 12:15:59 2012 -0700
Single draw cycle for stage updates and tool drawings.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 95a90b4c95ee3163c97bea317144366674e49ade
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Mon Jun 18 11:46:38 2012 -0700
Single draw cycle for the stage and layout.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 21966b1515d80d2161a14e5a19bc66f3f49a92ce
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Fri Jun 15 13:33:14 2012 -0700
Cache element offsets, including offsetParent.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
commit 80c563c8ba06149691c6c1e754dd9a5e43bc7d4b
Author: Nivesh Rajbhandari <mqg734@motorola.com>
Date: Mon Jul 9 17:30:00 2012 -0700
Open materials editor popup next to PI button.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/stage/stage.reel/stage.js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 288 |
1 files changed, 143 insertions, 145 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 7c587989..7ac64976 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -29,10 +29,10 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
29 | POSSIBILITY OF SUCH DAMAGE. | 29 | POSSIBILITY OF SUCH DAMAGE. |
30 | </copyright> */ | 30 | </copyright> */ |
31 | 31 | ||
32 | var Montage = require("montage/core/core").Montage, | 32 | var Montage = require("montage/core/core").Montage, |
33 | Component = require("montage/ui/component").Component, | 33 | Component = require("montage/ui/component").Component, |
34 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, | 34 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, |
35 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | 35 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; |
36 | 36 | ||
37 | exports.Stage = Montage.create(Component, { | 37 | exports.Stage = Montage.create(Component, { |
38 | 38 | ||
@@ -46,8 +46,20 @@ exports.Stage = Montage.create(Component, { | |||
46 | drawNow: { value : false }, | 46 | drawNow: { value : false }, |
47 | switchedFromCodeDoc: { value : false }, | 47 | switchedFromCodeDoc: { value : false }, |
48 | 48 | ||
49 | drawLayout: { value : false }, | ||
50 | updatePlanes: { value : false }, | ||
51 | draw3DInfo: { value : false }, | ||
52 | |||
49 | // TO REVIEW | 53 | // TO REVIEW |
50 | zoomFactor: {value : 1 }, | 54 | zoomFactor: { |
55 | get: function() { | ||
56 | if (this._viewport && this._viewport.style && this._viewport.style.zoom) { | ||
57 | return Number(this._viewport.style.zoom); | ||
58 | } else { | ||
59 | return 1; | ||
60 | } | ||
61 | } | ||
62 | }, | ||
51 | 63 | ||
52 | _canvasSelectionPrefs: { value: { "thickness" : 1.0, "color" : "#46a1ff" } }, | 64 | _canvasSelectionPrefs: { value: { "thickness" : 1.0, "color" : "#46a1ff" } }, |
53 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, | 65 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, |
@@ -85,7 +97,21 @@ exports.Stage = Montage.create(Component, { | |||
85 | set: function(value) { | 97 | set: function(value) { |
86 | this._resizeCanvases = value; | 98 | this._resizeCanvases = value; |
87 | if(value) { | 99 | if(value) { |
88 | this.needsDraw = true; | 100 | // TODO GET THE SCROLL SIZE FROM THE CSS -- 11 px |
101 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.bindingView.width = this.element.offsetWidth - 11; | ||
102 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.bindingView.height = this.element.offsetHeight - 11;// - 26 - 26; | ||
103 | |||
104 | if(this.currentDocument) { | ||
105 | if(this.currentDocument.currentView === "design") { | ||
106 | this.drawLayout = true; | ||
107 | this.updatePlanes = true; | ||
108 | this.draw3DInfo = true; | ||
109 | this.needsDrawSelection = true; | ||
110 | } | ||
111 | if(this.currentDocument.model && this.currentDocument.model.documentRoot) { | ||
112 | this.currentDocument.model.documentRoot.elementModel.setProperty("offsetCache", false); | ||
113 | } | ||
114 | } | ||
89 | } | 115 | } |
90 | } | 116 | } |
91 | }, | 117 | }, |
@@ -99,6 +125,44 @@ exports.Stage = Montage.create(Component, { | |||
99 | set: function(value) { | 125 | set: function(value) { |
100 | this._updatedStage = value; | 126 | this._updatedStage = value; |
101 | if(value) { | 127 | if(value) { |
128 | if(this.currentDocument) { | ||
129 | if(this.currentDocument.currentView === "design") { | ||
130 | this.drawLayout = true; | ||
131 | this.updatePlanes = true; | ||
132 | this.draw3DInfo = true; | ||
133 | this.needsDrawSelection = true; | ||
134 | } | ||
135 | if(this.currentDocument.model && this.currentDocument.model.documentRoot) { | ||
136 | this.currentDocument.model.documentRoot.elementModel.setProperty("offsetCache", false); | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | }, | ||
142 | |||
143 | _needsDrawSelection: { value: false }, | ||
144 | |||
145 | needsDrawSelection: { | ||
146 | get: function() { | ||
147 | return this._needsDrawSelection; | ||
148 | }, | ||
149 | set: function(value) { | ||
150 | this._needsDrawSelection = value; | ||
151 | if(value) { | ||
152 | this.needsDraw = true; | ||
153 | } | ||
154 | } | ||
155 | }, | ||
156 | |||
157 | _needsDrawTool: { value: null }, | ||
158 | |||
159 | needsDrawTool: { | ||
160 | get: function() { | ||
161 | return this._needsDrawTool; | ||
162 | }, | ||
163 | set: function(value) { | ||
164 | this._needsDrawTool = value; | ||
165 | if(value) { | ||
102 | this.needsDraw = true; | 166 | this.needsDraw = true; |
103 | } | 167 | } |
104 | } | 168 | } |
@@ -346,20 +410,55 @@ exports.Stage = Montage.create(Component, { | |||
346 | 410 | ||
347 | willDraw: { | 411 | willDraw: { |
348 | value: function() { | 412 | value: function() { |
349 | if(this.resizeCanvases) { | 413 | if(this._needsDrawTool) { |
350 | // TODO GET THE SCROLL SIZE FROM THE CSS -- 11 px | 414 | // console.log("drawTool"); |
351 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.bindingView.width = this.element.offsetWidth - 11; | 415 | this.application.ninja.toolsData.selectedToolInstance.HandleMouseMove(this._needsDrawTool); |
352 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.bindingView.height = this.element.offsetHeight - 11;// - 26 - 26; | 416 | this.needsDrawTool = null; |
353 | // Hack for now until a full component | 417 | } |
354 | this.layout.draw(); | 418 | } |
355 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { | 419 | }, |
356 | this.layout.draw3DInfo(true); | 420 | |
421 | draw: { | ||
422 | value: function() { | ||
423 | if(!this.currentDocument) return; | ||
424 | |||
425 | if(this.draw3DInfo) { | ||
426 | // console.log("draw3DInfo"); | ||
427 | if(this.updatePlanes) { | ||
428 | // console.log("updatePlanes"); | ||
429 | drawUtils.updatePlanes(); | ||
430 | this.stageDeps.snapManager._isCacheInvalid = true; | ||
431 | this.updatePlanes = false; | ||
357 | } | 432 | } |
358 | } else if(this.updatedStage) { | 433 | if(this.appModel.show3dGrid) { |
434 | // console.log("show3dGrid"); | ||
435 | this.stageDeps.snapManager.updateWorkingPlaneFromView(); | ||
436 | } | ||
437 | // console.log("drawWorkingPlane"); | ||
438 | drawUtils.drawWorkingPlane(); | ||
439 | this.draw3DInfo = false; | ||
440 | } | ||
441 | if(this.drawLayout) { | ||
442 | this.layout.clearCanvas(); | ||
443 | // console.log("drawLayout"); | ||
359 | this.layout.draw(); | 444 | this.layout.draw(); |
360 | this.layout.draw3DInfo(true); | 445 | this.drawLayout = false; |
446 | } | ||
447 | |||
448 | if(this._needsDrawSelection) { | ||
449 | this.clearCanvas(); | ||
450 | if(this.currentDocument.model.domContainer !== this.currentDocument.model.documentRoot) { | ||
451 | this.drawDomContainer(this.currentDocument.model.domContainer); | ||
452 | } | ||
453 | //TODO Set this variable in the needs draw so that it does not have to be calculated again for each draw for selection change | ||
454 | if(this.application.ninja.selectedElements.length) { | ||
455 | drawUtils.drawSelectionBounds(this.application.ninja.selectedElements, this.showSelectionBounds); | ||
456 | } | ||
457 | NJevent("selectionDrawn"); | ||
458 | this.needsDrawSelection = false; | ||
361 | } | 459 | } |
362 | } | 460 | } |
461 | |||
363 | }, | 462 | }, |
364 | 463 | ||
365 | didDraw: { | 464 | didDraw: { |
@@ -568,7 +667,7 @@ exports.Stage = Montage.create(Component, { | |||
568 | this._clickPoint.y = point.y; // event.layerY; | 667 | this._clickPoint.y = point.y; // event.layerY; |
569 | 668 | ||
570 | this.enableMouseInOut(); | 669 | this.enableMouseInOut(); |
571 | 670 | ||
572 | this.application.ninja.toolsData.selectedToolInstance.downPoint.x = point.x; | 671 | this.application.ninja.toolsData.selectedToolInstance.downPoint.x = point.x; |
573 | this.application.ninja.toolsData.selectedToolInstance.downPoint.y = point.y; | 672 | this.application.ninja.toolsData.selectedToolInstance.downPoint.y = point.y; |
574 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonDown(event); | 673 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonDown(event); |
@@ -630,7 +729,9 @@ exports.Stage = Montage.create(Component, { | |||
630 | 729 | ||
631 | handleMousemove: { | 730 | handleMousemove: { |
632 | value: function(event) { | 731 | value: function(event) { |
633 | this.application.ninja.toolsData.selectedToolInstance.HandleMouseMove(event); | 732 | // this.application.ninja.toolsData.selectedToolInstance.HandleMouseMove(event); |
733 | // Set a flag here, and tell the tool to handle mouse move in our draw cycle | ||
734 | this.needsDrawTool = event; | ||
634 | } | 735 | } |
635 | }, | 736 | }, |
636 | 737 | ||
@@ -653,25 +754,34 @@ exports.Stage = Montage.create(Component, { | |||
653 | 754 | ||
654 | handleSelectionChange: { | 755 |