diff options
Diffstat (limited to 'js/stage/stage.reel')
-rwxr-xr-x | js/stage/stage.reel/stage.css | 13 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.html | 12 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 82 |
3 files changed, 90 insertions, 17 deletions
diff --git a/js/stage/stage.reel/stage.css b/js/stage/stage.reel/stage.css index 13537ba1..2c2e30d3 100755 --- a/js/stage/stage.reel/stage.css +++ b/js/stage/stage.reel/stage.css | |||
@@ -12,6 +12,16 @@ | |||
12 | overflow: hidden; | 12 | overflow: hidden; |
13 | } | 13 | } |
14 | 14 | ||
15 | .montage-editor-container { | ||
16 | z-index: 8; | ||
17 | display: none; | ||
18 | position: absolute; | ||
19 | } | ||
20 | |||
21 | .stageAndScenesContainer .montage-editor { | ||
22 | -webkit-user-select:text; | ||
23 | } | ||
24 | |||
15 | .codeViewContainer { | 25 | .codeViewContainer { |
16 | position: absolute; | 26 | position: absolute; |
17 | top: 0px; | 27 | top: 0px; |
@@ -55,4 +65,5 @@ div.CodeMirror span.CodeMirror-matchingbracket {color: #000 !important;backgroun | |||
55 | .cm-s-monokai .activeline {background: #8da6ce; !important} | 65 | .cm-s-monokai .activeline {background: #8da6ce; !important} |
56 | .cm-s-rubyblue .activeline {background: #3E7087; !important} | 66 | .cm-s-rubyblue .activeline {background: #3E7087; !important} |
57 | .cm-s-lesser-dark .activeline {background: #8da6ce; !important} | 67 | .cm-s-lesser-dark .activeline {background: #8da6ce; !important} |
58 | .cm-s-xq-dark .activeline {background: #8da6ce; !important} \ No newline at end of file | 68 | .cm-s-xq-dark .activeline {background: #8da6ce; !important} |
69 | |||
diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html index 2ed596f3..215f8f2e 100755 --- a/js/stage/stage.reel/stage.html +++ b/js/stage/stage.reel/stage.html | |||
@@ -40,7 +40,13 @@ | |||
40 | "focusManager": { | 40 | "focusManager": { |
41 | "object": "js/components/focus-manager.reel" | 41 | "object": "js/components/focus-manager.reel" |
42 | }, | 42 | }, |
43 | 43 | ||
44 | "bindingView": { | ||
45 | "prototype": "js/stage/binding-view.reel", | ||
46 | "properties" : { | ||
47 | "element": {"#": "bindingView" } | ||
48 | } | ||
49 | }, | ||
44 | "owner": { | 50 | "owner": { |
45 | "prototype": "js/stage/stage.reel", | 51 | "prototype": "js/stage/stage.reel", |
46 | "properties": { | 52 | "properties": { |
@@ -53,7 +59,8 @@ | |||
53 | "stageDeps": {"@": "stageDeps"}, | 59 | "stageDeps": {"@": "stageDeps"}, |
54 | "layout": {"@": "layout"}, | 60 | "layout": {"@": "layout"}, |
55 | "textTool": {"@": "textTool"}, | 61 | "textTool": {"@": "textTool"}, |
56 | "focusManager": {"@": "focusManager"} | 62 | "focusManager": {"@": "focusManager"}, |
63 | "bindingView": {"@": "bindingView"} | ||
57 | }, | 64 | }, |
58 | "bindings": { | 65 | "bindings": { |
59 | "currentDocumentStageView": { | 66 | "currentDocumentStageView": { |
@@ -77,6 +84,7 @@ | |||
77 | <canvas data-montage-id="layoutCanvas" class="layoutCanvas"></canvas> | 84 | <canvas data-montage-id="layoutCanvas" class="layoutCanvas"></canvas> |
78 | <canvas data-montage-id="stageCanvas" class="stageCanvas"></canvas> | 85 | <canvas data-montage-id="stageCanvas" class="stageCanvas"></canvas> |
79 | <canvas data-montage-id="drawingCanvas" class="drawingCanvas"></canvas> | 86 | <canvas data-montage-id="drawingCanvas" class="drawingCanvas"></canvas> |
87 | <section data-montage-id="bindingView"></section> | ||
80 | </section> | 88 | </section> |
81 | 89 | ||
82 | </body> | 90 | </body> |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index f4de3070..8cbe3210 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -19,6 +19,7 @@ exports.Stage = Montage.create(Component, { | |||
19 | // TODO - Need to figure out how to remove this dependency | 19 | // TODO - Need to figure out how to remove this dependency |
20 | // Needed by some tools that depend on selectionDrawn event to set up some logic | 20 | // Needed by some tools that depend on selectionDrawn event to set up some logic |
21 | drawNow: { value : false }, | 21 | drawNow: { value : false }, |
22 | switchedFromCodeDoc: { value : false }, | ||
22 | 23 | ||
23 | // TO REVIEW | 24 | // TO REVIEW |
24 | zoomFactor: {value : 1 }, | 25 | zoomFactor: {value : 1 }, |
@@ -26,6 +27,9 @@ exports.Stage = Montage.create(Component, { | |||
26 | _canvasSelectionPrefs: { value: { "thickness" : 1.0, "color" : "#46a1ff" } }, | 27 | _canvasSelectionPrefs: { value: { "thickness" : 1.0, "color" : "#46a1ff" } }, |
27 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, | 28 | _canvasDrawingPrefs: { value: { "thickness" : 1.0, "color" : "#000" } }, |
28 | drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, | 29 | drawingContextPreferences: { get: function() { return this._canvasDrawingPrefs; } }, |
30 | bindingView: { | ||
31 | value: null | ||
32 | }, | ||
29 | 33 | ||
30 | _iframeContainer: { | 34 | _iframeContainer: { |
31 | value: null, | 35 | value: null, |
@@ -249,9 +253,15 @@ exports.Stage = Montage.create(Component, { | |||
249 | this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; | 253 | this.currentDocument.model.documentOffsetTop = this._documentOffsetTop; |
250 | this.currentDocument.model.userContentLeft = this._userContentLeft; | 254 | this.currentDocument.model.userContentLeft = this._userContentLeft; |
251 | this.currentDocument.model.userContentTop = this._userContentTop; | 255 | this.currentDocument.model.userContentTop = this._userContentTop; |
256 | this.currentDocument.model.templateLeft = this.templateLeft; | ||
257 | this.currentDocument.model.templateTop = this.templateTop; | ||
258 | this.currentDocument.model.minLeftElement = this.minLeftElement; | ||
259 | this.currentDocument.model.minTopElement = this.minTopElement; | ||
252 | 260 | ||
253 | //call configure false with the old document on the selected tool to tear down down any temp. stuff | 261 | //call configure false with the old document on the selected tool to tear down down any temp. stuff |
254 | this.application.ninja.toolsData.selectedToolInstance._configure(false); | 262 | this.application.ninja.toolsData.selectedToolInstance._configure(false); |
263 | } else if(this.currentDocument && (this.currentDocument.currentView === "code")) { | ||
264 | this.switchedFromCodeDoc = true; // Switching from code document affects stage's size and scrollbar | ||
255 | } | 265 | } |
256 | 266 | ||
257 | this._currentDocument = value; | 267 | this._currentDocument = value; |
@@ -262,7 +272,8 @@ exports.Stage = Montage.create(Component, { | |||
262 | drawUtils._eltArray.length = 0; | 272 | drawUtils._eltArray.length = 0; |
263 | drawUtils._planesArray.length = 0; | 273 | drawUtils._planesArray.length = 0; |
264 | } else if(this._currentDocument.currentView === "design") { | 274 | } else if(this._currentDocument.currentView === "design") { |
265 | this.restoreAllPanels(); | 275 | this.restoreAllPanels(this.switchedFromCodeDoc); |
276 | this.switchedFromCodeDoc = false; | ||
266 | this.hideCanvas(false); | 277 | this.hideCanvas(false); |
267 | this.showRulers(); | 278 | this.showRulers(); |
268 | 279 | ||
@@ -279,6 +290,13 @@ exports.Stage = Montage.create(Component, { | |||
279 | _userPaddingLeft: { value: 0 }, | 290 | _userPaddingLeft: { value: 0 }, |
280 | _userPaddingTop: { value: 0 }, | 291 | _userPaddingTop: { value: 0 }, |
281 | 292 | ||
293 | templateLeft: { value: 0 }, | ||
294 | templateTop: { value: 0 }, | ||
295 | |||
296 | // keep track of the elements that determine the minimum left and top scrollable amount | ||
297 | minLeftElement: { value: null }, | ||
298 | minTopElement: { value: null }, | ||
299 | |||
282 | userPaddingLeft: { | 300 | userPaddingLeft: { |
283 | get: function() { return this._userPaddingLeft; }, | 301 | get: function() { return this._userPaddingLeft; }, |
284 | set: function(value) { | 302 | set: function(value) { |
@@ -305,9 +323,8 @@ exports.Stage = Montage.create(Component, { | |||
305 | value: function() { | 323 | value: function() { |
306 | if(this.resizeCanvases) { | 324 | if(this.resizeCanvases) { |
307 | // TODO GET THE SCROLL SIZE FROM THE CSS -- 11 px | 325 | // TODO GET THE SCROLL SIZE FROM THE CSS -- 11 px |
308 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.element.offsetWidth - 11 ; | 326 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.bindingView.width = this.element.offsetWidth - 11; |
309 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.element.offsetHeight - 11;// - 26 - 26; | 327 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.bindingView.height = this.element.offsetHeight - 11;// - 26 - 26; |
310 | |||
311 | // Hack for now until a full component | 328 | // Hack for now until a full component |
312 | this.layout.draw(); | 329 | this.layout.draw(); |
313 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { | 330 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { |
@@ -343,8 +360,6 @@ exports.Stage = Montage.create(Component, { | |||
343 | // Hide the canvas | 360 | // Hide the canvas |
344 | this.hideCanvas(true); | 361 | this.hideCanvas(true); |
345 | 362 | ||
346 | this.eventManager.addEventListener( "appMouseUp", this, false); | ||
347 | |||
348 | this.eventManager.addEventListener( "enableStageMove", this, false); | 363 | this.eventManager.addEventListener( "enableStageMove", this, false); |
349 | this.eventManager.addEventListener( "disableStageMove", this, false); | 364 | this.eventManager.addEventListener( "disableStageMove", this, false); |
350 | 365 | ||
@@ -374,6 +389,10 @@ exports.Stage = Montage.create(Component, { | |||
374 | this._userContentTop = this.currentDocument.model.userContentTop; | 389 | this._userContentTop = this.currentDocument.model.userContentTop; |
375 | this._scrollLeft = this.currentDocument.model.scrollLeft; | 390 | this._scrollLeft = this.currentDocument.model.scrollLeft; |
376 | this._scrollTop = this.currentDocument.model.scrollTop; | 391 | this._scrollTop = this.currentDocument.model.scrollTop; |
392 | this.templateLeft = this.currentDocument.model.templateLeft; | ||
393 | this.templateTop = this.currentDocument.model.templateTop; | ||
394 | this.minLeftElement = this.currentDocument.model.minLeftElement; | ||
395 | this.minTopElement = this.currentDocument.model.minTopElement; | ||
377 | } else { | 396 | } else { |
378 | this._userPaddingLeft = 0; | 397 | this._userPaddingLeft = 0; |
379 | this._userPaddingTop = 0; | 398 | this._userPaddingTop = 0; |
@@ -383,11 +402,15 @@ exports.Stage = Montage.create(Component, { | |||
383 | this._userContentTop = 0; | 402 | this._userContentTop = 0; |
384 | this._scrollLeft = 0; | 403 | this._scrollLeft = 0; |
385 | this._scrollTop = 0; | 404 | this._scrollTop = 0; |
405 | this.templateLeft = 0; | ||
406 | this.templateTop = 0; | ||
407 | this.minLeftElement = null; | ||
408 | this.minTopElement = null; | ||
386 | } | 409 | } |
387 | 410 | ||
388 | // Recalculate the canvas sizes because of splitter resizing | 411 | // Recalculate the canvas sizes because of splitter resizing |
389 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.element.offsetWidth - 11 ; | 412 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.bindingView.width = this.element.offsetWidth - 11 ; |
390 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.element.offsetHeight - 11; | 413 | this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.bindingView.height = this.element.offsetHeight - 11; |
391 | 414 | ||
392 | designView.iframe.contentWindow.addEventListener("scroll", this, false); | 415 | designView.iframe.contentWindow.addEventListener("scroll", this, false); |
393 | 416 | ||
@@ -400,9 +423,11 @@ exports.Stage = Montage.create(Component, { | |||
400 | var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); | 423 | var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); |
401 | if(initialLeft > this.documentOffsetLeft) { | 424 | if(initialLeft > this.documentOffsetLeft) { |
402 | this.userPaddingLeft = -initialLeft; | 425 | this.userPaddingLeft = -initialLeft; |
426 | this.templateLeft = -initialLeft; | ||
403 | } | 427 | } |
404 | if(initialTop > this.documentOffsetTop) { | 428 | if(initialTop > this.documentOffsetTop) { |
405 | this.userPaddingTop = -initialTop; | 429 | this.userPaddingTop = -initialTop; |
430 | this.templateTop = -initialTop; | ||
406 | } | 431 | } |
407 | } | 432 | } |
408 | 433 | ||
@@ -454,6 +479,7 @@ exports.Stage = Montage.create(Component, { | |||
454 | 479 | ||
455 | enableMouseInOut: { | 480 | enableMouseInOut: { |
456 | value: function() { | 481 | value: function() { |
482 | document.addEventListener("mouseup", this, true); | ||
457 |