aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.html5
-rwxr-xr-xjs/stage/stage.reel/stage.html17
-rwxr-xr-xjs/stage/stage.reel/stage.js87
-rwxr-xr-xjs/stage/tool-handle.js15
4 files changed, 62 insertions, 62 deletions
diff --git a/js/stage/stage-view.reel/stage-view.html b/js/stage/stage-view.reel/stage-view.html
index ee8fa315..3680e8b5 100755
--- a/js/stage/stage-view.reel/stage-view.html
+++ b/js/stage/stage-view.reel/stage-view.html
@@ -1,4 +1,4 @@
1<!DOCTYPE html> 1<!DOCTYPE html>
2<!-- <copyright> 2<!-- <copyright>
3 This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 3 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
4 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 4 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
@@ -12,8 +12,7 @@
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "owner": { 14 "owner": {
15 "module": "js/stage/stage-view.reel", 15 "prototype": "js/stage/stage-view.reel",
16 "name": "StageView",
17 "properties": { 16 "properties": {
18 "element": {"#": "codeViewContainer"} 17 "element": {"#": "codeViewContainer"}
19 } 18 }
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html
index f796303c..12a331c3 100755
--- a/js/stage/stage.reel/stage.html
+++ b/js/stage/stage.reel/stage.html
@@ -1,4 +1,4 @@
1<!DOCTYPE html> 1<!DOCTYPE html>
2<!-- <copyright> 2<!-- <copyright>
3 This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 3 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
4 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 4 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
@@ -12,24 +12,21 @@
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "stageView" : { 14 "stageView" : {
15 "module": "js/stage/stage-view.reel", 15 "prototype": "js/stage/stage-view.reel",
16 "name": "StageView",
17 "properties": { 16 "properties": {
18 "element": {"#": "stageView"} 17 "element": {"#": "stageView"}
19 } 18 }
20 }, 19 },
21 20
22 "StageDeps1": { 21 "StageDeps1": {
23 "module": "js/stage/stage-deps", 22 "prototype": "js/stage/stage-deps",
24 "name": "StageDeps",
25 "properties": { 23 "properties": {
26 "stage": {"@": "owner"} 24 "stage": {"@": "owner"}
27 } 25 }
28 }, 26 },
29 27
30 "layout1": { 28 "layout1": {
31 "module": "js/stage/layout", 29 "prototype": "js/stage/layout",
32 "name": "Layout",
33 "properties": { 30 "properties": {
34 "canvas": {"#": "layoutCanvas"}, 31 "canvas": {"#": "layoutCanvas"},
35 "stage": {"@": "owner"} 32 "stage": {"@": "owner"}
@@ -44,8 +41,7 @@
44 }, 41 },
45 42
46 "textTool": { 43 "textTool": {
47 "module": "node_modules/labs/rich-text-editor.reel", 44 "prototype": "node_modules/labs/rich-text-editor.reel",
48 "name": "RichTextEditor",
49 "properties": { 45 "properties": {
50 "element" : {"#": "textToolObject"} 46 "element" : {"#": "textToolObject"}
51 } 47 }
@@ -56,8 +52,7 @@
56 }, 52 },
57 53
58 "owner": { 54 "owner": {
59 "module": "js/stage/stage.reel", 55 "prototype": "js/stage/stage.reel",
60 "name": "Stage",
61 "properties": { 56 "properties": {
62 "element": {"#": "stageAndScenesContainer"}, 57 "element": {"#": "stageAndScenesContainer"},
63 "_iframeContainer": {"#": "iframeContainer"}, 58 "_iframeContainer": {"#": "iframeContainer"},
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 8382135d..1ea14d64 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -224,14 +224,6 @@ exports.Stage = Montage.create(Component, {
224 // Event details will contain the active document prior to opening a new one 224 // Event details will contain the active document prior to opening a new one
225 handleOpenDocument: { 225 handleOpenDocument: {
226 value: function(evt) { 226 value: function(evt) {
227
228 var prevActiveDocument = evt.detail;
229 // Hide current document is one is open
230 if(prevActiveDocument) {
231 prevActiveDocument.container.style["display"] = "none";
232 if(prevActiveDocument.documentType === "htm" || prevActiveDocument.documentType === "html") this.hideCanvas(true);
233 }
234
235 this.hideCanvas(false); 227 this.hideCanvas(false);
236 228
237 // Recalculate the canvas sizes because of splitter resizing 229 // Recalculate the canvas sizes because of splitter resizing
@@ -254,7 +246,11 @@ exports.Stage = Montage.create(Component, {
254 246
255 // Hardcode this value so that it does not fail for the new stage architecture 247 // Hardcode this value so that it does not fail for the new stage architecture
256 // TODO: Remove marker for old template: NINJA-STAGE-REWORK 248 // TODO: Remove marker for old template: NINJA-STAGE-REWORK
257 this.userContentBorder = 1; //parseInt(this._documentRoot.elementModel.controller.getProperty(this._documentRoot, "border")); 249 if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") {
250 this.userContentBorder = 1; //parseInt(this._documentRoot.elementModel.controller.getProperty(this._documentRoot, "border"));
251 } else {
252 this.userContentBorder = 0;
253 }
258 254
259 this._userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; 255 this._userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder;
260 this._userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; 256 this._userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder;
@@ -521,62 +517,59 @@ exports.Stage = Montage.create(Component, {
521 }, 517 },
522 518
523 /** 519 /**
524 * GetSelectableElement: Returns a selectable object (direct child of current container) at clicked point 520 * GetElement: Returns the element or selectable element under the X,Y coordinates passed as an obj with x,y
525 * 521 *
526 * @param: X,Y 522 * @param position: mouse event
527 * @return: Returns the current container if the the X,Y hits an element in the exclusion list 523 * @param selectable (default == null) if true this will return the current container element
524 * @return: Returns the element or container or null if the the X,Y hits the exclusion list and tool cannot operate on stage
528 */ 525 */
529 GetSelectableElement: { 526 getElement: {
530 value: function(pos) { 527 value: function(position, selectable) {
531 var item = this.GetElement(pos); 528 var point, element;
532 if(this.application.ninja.currentDocument.inExclusion(item) !== -1) { 529
533 return this.application.ninja.currentSelectedContainer; 530 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY));
531 element = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop);
532
533 // workaround Chrome 3d bug
534 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) {
535 element = this.getElementUsingSnapping(point);
534 } 536 }
535 var activeContainerId = this.application.ninja.currentSelectedContainer.uuid;
536 if(item.parentNode.uuid === activeContainerId) {
537 return item;
538 } else {
539 var outerElement = item.parentNode;
540 537
541 while(outerElement.parentNode && outerElement.parentNode.uuid !== activeContainerId) { 538 if(selectable) {
542 // If element is higher up than current container then return 539
543 if(outerElement.id === "UserContent") return; 540 if(this.application.ninja.currentDocument.inExclusion(element) !== -1) {
544 // else keep going up the chain 541 return this.application.ninja.currentSelectedContainer;
545 outerElement = outerElement.parentNode;
546 } 542 }
547 543
548 return outerElement; 544 var activeContainerId = this.application.ninja.currentSelectedContainer.uuid;
549 } 545 if(element.parentNode.uuid === activeContainerId) {
550 } 546 return element;
551 }, 547 } else {
548 var outerElement = element.parentNode;
552 549
553 /** 550 while(outerElement.parentNode && outerElement.parentNode.uuid !== activeContainerId) {
554 * GetElement: Returns the object under the X,Y coordinates passed as an obj with x,y 551 // If element is higher up than current container then return
555 * 552 if(outerElement.id === "UserContent") return;
556 * @param: X,Y 553 // else keep going up the chain
557 * @return: Returns the Object or null if the the X,Y hits the exclusion list and tool cannot operate on stage 554 outerElement = outerElement.parentNode;
558 */ 555 }
559 GetElement: { 556
560 value: function(pos) { 557 return outerElement;
561 var point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(pos.pageX, pos.pageY)), 558 }
562 elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop);
563 559
564 // workaround Chrome 3d bug
565 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(elt) !== -1) {
566 return this._getElementUsingSnapping(point);
567 } else { 560 } else {
568 return elt; 561 return element;
569 } 562 }
570 } 563 }
571 }, 564 },
572 565
573 /** 566 /**
574 * _getElementUsingSnapping: Returns the object at point using snap manager 567 * getElementUsingSnapping: Returns the object at point using snap manager
575 * 568 *
576 * @param: point 569 * @param: point
577 * @return: Returns the Object in the user document under the point 570 * @return: Returns the Object in the user document under the point
578 */ 571 */
579 _getElementUsingSnapping: { 572 getElementUsingSnapping: {
580 value: function(point) { 573 value: function(point) {
581 this.stageDeps.snapManager.enableElementSnap( true ); 574 this.stageDeps.snapManager.enableElementSnap( true );
582 var hitRec = this.stageDeps.snapManager.snap(point.x, point.y, true); 575 var hitRec = this.stageDeps.snapManager.snap(point.x, point.y, true);
diff --git a/js/stage/tool-handle.js b/js/stage/tool-handle.js
index d353da47..63cf30e5 100755
--- a/js/stage/tool-handle.js
+++ b/js/stage/tool-handle.j