diff options
author | Jonathan Duran | 2012-03-23 07:24:39 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-03-23 07:24:39 -0700 |
commit | 846d539997bf188b9caf63cdf0008367fe6c9ede (patch) | |
tree | ae0ed9293cd5859cd10694fb2e045b2101ed8df8 /js/stage | |
parent | 595a569cf459e7e7cbe19e546c23322b56e44341 (diff) | |
parent | 57cc00a5ef3ab525e54a030d7692b2d9eefaa68b (diff) | |
download | ninja-846d539997bf188b9caf63cdf0008367fe6c9ede.tar.gz |
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/stage.reel/stage.html | 7 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 41 |
2 files changed, 45 insertions, 3 deletions
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html index 812e3d55..f796303c 100755 --- a/js/stage/stage.reel/stage.html +++ b/js/stage/stage.reel/stage.html | |||
@@ -50,6 +50,10 @@ | |||
50 | "element" : {"#": "textToolObject"} | 50 | "element" : {"#": "textToolObject"} |
51 | } | 51 | } |
52 | }, | 52 | }, |
53 | |||
54 | "focusManager": { | ||
55 | "object": "js/components/focus-manager.reel" | ||
56 | }, | ||
53 | 57 | ||
54 | "owner": { | 58 | "owner": { |
55 | "module": "js/stage/stage.reel", | 59 | "module": "js/stage/stage.reel", |
@@ -63,7 +67,8 @@ | |||
63 | "stageDeps": {"@": "StageDeps1"}, | 67 | "stageDeps": {"@": "StageDeps1"}, |
64 | "layout": {"@": "layout1"}, | 68 | "layout": {"@": "layout1"}, |
65 | "stageView": {"@": "stageView"}, | 69 | "stageView": {"@": "stageView"}, |
66 | "textTool": {"@": "textTool"} | 70 | "textTool": {"@": "textTool"}, |
71 | "focusManager": {"@": "focusManager"} | ||
67 | }, | 72 | }, |
68 | "bindings": { | 73 | "bindings": { |
69 | "currentDocumentStageView": { | 74 | "currentDocumentStageView": { |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 4c1d046b..00b72490 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 |