aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-22 10:34:46 -0800
committerNivesh Rajbhandari2012-02-22 10:34:46 -0800
commit50bb05efbafc9a80f069dfde32988e5cd6826865 (patch)
tree64332f1c2f22b5c0a17f6df2f9a02d77f1c87274 /js/stage
parenta69c929602e64f10fb3903b89a2ca9e9ed2c8dfb (diff)
parent2f24dafec79583547fe663d5a387d8ef15aae3bf (diff)
downloadninja-50bb05efbafc9a80f069dfde32988e5cd6826865.tar.gz
Merge branch 'refs/heads/ninja-internal' into ToolFixes
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/layout.js29
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js4
-rwxr-xr-xjs/stage/stage.reel/stage.js48
3 files changed, 40 insertions, 41 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 1a491210..56bb70bf 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -195,11 +195,30 @@ exports.Layout = Montage.create(Component, {
195 bounds3D[j] = tmpPt; 195 bounds3D[j] = tmpPt;
196 } 196 }
197 197
198 // Draw the Item ouline 198 if(item.uuid === this.application.ninja.currentSelectedContainer.uuid) {
199 this._dashedLine(bounds3D[3][0] - 0.5,bounds3D[3][1]- 0.5,bounds3D[0][0] + 2.5, bounds3D[0][1] - 0.5,[5,5]); 199 this.ctx.save();
200 this._dashedLine(bounds3D[0][0] - 0.5, bounds3D[0][1] - 0.5, bounds3D[1][0]- 0.5, bounds3D[1][1] + 0.5, [5,5] ); 200 this.ctx.strokeStyle = "#C61F00";
201 this._dashedLine(bounds3D[1][0] - 0.5 , bounds3D[1][1] + 0.5, bounds3D[2][0]+ 0.5, bounds3D[2][1] + 0.5, [5,5] ); 201
202 this._dashedLine(bounds3D[2][0] + 0.5, bounds3D[2][1] + 0.5, bounds3D[3][0] + 0.5, bounds3D[3][1] - 0.5, [5,5] ); 202 this.ctx.beginPath();
203
204 this.ctx.moveTo( bounds3D[3][0] + 0.5 , bounds3D[3][1] - 0.5 );
205
206 this.ctx.lineTo( bounds3D[0][0] - 0.5 , bounds3D[0][1] - 0.5 );
207 this.ctx.lineTo( bounds3D[1][0] - 0.5 , bounds3D[1][1] + 0.5 );
208 this.ctx.lineTo( bounds3D[2][0] + 0.5 , bounds3D[2][1] + 0.5 );
209 this.ctx.lineTo( bounds3D[3][0] + 0.5 , bounds3D[3][1] + 0.5 );
210
211 this.ctx.closePath();
212 this.ctx.stroke();
213
214 this.ctx.restore();
215 } else {
216 // Draw the Item ouline
217 this._dashedLine(bounds3D[3][0] - 0.5,bounds3D[3][1]- 0.5,bounds3D[0][0] + 2.5, bounds3D[0][1] - 0.5,[5,5]);
218 this._dashedLine(bounds3D[0][0] - 0.5, bounds3D[0][1] - 0.5, bounds3D[1][0]- 0.5, bounds3D[1][1] + 0.5, [5,5] );
219 this._dashedLine(bounds3D[1][0] - 0.5 , bounds3D[1][1] + 0.5, bounds3D[2][0]+ 0.5, bounds3D[2][1] + 0.5, [5,5] );
220 this._dashedLine(bounds3D[2][0] + 0.5, bounds3D[2][1] + 0.5, bounds3D[3][0] + 0.5, bounds3D[3][1] - 0.5, [5,5] );
221 }
203 222
204 // Draw the Label is all mode 223 // Draw the Label is all mode
205 if(this.layoutView === "layoutAll") { 224 if(this.layoutView === "layoutAll") {
diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js
index 46d74e13..dc9980f0 100755
--- a/js/stage/stage-view.reel/stage-view.js
+++ b/js/stage/stage-view.reel/stage-view.js
@@ -98,9 +98,9 @@ exports.StageView = Montage.create(Component, {
98 onChange: function(){ 98 onChange: function(){
99 var historySize = doc.editor.historySize(); 99 var historySize = doc.editor.historySize();
100 if(historySize.undo>0){ 100 if(historySize.undo>0){
101 doc.dirtyFlag=true; 101 doc.needsSave = true;
102 }else if(historySize.undo===0 && historySize.redo>0){ 102 }else if(historySize.undo===0 && historySize.redo>0){
103 doc.dirtyFlag=false; 103 doc.needsSave = false;
104 } 104 }
105 }, 105 },
106 onCursorActivity: function() { 106 onCursorActivity: function() {
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 5734e317..641ac247 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -19,8 +19,6 @@ exports.Stage = Montage.create(Component, {
19 zoomFactor: {value : 1 }, 19 zoomFactor: {value : 1 },
20 20
21 _canvasSelectionPrefs: { value: { "thickness" : 1.0, "color" : "#46a1ff" } }, 21 _canvasSelectionPrefs: { value: { "thickness" : 1.0, "color" : "#46a1ff" } },
22 _editSymbolPrefs: { value: { "thickness" : 2.0, "color" : "#C61F00" } },
23
24 _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, 22 _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } },
25 drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, 23 drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } },
26 24
@@ -260,7 +258,6 @@ exports.Stage = Montage.create(Component, {
260 this.application.ninja.toolsData.selectedToolInstance._configure(true); 258 this.application.ninja.toolsData.selectedToolInstance._configure(true);
261 259
262 this.addEventListener("change@appModel.show3dGrid", this, false); 260 this.addEventListener("change@appModel.show3dGrid", this, false);
263
264 } 261 }
265 }, 262 },
266 263
@@ -558,8 +555,7 @@ exports.Stage = Montage.create(Component, {
558 drawUtils.updatePlanes(); 555 drawUtils.updatePlanes();
559 556
560 //TODO Set this variable in the needs draw so that it does not have to be calculated again for each draw for selection change 557 //TODO Set this variable in the needs draw so that it does not have to be calculated again for each draw for selection change
561 if(this.application.ninja.selectedElements.length) 558 if(this.application.ninja.selectedElements.length) {
562 {
563 // drawUtils.drawSelectionBounds handles the single selection case as well, 559 // drawUtils.drawSelectionBounds handles the single selection case as well,
564 // so we don't have to special-case the single selection case. 560 // so we don't have to special-case the single selection case.
565 // TODO drawUtils.drawSelectionBounds expects an array of elements. 561 // TODO drawUtils.drawSelectionBounds expects an array of elements.
@@ -567,8 +563,7 @@ exports.Stage = Montage.create(Component, {
567 // TODO to work on _element instead of re-creating a new Array here. 563 // TODO to work on _element instead of re-creating a new Array here.
568 var selArray = new Array(); 564 var selArray = new Array();
569 565
570 for(var i = 0; this.application.ninja.selectedElements[i];i++) 566 for(var i = 0; this.application.ninja.selectedElements[i];i++) {
571 {
572 var curElement = this.application.ninja.selectedElements[i]._element; 567 var curElement = this.application.ninja.selectedElements[i]._element;
573 568
574 // Add element to array that is used to calculate 3d-bounding box of all elements 569 // Add element to array that is used to calculate 3d-bounding box of all elements
@@ -601,7 +596,7 @@ exports.Stage = Montage.create(Component, {
601 * @params: x, y, w, h 596 * @params: x, y, w, h
602 */ 597 */
603 draw3DSelectionRectangle: { 598 draw3DSelectionRectangle: {
604 value:function(x0,y0, x1,y1, x2,y2, x3,y3){ 599 value:function(x0,y0, x1,y1, x2,y2, x3,y3) {
605// this.clearCanvas(); 600// this.clearCanvas();
606 this.clearDrawingCanvas(); 601 this.clearDrawingCanvas();
607 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; 602 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color;
@@ -646,7 +641,7 @@ exports.Stage = Montage.create(Component, {
646 * Draws selection highlight and reg. point for a given element 641 * Draws selection highlight and reg. point for a given element
647 */ 642 */
648 drawElementBoundingBox: { 643 drawElementBoundingBox: {
649 value: function(elt, editMode) { 644 value: function(elt) {
650 this.stageDeps.viewUtils.setViewportObj( elt ); 645 this.stageDeps.viewUtils.setViewportObj( elt );
651 var bounds3D = this.stageDeps.viewUtils.getElementViewBounds3D( elt ); 646 var bounds3D = this.stageDeps.viewUtils.getElementViewBounds3D( elt );
652 647
@@ -657,18 +652,16 @@ exports.Stage = Montage.create(Component, {
657// } 652// }
658 653
659 var zoomFactor = 1; 654 var zoomFactor = 1;
660 if (this._viewport.style && this._viewport.style.zoom) 655 if (this._viewport.style && this._viewport.style.zoom) {
661 {
662 zoomFactor = Number(this._viewport.style.zoom); 656 zoomFactor = Number(this._viewport.style.zoom);
663 } 657 }
658
664 var tmpMat = this.stageDeps.viewUtils.getLocalToGlobalMatrix( elt ); 659 var tmpMat = this.stageDeps.viewUtils.getLocalToGlobalMatrix( elt );
665 for (var j=0; j<4; j++) 660 for (var j=0; j<4; j++) {
666 {
667 var localPt = bounds3D[j]; 661 var localPt = bounds3D[j];
668 var tmpPt = this.stageDeps.viewUtils.localToGlobal2(localPt, tmpMat); 662 var tmpPt = this.stageDeps.viewUtils.localToGlobal2(localPt, tmpMat);
669 663
670 if(zoomFactor !== 1) 664 if(zoomFactor !== 1) {
671 {
672 tmpPt = vecUtils.vecScale(3, tmpPt, zoomFactor); 665 tmpPt = vecUtils.vecScale(3, tmpPt, zoomFactor);
673 666
674 tmpPt[0] += this._scrollLeft*(zoomFactor - 1); 667 tmpPt[0] += this._scrollLeft*(zoomFactor - 1);
@@ -678,13 +671,9 @@ exports.Stage = Montage.create(Component, {
678 } 671 }
679 672
680 // draw it 673 // draw it
681 if(editMode) { 674 this.context.strokeStyle = this._canvasSelectionPrefs.color;
682 this.context.strokeStyle = this._editSymbolPrefs.color; 675 this.context.lineWidth = this._canvasSelectionPrefs.thickness;
683 this.context.lineWidth = this._editSymbolPrefs.thickness; 676
684 } else {
685 this.context.strokeStyle = this._canvasSelectionPrefs.color;
686 this.context.lineWidth = this._canvasSelectionPrefs.thickness;
687 }
688 677
689 this.context.beginPath(); 678 this.context.beginPath();
690 679
@@ -698,13 +687,6 @@ exports.Stage = Montage.create(Component, {
698 687
699 this.context.closePath(); 688 this.context.closePath();
700 this.context.stroke(); 689 this.context.stroke();
701
702 /** Bug #25 - Do Not Draw the Registration point anymore on the top left since it's assumed there.
703 this.context.beginPath();
704 this.context.arc(bounds3D[0][0], bounds3D[0][1] , 5, 0, Math.PI*2, false);
705 this.context.stroke();
706 */
707
708 } 690 }
709 }, 691 },
710 692
@@ -716,10 +698,8 @@ exports.Stage = Montage.create(Component, {
716 * 698 *
717 * @params: x, y, w, h 699 * @params: x, y, w, h
718 */ 700 */
719 draw3DProjectedAndUnprojectedRectangles: 701 draw3DProjectedAndUnprojectedRectangles: {
720 { 702 value:function(unProjPts, projPts) {
721 value:function(unProjPts, projPts)
722 {
723 this.clearDrawingCanvas(); 703 this.clearDrawingCanvas();
724 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; 704 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color;
725 this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness; 705 this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness;
@@ -773,7 +753,7 @@ exports.Stage = Montage.create(Component, {
773 * @params: x0, y0, x1, y1 753 * @params: x0, y0, x1, y1
774 */ 754 */
775 drawLine: { 755 drawLine: {
776 value:function(x0, y0, x1, y1, strokeSize, strokeColor){ 756 value:function(x0, y0, x1, y1, strokeSize, strokeColor) {
777 this.clearDrawingCanvas(); 757 this.clearDrawingCanvas();
778 this._drawingContext.strokeStyle = strokeColor; 758 this._drawingContext.strokeStyle = strokeColor;
779 this._drawingContext.lineWidth = strokeSize; 759 this._drawingContext.lineWidth = strokeSize;