aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage.reel/stage.js49
1 files changed, 40 insertions, 9 deletions
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 }, 1311 },
1281 1312