diff options
Diffstat (limited to 'js/stage/stage.reel/stage.js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 4c1d046b..ec8c0e55 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -170,8 +170,7 @@ exports.Stage = Montage.create(Component, { | |||
170 | 170 | ||
171 | // Hack for now until a full component | 171 | // Hack for now until a full component |
172 | this.layout.draw(); | 172 | this.layout.draw(); |
173 | } | 173 | } else if(this.updatedStage) { |
174 | else if(this.updatedStage) { | ||
175 | this.layout.draw(); | 174 | this.layout.draw(); |
176 | this.layout.draw3DInfo(true); | 175 | this.layout.draw3DInfo(true); |
177 | } | 176 | } |
@@ -235,6 +234,10 @@ exports.Stage = Montage.create(Component, { | |||
235 | 234 | ||
236 | this.hideCanvas(false); | 235 | this.hideCanvas(false); |
237 | 236 | ||
237 | // Recalculate the canvas sizes because of splitter resizing | ||
238 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this.element.offsetWidth - 11 ; | ||
239 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this.element.offsetHeight - 11; | ||
240 | |||
238 | this._documentRoot = this.application.ninja.currentDocument.documentRoot; | 241 | this._documentRoot = this.application.ninja.currentDocument.documentRoot; |
239 | this._viewport = this.application.ninja.currentDocument.documentRoot.parentNode; | 242 | this._viewport = this.application.ninja.currentDocument.documentRoot.parentNode; |
240 | 243 | ||
@@ -319,6 +322,10 @@ exports.Stage = Montage.create(Component, { | |||
319 | 322 | ||
320 | handleMousedown: { | 323 | handleMousedown: { |
321 | value: function(event) { | 324 | value: function(event) { |
325 | // Call the focus manager to set focus to blur any focus'd elements | ||
326 | this.focusManager.setFocus(); | ||
327 | |||
328 | |||
322 | var point; | 329 | var point; |
323 | // event.preventDefault(); // commenting because HTML elements in the IDE are retaining focus | 330 | // event.preventDefault(); // commenting because HTML elements in the IDE are retaining focus |
324 | // If right click set the context menu to true to prevent a mouse up. | 331 | // If right click set the context menu to true to prevent a mouse up. |
@@ -512,6 +519,36 @@ exports.Stage = Montage.create(Component, { | |||
512 | }, | 519 | }, |
513 | 520 | ||
514 | /** | 521 | /** |
522 | * GetSelectableElement: Returns a selectable object (direct child of current container) at clicked point | ||
523 | * | ||
524 | * @param: X,Y | ||
525 | * @return: Returns the current container if the the X,Y hits an element in the exclusion list | ||
526 | */ | ||
527 | GetSelectableElement: { | ||
528 | value: function(pos) { | ||
529 | var item = this.GetElement(pos); | ||
530 | if(this.application.ninja.currentDocument.inExclusion(item) !== -1) { | ||
531 | return this.application.ninja.currentSelectedContainer; | ||
532 | } | ||
533 | var activeContainerId = this.application.ninja.currentSelectedContainer.uuid; | ||
534 | if(item.parentNode.uuid === activeContainerId) { | ||
535 | return item; | ||
536 | } else { | ||
537 | var outerElement = item.parentNode; | ||
538 | |||
539 | while(outerElement.parentNode && outerElement.parentNode.uuid !== activeContainerId) { | ||
540 | // If element is higher up than current container then return | ||
541 | if(outerElement.id === "UserContent") return; | ||
542 | // else keep going up the chain | ||
543 | outerElement = outerElement.parentNode; | ||
544 | } | ||
545 | |||
546 | return outerElement; | ||
547 | } | ||
548 | } | ||
549 | }, | ||
550 | |||
551 | /** | ||
515 | * GetElement: Returns the object under the X,Y coordinates passed as an obj with x,y | 552 | * GetElement: Returns the object under the X,Y coordinates passed as an obj with x,y |
516 | * | 553 | * |
517 | * @param: X,Y | 554 | * @param: X,Y |
@@ -523,8 +560,7 @@ exports.Stage = Montage.create(Component, { | |||
523 | elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); | 560 | elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); |
524 | 561 | ||
525 | // workaround Chrome 3d bug | 562 | // workaround Chrome 3d bug |
526 | if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(elt) !== -1) | 563 | if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(elt) !== -1) { |
527 | { | ||
528 | return this._getElementUsingSnapping(point); | 564 | return this._getElementUsingSnapping(point); |
529 | } else { | 565 | } else { |
530 | return elt; | 566 | return elt; |
@@ -568,7 +604,7 @@ exports.Stage = Montage.create(Component, { | |||
568 | var selArray = new Array(); | 604 | var selArray = new Array(); |
569 | 605 | ||
570 | for(var i = 0; this.application.ninja.selectedElements[i];i++) { | 606 | for(var i = 0; this.application.ninja.selectedElements[i];i++) { |
571 | var curElement = this.application.ninja.selectedElements[i]._element; | 607 | var curElement = this.application.ninja.selectedElements[i]; |
572 | 608 | ||
573 | // Add element to array that is used to calculate 3d-bounding box of all elements | 609 | // Add element to array that is used to calculate 3d-bounding box of all elements |
574 | selArray.push( curElement ); | 610 | selArray.push( curElement ); |
@@ -759,6 +795,8 @@ exports.Stage = Montage.create(Component, { | |||
759 | drawLine: { | 795 | drawLine: { |
760 | value:function(x0, y0, x1, y1, strokeSize, strokeColor) { | 796 | value:function(x0, y0, x1, y1, strokeSize, strokeColor) { |
761 | this.clearDrawingCanvas(); | 797 | this.clearDrawingCanvas(); |
798 | var origStrokeStyle = this._drawingContext.strokeStyle; | ||
799 | var origLineWidth = this._drawingContext.lineWidth; | ||
762 | this._drawingContext.strokeStyle = strokeColor; | 800 | this._drawingContext.strokeStyle = strokeColor; |
763 | this._drawingContext.lineWidth = strokeSize; | 801 | this._drawingContext.lineWidth = strokeSize; |
764 | 802 | ||
@@ -789,6 +827,9 @@ exports.Stage = Montage.create(Component, { | |||
789 | var w = Math.round(Math.abs(x1-x0)); | 827 | var w = Math.round(Math.abs(x1-x0)); |
790 | this._drawingContext.fillText("H: " + h, txtX + 38, txtY - 4); | 828 | this._drawingContext.fillText("H: " + h, txtX + 38, txtY - 4); |
791 | this._drawingContext.fillText("W: " + w, txtX - 5, txtY + 12); | 829 | this._drawingContext.fillText("W: " + w, txtX - 5, txtY + 12); |
830 | |||
831 | this._drawingContext.strokeStyle = origStrokeStyle; | ||
832 | this._drawingContext.lineWidth = origLineWidth; | ||
792 | } | 833 | } |
793 | }, | 834 | }, |
794 | 835 | ||