aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
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 31f40d09..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.markEdited(); 101 doc.needsSave = true;
102 }else if(historySize.undo===0 && historySize.redo>0){ 102 }else if(historySize.undo===0 && historySize.redo>0){
103 doc.markUnedited(); 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 37b1df35..44e14827 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
@@ -533,8 +530,7 @@ exports.Stage = Montage.create(Component, {
533 drawUtils.updatePlanes(); 530 drawUtils.updatePlanes();
534 531
535 //TODO Set this variable in the needs draw so that it does not have to be calculated again for each draw for selection change 532 //TODO Set this variable in the needs draw so that it does not have to be calculated again for each draw for selection change
536 if(this.application.ninja.selectedElements.length) 533 if(this.application.ninja.selectedElements.length) {
537 {
538 // drawUtils.drawSelectionBounds handles the single selection case as well, 534 // drawUtils.drawSelectionBounds handles the single selection case as well,
539 // so we don't have to special-case the single selection case. 535 // so we don't have to special-case the single selection case.
540 // TODO drawUtils.drawSelectionBounds expects an array of elements. 536 // TODO drawUtils.drawSelectionBounds expects an array of elements.
@@ -542,8 +538,7 @@ exports.Stage = Montage.create(Component, {
542 // TODO to work on _element instead of re-creating a new Array here. 538 // TODO to work on _element instead of re-creating a new Array here.
543 var selArray = new Array(); 539 var selArray = new Array();
544 540
545 for(var i = 0; this.application.ninja.selectedElements[i];i++) 541 for(var i = 0; this.application.ninja.selectedElements[i];i++) {
546 {
547 var curElement = this.application.ninja.selectedElements[i]._element; 542 var curElement = this.application.ninja.selectedElements[i]._element;
548 543
549 // Add element to array that is used to calculate 3d-bounding box of all elements 544 // Add element to array that is used to calculate 3d-bounding box of all elements
@@ -576,7 +571,7 @@ exports.Stage = Montage.create(Component, {
576 * @params: x, y, w, h 571 * @params: x, y, w, h
577 */ 572 */
578 draw3DSelectionRectangle: { 573 draw3DSelectionRectangle: {
579 value:function(x0,y0, x1,y1, x2,y2, x3,y3){ 574 value:function(x0,y0, x1,y1, x2,y2, x3,y3) {
580// this.clearCanvas(); 575// this.clearCanvas();
581 this.clearDrawingCanvas(); 576 this.clearDrawingCanvas();
582 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; 577 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color;
@@ -621,7 +616,7 @@ exports.Stage = Montage.create(Component, {
621 * Draws selection highlight and reg. point for a given element 616 * Draws selection highlight and reg. point for a given element
622 */ 617 */
623 drawElementBoundingBox: { 618 drawElementBoundingBox: {
624 value: function(elt, editMode) { 619 value: function(elt) {
625 this.stageDeps.viewUtils.setViewportObj( elt ); 620 this.stageDeps.viewUtils.setViewportObj( elt );
626 var bounds3D = this.stageDeps.viewUtils.getElementViewBounds3D( elt ); 621 var bounds3D = this.stageDeps.viewUtils.getElementViewBounds3D( elt );
627 622
@@ -632,18 +627,16 @@ exports.Stage = Montage.create(Component, {
632// } 627// }
633 628
634 var zoomFactor = 1; 629 var zoomFactor = 1;
635 if (this._viewport.style && this._viewport.style.zoom) 630 if (this._viewport.style && this._viewport.style.zoom) {
636 {
637 zoomFactor = Number(this._viewport.style.zoom); 631 zoomFactor = Number(this._viewport.style.zoom);
638 } 632 }
633
639 var tmpMat = this.stageDeps.viewUtils.getLocalToGlobalMatrix( elt ); 634 var tmpMat = this.stageDeps.viewUtils.getLocalToGlobalMatrix( elt );
640 for (var j=0; j<4; j++) 635 for (var j=0; j<4; j++) {
641 {
642 var localPt = bounds3D[j]; 636 var localPt = bounds3D[j];
643 var tmpPt = this.stageDeps.viewUtils.localToGlobal2(localPt, tmpMat); 637 var tmpPt = this.stageDeps.viewUtils.localToGlobal2(localPt, tmpMat);
644 638
645 if(zoomFactor !== 1) 639 if(zoomFactor !== 1) {
646 {
647 tmpPt = vecUtils.vecScale(3, tmpPt, zoomFactor); 640 tmpPt = vecUtils.vecScale(3, tmpPt, zoomFactor);
648 641
649 tmpPt[0] += this._scrollLeft*(zoomFactor - 1); 642 tmpPt[0] += this._scrollLeft*(zoomFactor - 1);
@@ -653,13 +646,9 @@ exports.Stage = Montage.create(Component, {
653 } 646 }
654 647
655 // draw it 648 // draw it
656 if(editMode) { 649 this.context.strokeStyle = this._canvasSelectionPrefs.color;
657 this.context.strokeStyle = this._editSymbolPrefs.color; 650 this.context.lineWidth = this._canvasSelectionPrefs.thickness;
658 this.context.lineWidth = this._editSymbolPrefs.thickness; 651
659 } else {
660 this.context.strokeStyle = this._canvasSelectionPrefs.color;
661 this.context.lineWidth = this._canvasSelectionPrefs.thickness;
662 }
663 652
664 this.context.beginPath(); 653 this.context.beginPath();
665 654
@@ -673,13 +662,6 @@ exports.Stage = Montage.create(Component, {
673 662
674 this.context.closePath(); 663 this.context.closePath();
675 this.context.stroke(); 664 this.context.stroke();
676
677 /** Bug #25 - Do Not Draw the Registration point anymore on the top left since it's assumed there.
678 this.context.beginPath();
679 this.context.arc(bounds3D[0][0], bounds3D[0][1] , 5, 0, Math.PI*2, false);
680 this.context.stroke();
681 */
682
683 } 665 }
684 }, 666 },
685 667
@@ -691,10 +673,8 @@ exports.Stage = Montage.create(Component, {
691 * 673 *
692 * @params: x, y, w, h 674 * @params: x, y, w, h
693 */ 675 */
694 draw3DProjectedAndUnprojectedRectangles: 676 draw3DProjectedAndUnprojectedRectangles: {
695 { 677 value:function(unProjPts, projPts) {
696 value:function(unProjPts, projPts)
697 {
698 this.clearDrawingCanvas(); 678 this.clearDrawingCanvas();
699 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; 679 this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color;
700 this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness; 680 this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness;
@@ -748,7 +728,7 @@ exports.Stage = Montage.create(Component, {
748 * @params: x0, y0, x1, y1 728 * @params: x0, y0, x1, y1
749 */ 729 */
750 drawLine: { 730 drawLine: {
751 value:function(x0, y0, x1, y1, strokeSize, strokeColor){ 731 value:function(x0, y0, x1, y1, strokeSize, strokeColor) {
752 this.clearDrawingCanvas(); 732 this.clearDrawingCanvas();
753 this._drawingContext.strokeStyle = strokeColor; 733 this._drawingContext.strokeStyle = strokeColor;
754 this._drawingContext.lineWidth = strokeSize; 734 this._drawingContext.lineWidth = strokeSize;