aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-08 17:34:04 -0700
committerJose Antonio Marquez2012-05-08 17:34:04 -0700
commitef1daccfad5381badd53b9d045c2687f9b0e090d (patch)
tree1eaf6ce286968cd8fe6b16e5991597ae16084658
parenta1e8540f5656e62db6a89f3af7829be6b259b7ed (diff)
parentd55b7418119c380241f6a2788ff8c84fcd44e143 (diff)
downloadninja-ef1daccfad5381badd53b9d045c2687f9b0e090d.tar.gz
Merge branch 'refs/heads/Ninja-DOM-Architecture' into Document
-rwxr-xr-xcss/ninja.css8
-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
-rw-r--r--scss/imports/scss/_Stage.scss27
9 files changed, 83 insertions, 84 deletions
diff --git a/css/ninja.css b/css/ninja.css
index 6a804e99..cd7a35ab 100755
--- a/css/ninja.css
+++ b/css/ninja.css
@@ -204,14 +204,6 @@ body { position: absolute; margin: 0px; width: 100%; height: 100%; background-co
204 204
205.layoutCanvas { position: absolute; margin: 0px; border: none; padding: 0px; top: 0px; left: 0px; z-index: 4; } 205.layoutCanvas { position: absolute; margin: 0px; border: none; padding: 0px; top: 0px; left: 0px; z-index: 4; }
206 206
207#codeViewContainer { position: absolute; top: 0px; left: 0px; margin: 0px; padding: 0px; background: black; width: 100%; height: 100%; display: none; }
208
209#mainContent #codeMirror_1 { height: 100%; }
210
211#mainContent .CodeMirror { width: 100%; height: 100%; background: white; }
212
213#mainContent .CodeMirror-scroll { height: 100%; overflow: auto; }
214
215.montage-editor-frame { position: absolute; z-index: 7; top: 0; left: 0; display: none; -webkit-user-select: initial; } 207.montage-editor-frame { position: absolute; z-index: 7; top: 0; left: 0; display: none; -webkit-user-select: initial; }
216 208
217.montage-editor { padding: 0px; word-wrap: normal; } 209.montage-editor { padding: 0px; word-wrap: normal; }
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: {