diff options
author | Eric Guzman | 2012-06-11 13:28:42 -0700 |
---|---|---|
committer | Eric Guzman | 2012-06-11 13:28:42 -0700 |
commit | 3a4727ffc350216a434a7c6977b6a23653b77780 (patch) | |
tree | c5dff306f8803c36a16163ba5df1e7f492e762b5 /js/stage/stage.reel | |
parent | d6b46ba496c9c8974ae39bb476aea35bcd1ddaf1 (diff) | |
parent | 337efc667372326ae2f9984d89a47bb151016774 (diff) | |
download | ninja-3a4727ffc350216a434a7c6977b6a23653b77780.tar.gz |
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'js/stage/stage.reel')
-rwxr-xr-x | js/stage/stage.reel/stage.css | 55 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.html | 29 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 178 |
3 files changed, 170 insertions, 92 deletions
diff --git a/js/stage/stage.reel/stage.css b/js/stage/stage.reel/stage.css index 54b9761b..2271cd8a 100755 --- a/js/stage/stage.reel/stage.css +++ b/js/stage/stage.reel/stage.css | |||
@@ -10,4 +10,57 @@ | |||
10 | box-flex: 1; | 10 | box-flex: 1; |
11 | position: relative; | 11 | position: relative; |
12 | overflow: hidden; | 12 | overflow: hidden; |
13 | } \ No newline at end of file | 13 | } |
14 | |||
15 | .montage-editor-container { | ||
16 | z-index: 8; | ||
17 | } | ||
18 | |||
19 | .stageAndScenesContainer .montage-editor { | ||
20 | -webkit-user-select:text; | ||
21 | } | ||
22 | |||
23 | .codeViewContainer { | ||
24 | position: absolute; | ||
25 | top: 0px; | ||
26 | left: 0px; | ||
27 | margin: 0px; | ||
28 | padding: 0px; | ||
29 | background-color: #ffffff; | ||
30 | width: 100%; | ||
31 | height: 100%; | ||
32 | overflow:auto; | ||
33 | cursor:text; | ||
34 | } | ||
35 | |||
36 | .codeViewContainer .CodeMirror { | ||
37 | width: 100%; | ||
38 | height: 100%; | ||
39 | background: white; | ||
40 | } | ||
41 | |||
42 | .codeViewContainer .CodeMirror-scroll { | ||
43 | height: 100%; | ||
44 | overflow: auto; | ||
45 | } | ||
46 | |||
47 | .codeViewContainer>div{ | ||
48 | width:2500px;/*to prevent scrolling of editor container in the middle of the page for short files*/ | ||
49 | } | ||
50 | |||
51 | span.CodeMirror-matchhighlight { background: #e9e9e9 } | ||
52 | .CodeMirror-focused span.CodeMirror-matchhighlight { background: #e7e4ff; !important } | ||
53 | div.CodeMirror span.CodeMirror-matchingbracket {color: #000 !important;background-color: #ffd500;} | ||
54 | .CodeMirror-completions select {background-color:#e8f2ff;border:1px solid #c1c1c1;box-shadow: 8px 8px 8px rgba(0, 0, 0, 0.8);} | ||
55 | .CodeMirror-completions {z-index:6001 !important;} | ||
56 | |||
57 | .cm-s-default .activeline {background: #e8f2ff; !important} | ||
58 | .cm-s-eclipse .activeline {background: #e8f2ff; !important} | ||
59 | .cm-s-elegant .activeline {background: #e8f2ff; !important} | ||
60 | .cm-s-neat .activeline {background: #e8f2ff; !important} | ||
61 | .cm-s-night .activeline {background: #8da6ce; !important} | ||
62 | .cm-s-cobalt .activeline {background: #8da6ce; !important} | ||
63 | .cm-s-monokai .activeline {background: #8da6ce; !important} | ||
64 | .cm-s-rubyblue .activeline {background: #3E7087; !important} | ||
65 | .cm-s-lesser-dark .activeline {background: #8da6ce; !important} | ||
66 | .cm-s-xq-dark .activeline {background: #8da6ce; !important} | ||
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html index 53410382..397af0b6 100755 --- a/js/stage/stage.reel/stage.html +++ b/js/stage/stage.reel/stage.html | |||
@@ -11,37 +11,27 @@ | |||
11 | 11 | ||
12 | <script type="text/montage-serialization"> | 12 | <script type="text/montage-serialization"> |
13 | { | 13 | { |
14 | "stageView" : { | 14 | "stageDeps": { |
15 | "prototype": "js/stage/stage-view.reel", | ||
16 | "properties": { | ||
17 | "element": {"#": "stageView"} | ||
18 | } | ||
19 | }, | ||
20 | |||
21 | "StageDeps1": { | ||
22 | "prototype": "js/stage/stage-deps", | 15 | "prototype": "js/stage/stage-deps", |
23 | "properties": { | 16 | "properties": { |
24 | "stage": {"@": "owner"} | 17 | "stage": {"@": "owner"} |
25 | } | 18 | } |
26 | }, | 19 | }, |
27 | 20 | ||
28 | "layout1": { | 21 | "layout": { |
29 | "prototype": "js/stage/layout", | 22 | "prototype": "js/stage/layout", |
30 | "properties": { | 23 | "properties": { |
31 | "canvas": {"#": "layoutCanvas"}, | 24 | "canvas": {"#": "layoutCanvas"}, |
32 | "stage": {"@": "owner"} | 25 | "stage": {"@": "owner"} |
33 | }, | 26 | }, |
34 | "bindings": { | 27 | "bindings": { |
35 | "layoutView": { | 28 | "layoutView": {"<-": "@owner.appModel.layoutView"}, |
36 | "boundObject": {"@": "owner" }, | 29 | "currentDocument": {"<-": "@owner.currentDocument"} |
37 | "boundObjectPropertyPath": "appModel.layoutView", | ||
38 | "oneway": true | ||
39 | } | ||
40 | } | 30 | } |
41 | }, | 31 | }, |
42 | 32 | ||
43 | "textTool": { | 33 | "textTool": { |
44 | "prototype": "node_modules/labs/rich-text-editor.reel", | 34 | "prototype": "montage/ui/rich-text-editor/rich-text-editor.reel", |
45 | "properties": { | 35 | "properties": { |
46 | "element" : {"#": "textToolObject"} | 36 | "element" : {"#": "textToolObject"} |
47 | } | 37 | } |
@@ -63,11 +53,11 @@ | |||
63 | "element": {"#": "stageAndScenesContainer"}, | 53 | "element": {"#": "stageAndScenesContainer"}, |
64 | "_iframeContainer": {"#": "iframeContainer"}, | 54 | "_iframeContainer": {"#": "iframeContainer"}, |
65 | "_layoutCanvas": {"#": "layoutCanvas"}, | 55 | "_layoutCanvas": {"#": "layoutCanvas"}, |
56 | "_gridCanvas": {"#": "gridCanvas"}, | ||
66 | "_canvas": {"#": "stageCanvas"}, | 57 | "_canvas": {"#": "stageCanvas"}, |
67 | "_drawingCanvas": {"#": "drawingCanvas"}, | 58 | "_drawingCanvas": {"#": "drawingCanvas"}, |
68 | "stageDeps": {"@": "StageDeps1"}, | 59 | "stageDeps": {"@": "stageDeps"}, |
69 | "layout": {"@": "layout1"}, | 60 | "layout": {"@": "layout"}, |
70 | "stageView": {"@": "stageView"}, | ||
71 | "textTool": {"@": "textTool"}, | 61 | "textTool": {"@": "textTool"}, |
72 | "focusManager": {"@": "focusManager"}, | 62 | "focusManager": {"@": "focusManager"}, |
73 | "bindingView": {"@": "bindingView"} | 63 | "bindingView": {"@": "bindingView"} |
@@ -87,9 +77,10 @@ | |||
87 | <body> | 77 | <body> |
88 | 78 | ||
89 | <section data-montage-id="stageAndScenesContainer" class="stageAndScenesContainer"> | 79 | <section data-montage-id="stageAndScenesContainer" class="stageAndScenesContainer"> |
90 | <section data-montage-id="stageView"></section> | 80 | <section id="codeViewContainer" class="codeViewContainer"></section> |
91 | <section data-montage-id="iframeContainer" id="iframeContainer"></section> | 81 | <section data-montage-id="iframeContainer" id="iframeContainer"></section> |
92 | <section data-montage-id="textToolObject"></section> | 82 | <section data-montage-id="textToolObject"></section> |
83 | <canvas data-montage-id="gridCanvas" class="gridCanvas"></canvas> | ||
93 | <canvas data-montage-id="layoutCanvas" class="layoutCanvas"></canvas> | 84 | <canvas data-montage-id="layoutCanvas" class="layoutCanvas"></canvas> |
94 | <canvas data-montage-id="stageCanvas" class="stageCanvas"></canvas> | 85 | <canvas data-montage-id="stageCanvas" class="stageCanvas"></canvas> |
95 | <canvas data-montage-id="drawingCanvas" class="drawingCanvas"></canvas> | 86 | <canvas data-montage-id="drawingCanvas" class="drawingCanvas"></canvas> |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index c7afb95c..30ee1e40 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -97,6 +97,12 @@ exports.Stage = Montage.create(Component, { | |||
97 | _layoutCanvas: { value: null }, | 97 | _layoutCanvas: { value: null }, |
98 | layoutCanvas: { get: function() { return this._layoutCanvas; } }, | 98 | layoutCanvas: { get: function() { return this._layoutCanvas; } }, |
99 | 99 | ||
100 | _gridCanvas: { value: null }, | ||
101 | gridCanvas: { get: function() { return this._gridCanvas; } }, | ||
102 | |||
103 | _gridContext: { value: null }, | ||
104 | gridContext: { get: function() { return this._gridContext; } }, | ||
105 | |||
100 | _drawingCanvas: { value: null }, | 106 | _drawingCanvas: { value: null }, |
101 | drawingCanvas: { get: function() { return this._drawingCanvas; } }, | 107 | drawingCanvas: { get: function() { return this._drawingCanvas; } }, |
102 | 108 | ||
@@ -155,27 +161,51 @@ exports.Stage = Montage.create(Component, { | |||
155 | set: function(value) { this._userContentBorder = value; } | 161 | set: function(value) { this._userContentBorder = value; } |
156 | }, | 162 | }, |
157 | 163 | ||
158 | _activeDocument : { | 164 | _currentDocument: { |
159 | value : null, | 165 | value : null |
160 | enumerable : false | ||
161 | }, | 166 | }, |
162 | 167 | ||
163 | activeDocument : { | 168 | currentDocument : { |
164 | get : function() { | 169 | get : function() { |
165 | return this._activeDocument; | 170 | return this._currentDocument; |
166 | }, | 171 | }, |
167 | set : function(document) { | 172 | set : function(value) { |
168 | ///// If the document is null set default stylesheets to null | 173 | if (value === this._currentDocument) { |
174 | return; | ||
175 | } | ||
176 | |||
177 | if(!this._currentDocument && value.currentView === "design") { | ||
178 | this.showRulers(); | ||
179 | this.hideCanvas(false); | ||
180 | } | ||
169 | 181 | ||
170 | if(!document) { | 182 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { |
171 | return false; | 183 | this.currentDocument.model.scrollLeft = this._scrollLeft; |
184 | this.currentDocument.model.scrollTop = this._scrollTop; | ||
185 | //call configure false with the old document on the selected tool to tear down down any temp. stuff | ||
186 | this.application.ninja.toolsData.selectedToolInstance._configure(false); | ||
172 | } | 187 | } |
173 | 188 | ||
174 | ///// setting document via binding | 189 | this._currentDocument = value; |
175 | this._activeDocument = document; | ||
176 | 190 | ||
177 | }, | 191 | if(!value) { |
178 | enumerable : false | 192 | this.hideRulers(); |
193 | this.hideCanvas(true); | ||
194 | drawUtils._eltArray.length = 0; | ||
195 | drawUtils._planesArray.length = 0; | ||
196 | } else if(this._currentDocument.currentView === "design") { | ||
197 | this.restoreAllPanels(); | ||
198 | this.hideCanvas(false); | ||
199 | this.showRulers(); | ||
200 | |||
201 | this.clearAllCanvas(); | ||
202 | this.initWithDocument(); | ||
203 | } else { | ||
204 | this.collapseAllPanels(); | ||
205 | this.hideCanvas(true); | ||