diff options
-rwxr-xr-x | js/mediators/mouse-mediator.js | 31 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.html | 4 | ||||
-rwxr-xr-x | js/panels/Splitter.js | 8 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 49 | ||||
-rwxr-xr-x | js/tools/PanTool.js | 6 |
5 files changed, 50 insertions, 48 deletions
diff --git a/js/mediators/mouse-mediator.js b/js/mediators/mouse-mediator.js deleted file mode 100755 index 4d1fb62a..00000000 --- a/js/mediators/mouse-mediator.js +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.MouseMediator = Montage.create(Component, { | ||
11 | hasTemplate: { | ||
12 | value: false | ||
13 | }, | ||
14 | |||
15 | deserializedFromTemplate: { | ||
16 | value: function() { | ||
17 | document.addEventListener("mouseup", this, false); | ||
18 | } | ||
19 | }, | ||
20 | |||
21 | handleMouseup: { | ||
22 | value: function(event) { | ||
23 | |||
24 | if(event._event.target.id !== "drawingCanvas") { | ||
25 | NJevent( "appMouseUp"); | ||
26 | } | ||
27 | |||
28 | return true; | ||
29 | } | ||
30 | } | ||
31 | }); | ||
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index beae59d9..1bd002ae 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html | |||
@@ -261,10 +261,6 @@ | |||
261 | } | 261 | } |
262 | }, | 262 | }, |
263 | 263 | ||
264 | "mouseMediator": { | ||
265 | "prototype": "js/mediators/mouse-mediator" | ||
266 | }, | ||
267 | |||
268 | "keyboardMediator": { | 264 | "keyboardMediator": { |
269 | "prototype": "js/mediators/keyboard-mediator", | 265 | "prototype": "js/mediators/keyboard-mediator", |
270 | "properties":{ | 266 | "properties":{ |
diff --git a/js/panels/Splitter.js b/js/panels/Splitter.js index c6d46911..4f2a137e 100755 --- a/js/panels/Splitter.js +++ b/js/panels/Splitter.js | |||
@@ -156,7 +156,7 @@ exports.Splitter = Montage.create(Component, { | |||
156 | } | 156 | } |
157 | }, | 157 | }, |
158 | restore:{ | 158 | restore:{ |
159 | value: function() { | 159 | value: function(onSwitchFromCodeDocument) { |
160 | //Get splitter initial value from SettingManager | 160 | //Get splitter initial value from SettingManager |
161 | var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed; | 161 | var storedData = this.application.localStorage.getItem(this.element.getAttribute("data-montage-id")), temp = this.collapsed; |
162 | if(storedData && this.element.getAttribute("data-montage-id") !== null) { | 162 | if(storedData && this.element.getAttribute("data-montage-id") !== null) { |
@@ -172,7 +172,11 @@ exports.Splitter = Montage.create(Component, { | |||
172 | this.panel.addEventListener("webkitTransitionEnd", this, false); | 172 | this.panel.addEventListener("webkitTransitionEnd", this, false); |
173 | } | 173 | } |
174 | this.disabled = false; | 174 | this.disabled = false; |
175 | this.needsDraw = true; | 175 | if(onSwitchFromCodeDocument) { |
176 | this.draw(); // When switching from code document, draw immediately so stage size is correct | ||
177 | } else { | ||
178 | this.needsDraw = true; | ||
179 | } | ||
176 | } | 180 | } |
177 | } | 181 | } |
178 | } | 182 | } |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 5e913c76..14bc00eb 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -19,6 +19,7 @@ exports.Stage = Montage.create(Component, { | |||
19 | // TODO - Need to figure out how to remove this dependency | 19 | // TODO - Need to figure out how to remove this dependency |
20 | // Needed by some tools that depend on selectionDrawn event to set up some logic | 20 | // Needed by some tools that depend on selectionDrawn event to set up some logic |
21 | drawNow: { value : false }, | 21 | drawNow: { value : false }, |
22 | switchedFromCodeDoc: { value : false }, | ||
22 | 23 | ||
23 | // TO REVIEW | 24 | // TO REVIEW |
24 | zoomFactor: {value : 1 }, | 25 | zoomFactor: {value : 1 }, |
@@ -256,6 +257,8 @@ exports.Stage = Montage.create(Component, { | |||
256 | 257 | ||
257 | //call configure false with the old document on the selected tool to tear down down any temp. stuff | 258 | //call configure false with the old document on the selected tool to tear down down any temp. stuff |
258 | this.application.ninja.toolsData.selectedToolInstance._configure(false); | 259 | this.application.ninja.toolsData.selectedToolInstance._configure(false); |
260 | } else if(this.currentDocument && (this.currentDocument.currentView === "code")) { | ||
261 | this.switchedFromCodeDoc = true; // Switching from code document affects stage's size and scrollbar | ||
259 | } | 262 | } |
260 | 263 | ||
261 | this._currentDocument = value; | 264 | this._currentDocument = value; |
@@ -266,7 +269,8 @@ exports.Stage = Montage.create(Component, { | |||
266 | drawUtils._eltArray.length = 0; | 269 | drawUtils._eltArray.length = 0; |
267 | drawUtils._planesArray.length = 0; | 270 | drawUtils._planesArray.length = 0; |
268 | } else if(this._currentDocument.currentView === "design") { | 271 | } else if(this._currentDocument.currentView === "design") { |
269 | this.restoreAllPanels(); | 272 | this.restoreAllPanels(this.switchedFromCodeDoc); |
273 | this.switchedFromCodeDoc = false; | ||
270 | this.hideCanvas(false); | 274 | this.hideCanvas(false); |
271 | this.showRulers(); | 275 | this.showRulers(); |
272 | 276 | ||
@@ -354,8 +358,6 @@ exports.Stage = Montage.create(Component, { | |||
354 | // Hide the canvas | 358 | // Hide the canvas |
355 | this.hideCanvas(true); | 359 | this.hideCanvas(true); |
356 | 360 | ||
357 | this.eventManager.addEventListener( "appMouseUp", this, false); | ||
358 | |||
359 | this.eventManager.addEventListener( "enableStageMove", this, false); | 361 | this.eventManager.addEventListener( "enableStageMove", this, false); |
360 | this.eventManager.addEventListener( "disableStageMove", this, false); | 362 | this.eventManager.addEventListener( "disableStageMove", this, false); |
361 | 363 | ||
@@ -475,6 +477,7 @@ exports.Stage = Montage.create(Component, { | |||
475 | 477 | ||
476 | enableMouseInOut: { | 478 | enableMouseInOut: { |
477 | value: function() { | 479 | value: function() { |
480 | document.addEventListener("mouseup", this, true); | ||
478 | this._drawingCanvas.addEventListener("mouseout", this, false); | 481 | this._drawingCanvas.addEventListener("mouseout", this, false); |
479 | this._drawingCanvas.addEventListener("mouseover", this, false); | 482 | this._drawingCanvas.addEventListener("mouseover", this, false); |
480 | } | 483 | } |
@@ -487,6 +490,19 @@ exports.Stage = Montage.create(Component, { | |||
487 | } | 490 | } |
488 | }, | 491 | }, |
489 | 492 | ||
493 | captureMouseup: { | ||
494 | value: function(event) { | ||
495 | var target = event._event.target.getAttribute("data-montage-id"); | ||
496 | |||
497 | if(target && target === "drawingCanvas") { | ||
498 | return true; | ||
499 | } else { | ||
500 | this.handleAppMouseUp(event); | ||
501 | return true; | ||
502 | } | ||
503 | } | ||
504 | }, | ||
505 | |||
490 | handleMouseout: { | 506 | handleMouseout: { |
491 | value: function(event) { | 507 | value: function(event) { |
492 | this.outFlag = true; | 508 | this.outFlag = true; |
@@ -501,6 +517,11 @@ exports.Stage = Montage.create(Component, { | |||
501 | 517 | ||
502 | handleMousedown: { | 518 | handleMousedown: { |
503 | value: function(event) { | 519 | value: function(event) { |
520 | |||
521 | // Increase the canvas to cover the scroll bars | ||
522 | this._drawingCanvas.height = this._drawingCanvas.height + 11; | ||
523 | this._drawingCanvas.width = this._drawingCanvas.width + 11; | ||
524 | |||
504 | // Call the focus manager to set focus to blur any focus'd elements | 525 | // Call the focus manager to set focus to blur any focus'd elements |
505 | this.focusManager.setFocus(); | 526 | this.focusManager.setFocus(); |
506 | 527 | ||
@@ -530,13 +551,18 @@ exports.Stage = Montage.create(Component, { | |||
530 | 551 | ||
531 | handleMouseup: { | 552 | handleMouseup: { |
532 | value: function(event) { | 553 | value: function(event) { |
554 | // Restore canvas to un-cover the scroll bars. | ||
555 | this._drawingCanvas.height = this._drawingCanvas.height - 11; | ||
556 | this._drawingCanvas.width = this._drawingCanvas.width - 11; | ||
533 | // If the mouse up comes from dismissing the context menu return | 557 | // If the mouse up comes from dismissing the context menu return |
558 | |||
534 | if(this.contextMenu) { | 559 | if(this.contextMenu) { |
535 | this.contextMenu = false; | 560 | this.contextMenu = false; |
536 | return; | 561 | return; |
537 | } | 562 | } |
538 | 563 | ||
539 | //this.disableMouseInOut(); | 564 | this.disableMouseInOut(); |
565 | document.removeEventListener("mouseup", this, true); | ||
540 | 566 | ||
541 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); | 567 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); |
542 | 568 | ||
@@ -584,12 +610,17 @@ exports.Stage = Montage.create(Component, { | |||
584 | handleAppMouseUp: { | 610 | handleAppMouseUp: { |
585 | value: function(event) { | 611 | value: function(event) { |
586 | if(this.outFlag) { | 612 | if(this.outFlag) { |
613 | this._drawingCanvas.height = this._drawingCanvas.height - 11; | ||
614 | this._drawingCanvas.width = this._drawingCanvas.width - 11; | ||
615 | |||
587 | if(this.application.ninja.toolsData.selectedToolInstance.isDrawing) { | 616 | if(this.application.ninja.toolsData.selectedToolInstance.isDrawing) { |
588 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); | 617 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); |
589 | } | 618 | } |
590 | this.disableMouseInOut(); | 619 | this.disableMouseInOut(); |
591 | this.outFlag = false; | 620 | this.outFlag = false; |
592 | } | 621 | } |
622 | |||
623 | document.removeEventListener("mouseup", this, true); | ||
593 | } | 624 | } |
594 | }, | 625 | }, |
595 | 626 | ||
@@ -1271,11 +1302,11 @@ exports.Stage = Montage.create(Component, { | |||
1271 | } | 1302 | } |
1272 | }, | 1303 | }, |
1273 | restoreAllPanels:{ | 1304 | restoreAllPanels:{ |
1274 | value:function(){ | 1305 | value:function(onSwitchDocument){ |
1275 | this.application.ninja.panelSplitter.restore(); | 1306 | this.application.ninja.panelSplitter.restore(onSwitchDocument); |
1276 | this.application.ninja.timelineSplitter.restore(); | 1307 | this.application.ninja.timelineSplitter.restore(onSwitchDocument); |
1277 | this.application.ninja.toolsSplitter.restore(); | 1308 | this.application.ninja.toolsSplitter.restore(onSwitchDocument); |
1278 | this.application.ninja.optionsSplitter.restore(); | 1309 | this.application.ninja.optionsSplitter.restore(onSwitchDocument); |
1279 | } | 1310 | } |
1280 | }, |