diff options
-rwxr-xr-x | js/mediators/mouse-mediator.js | 31 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.html | 4 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 33 |
3 files changed, 30 insertions, 38 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/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 319ffe87..14bc00eb 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -358,8 +358,6 @@ exports.Stage = Montage.create(Component, { | |||
358 | // Hide the canvas | 358 | // Hide the canvas |
359 | this.hideCanvas(true); | 359 | this.hideCanvas(true); |
360 | 360 | ||
361 | this.eventManager.addEventListener( "appMouseUp", this, false); | ||
362 | |||
363 | this.eventManager.addEventListener( "enableStageMove", this, false); | 361 | this.eventManager.addEventListener( "enableStageMove", this, false); |
364 | this.eventManager.addEventListener( "disableStageMove", this, false); | 362 | this.eventManager.addEventListener( "disableStageMove", this, false); |
365 | 363 | ||
@@ -479,6 +477,7 @@ exports.Stage = Montage.create(Component, { | |||
479 | 477 | ||
480 | enableMouseInOut: { | 478 | enableMouseInOut: { |
481 | value: function() { | 479 | value: function() { |
480 | document.addEventListener("mouseup", this, true); | ||
482 | this._drawingCanvas.addEventListener("mouseout", this, false); | 481 | this._drawingCanvas.addEventListener("mouseout", this, false); |
483 | this._drawingCanvas.addEventListener("mouseover", this, false); | 482 | this._drawingCanvas.addEventListener("mouseover", this, false); |
484 | } | 483 | } |
@@ -491,6 +490,19 @@ exports.Stage = Montage.create(Component, { | |||
491 | } | 490 | } |
492 | }, | 491 | }, |
493 | 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 | |||
494 | handleMouseout: { | 506 | handleMouseout: { |
495 | value: function(event) { | 507 | value: function(event) { |
496 | this.outFlag = true; | 508 | this.outFlag = true; |
@@ -505,6 +517,11 @@ exports.Stage = Montage.create(Component, { | |||
505 | 517 | ||
506 | handleMousedown: { | 518 | handleMousedown: { |
507 | 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 | |||
508 | // 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 |
509 | this.focusManager.setFocus(); | 526 | this.focusManager.setFocus(); |
510 | 527 | ||
@@ -534,13 +551,18 @@ exports.Stage = Montage.create(Component, { | |||
534 | 551 | ||
535 | handleMouseup: { | 552 | handleMouseup: { |
536 | 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; | ||
537 | // If the mouse up comes from dismissing the context menu return | 557 | // If the mouse up comes from dismissing the context menu return |
558 | |||
538 | if(this.contextMenu) { | 559 | if(this.contextMenu) { |
539 | this.contextMenu = false; | 560 | this.contextMenu = false; |
540 | return; | 561 | return; |
541 | } | 562 | } |
542 | 563 | ||
543 | //this.disableMouseInOut(); | 564 | this.disableMouseInOut(); |
565 | document.removeEventListener("mouseup", this, true); | ||
544 | 566 | ||
545 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); | 567 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); |
546 | 568 | ||
@@ -588,12 +610,17 @@ exports.Stage = Montage.create(Component, { | |||
588 | handleAppMouseUp: { | 610 | handleAppMouseUp: { |
589 | value: function(event) { | 611 | value: function(event) { |
590 | if(this.outFlag) { | 612 | if(this.outFlag) { |
613 | this._drawingCanvas.height = this._drawingCanvas.height - 11; | ||
614 | this._drawingCanvas.width = this._drawingCanvas.width - 11; | ||
615 | |||
591 | if(this.application.ninja.toolsData.selectedToolInstance.isDrawing) { | 616 | if(this.application.ninja.toolsData.selectedToolInstance.isDrawing) { |
592 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); | 617 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonUp(event); |
593 | } | 618 | } |
594 | this.disableMouseInOut(); | 619 | this.disableMouseInOut(); |
595 | this.outFlag = false; | 620 | this.outFlag = false; |
596 | } | 621 | } |
622 | |||
623 | document.removeEventListener("mouseup", this, true); | ||
597 | } | 624 | } |
598 | }, | 625 | }, |
599 | 626 | ||