aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.css29
-rwxr-xr-xjs/stage/stage.reel/stage.js24
2 files changed, 29 insertions, 24 deletions
diff --git a/js/stage/stage-view.reel/stage-view.css b/js/stage/stage-view.reel/stage-view.css
index e2c4bb0e..8afb52a2 100755
--- a/js/stage/stage-view.reel/stage-view.css
+++ b/js/stage/stage-view.reel/stage-view.css
@@ -17,29 +17,20 @@
17 cursor:text; 17 cursor:text;
18} 18}
19 19
20.codeViewContainer>div{ 20.codeViewContainer .CodeMirror {
21 width:2500px;/*to prevent scrolling of editor container in the middle of the page for short files*/ 21 width: 100%;
22 height: 100%;
23 background: white;
22} 24}
23 25
24/* OLD CSS for reference 26.codeViewContainer .CodeMirror-scroll {
25#mainContent #codeMirror_1 { 27 height: 100%;
26 height:100%; 28 overflow: auto;
27} 29}
28*/
29
30/*.CodeMirror {*/
31 /*width: 100%;*/
32 /*height: 100%;*/
33 /*background: white;*/
34/*}*/
35
36/*.CodeMirror .CodeMirror-scroll {*/
37 /*height: 100%;*/
38 /*overflow: scroll;*/
39 /*overflow-x: auto;*/
40 /*overflow-y: auto;*/
41/*}*/
42 30
31.codeViewContainer>div{
32 width:2500px;/*to prevent scrolling of editor container in the middle of the page for short files*/
33}
43 34
44span.CodeMirror-matchhighlight { background: #e9e9e9 } 35span.CodeMirror-matchhighlight { background: #e9e9e9 }
45.CodeMirror-focused span.CodeMirror-matchhighlight { background: #e7e4ff; !important } 36.CodeMirror-focused span.CodeMirror-matchhighlight { background: #e7e4ff; !important }
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 171c4f36..dc6444ff 100755
--- a/js/stage/stage.reel/stage.js
+++ b/js/stage/stage.reel/stage.js
@@ -118,6 +118,9 @@ exports.Stage = Montage.create(Component, {
118 _userContentTop: { value: 0 }, 118 _userContentTop: { value: 0 },
119 _userContentBorder: { value: 0 }, 119 _userContentBorder: { value: 0 },
120 120
121 _maxHorizontalScroll: { value: 0 },
122 _maxVerticalScroll: { value: 0 },
123
121 documentRoot: { 124 documentRoot: {
122 get: function () { return this._documentRoot; }, 125 get: function () { return this._documentRoot; },
123 set: function(value) { this._documentRoot = value; } 126 set: function(value) { this._documentRoot = value; }
@@ -264,7 +267,9 @@ exports.Stage = Montage.create(Component, {
264 this._userContentLeft = 0; 267 this._userContentLeft = 0;
265 this._userContentTop = 0; 268 this._userContentTop = 0;
266 269
267 //this.application.ninja.currentDocument._window.addEventListener("scroll", this, false); 270 this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11;
271 this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11;
272 this.application.ninja.currentDocument.model.views.design.iframe.contentWindow.addEventListener("scroll", this, false);
268 } 273 }
269 274
270 275
@@ -464,6 +469,12 @@ exports.Stage = Montage.create(Component, {
464 469
465 this.userContentLeft = -this._scrollLeft; 470 this.userContentLeft = -this._scrollLeft;
466 this.userContentTop = -this._scrollTop; 471 this.userContentTop = -this._scrollTop;
472
473 // TODO - scroll events are not dependable. We may need to use a timer to simulate
474 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values
475 // on mouse down.
476// this._maxHorizontalScroll = this._documentRoot.scrollWidth - this._canvas.width - 11;
477// this._maxVerticalScroll = this._documentRoot.scrollHeight - this._canvas.height - 11;
467 } 478 }
468 479
469 // Need to clear the snap cache and set up the drag plane 480 // Need to clear the snap cache and set up the drag plane
@@ -540,13 +551,16 @@ exports.Stage = Montage.create(Component, {
540 */ 551 */
541 getElement: { 552 getElement: {
542 value: function(position, selectable) { 553 value: function(position, selectable) {
543 var point, element; 554 var point, element,
555 docView = this.application.ninja.currentDocument.model.views.design;
544 556
545 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); 557 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset, position.pageY - docView.iframe.contentWindow.pageYOffset));
546 element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); 558 element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop);
547 559
560 if(!element) debugger;
548 // workaround Chrome 3d bug 561 // workaround Chrome 3d bug
549 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) { 562 if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) {
563 point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY));
550 element = this.getElementUsingSnapping(point); 564 element = this.getElementUsingSnapping(point);
551 } 565 }
552 566
@@ -877,7 +891,7 @@ exports.Stage = Montage.create(Component, {
877 //TODO - Maybe move to mediator. 891 //TODO - Maybe move to mediator.
878 var newVal = value/100.0; 892 var newVal = value/100.0;
879 if (newVal >= 1) 893 if (newVal >= 1)
880 this.application.ninja.currentDocument.iframe.style.zoom = value/100; 894 this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = value/100;
881 895
882 this.updatedStage = true; 896 this.updatedStage = true;
883 897