diff options
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 48 |
1 files changed, 14 insertions, 34 deletions
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; |