aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js2
-rwxr-xr-xjs/controllers/document-controller.js4
-rwxr-xr-xjs/controllers/styles-controller.js2
-rwxr-xr-xjs/document/templates/montage-web/index.html5
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.css29
-rwxr-xr-xjs/stage/stage.reel/stage.js24
-rwxr-xr-xjs/tools/PanTool.js66
7 files changed, 83 insertions, 49 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index e396bdbf..c1b021a3 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -23,7 +23,7 @@ exports.Breadcrumb = Montage.create(Component, {
23 value: function(){ 23 value: function(){
24 if(!this.application.ninja.documentController.activeDocument) { 24 if(!this.application.ninja.documentController.activeDocument) {
25 this.disabled = true; 25 this.disabled = true;
26 this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; 26 this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.documentRoot : null);
27 } 27 }
28 } 28 }
29 }, 29 },
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index ed4d33eb..17ae8cc3 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -440,10 +440,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
440 440
441 closeDocument: { 441 closeDocument: {
442 value: function(id) { 442 value: function(id) {
443 if(this.activeDocument.needsSave === true){
444 //if file dirty then alert user to save
445 }
446
447 var doc = this._findDocumentByUUID(id); 443 var doc = this._findDocumentByUUID(id);
448 444
449 var closeDocumentIndex = this._findIndexByUUID(id); 445 var closeDocumentIndex = this._findIndexByUUID(id);
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js
index ec4314f9..647c0870 100755
--- a/js/controllers/styles-controller.js
+++ b/js/controllers/styles-controller.js
@@ -1102,7 +1102,7 @@ var stylesController = exports.StylesController = Montage.create(Component, {
1102 ///// The dominant rule might not have the style property defined - why? 1102 ///// The dominant rule might not have the style property defined - why?
1103 ///// If no rules have the property defined, we can use the 1103 ///// If no rules have the property defined, we can use the
1104 ///// most-specific single-target rule as the dominant rule (for setting styles) 1104 ///// most-specific single-target rule as the dominant rule (for setting styles)
1105 return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property); 1105 return (element.ownerDocument.defaultView ? element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property) : null);
1106 } 1106 }
1107 1107
1108 return value; 1108 return value;
diff --git a/js/document/templates/montage-web/index.html b/js/document/templates/montage-web/index.html
index 3d550768..e02d8d8e 100755
--- a/js/document/templates/montage-web/index.html
+++ b/js/document/templates/montage-web/index.html
@@ -33,6 +33,11 @@
33 -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); 33 -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
34 } 34 }
35 35
36 html {
37 overflow: scroll;
38 padding: 0 11px 11px 0;
39 }
40
36 html, body { 41 html, body {
37 width: 100%; 42 width: 100%;
38 height: 100%; 43 height: 100%;
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
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js
index ce7606a1..132ac0b1 100755
--- a/js/tools/PanTool.js
+++ b/js/tools/PanTool.js
@@ -21,6 +21,9 @@ exports.PanTool = Montage.create(toolBase,
21 _lastGPt :{value: [0,0], writable:true}, 21 _lastGPt :{value: [0,0], writable:true},
22 _lastY :{value: 0, writable:true}, 22 _lastY :{value: 0, writable:true},
23 23
24 _maxHorizontalScroll: {value: 0, writable:true},
25 _maxVerticalScroll: {value: 0, writable:true},
26
24 Configure: { 27 Configure: {
25 value: function ( doActivate ) 28 value: function ( doActivate )
26 { 29 {
@@ -43,10 +46,19 @@ exports.PanTool = Montage.create(toolBase,
43 46
44 HandleLeftButtonDown: { 47 HandleLeftButtonDown: {
45 value : function ( event ) { 48 value : function ( event ) {
46 this._isDrawing = true; 49 // Determine the maximum horizontal and vertical scroll values
47 this.isDrawing = true; 50 this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11;
48 51 this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11;
49 this.mouseDown( event ); 52 if((this._maxHorizontalScroll > 0) || (this._maxVerticalScroll > 0) || this._altKeyDown)
53 {
54 this._isDrawing = true;
55 this.isDrawing = true;
56 this.mouseDown( event );
57 }
58// else
59// {
60// console.log("nothing to scroll");
61// }
50 } 62 }