diff options
author | Valerio Virgillito | 2012-05-30 10:33:16 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-30 10:33:16 -0700 |
commit | 0c2f181ca565f9c3b68fcfdc7124416e2e2fa647 (patch) | |
tree | f6d5300c528a69305abd30ffea1beee016241375 | |
parent | 31b094ee21102f99a4021d505bc3a28527c9e23d (diff) | |
parent | d4f2df2a7b3ec79fc54e17f09195dbc37331f051 (diff) | |
download | ninja-0c2f181ca565f9c3b68fcfdc7124416e2e2fa647.tar.gz |
Merge branch 'Dom-Architecture' of github.com:mqg734/ninja-internal into document-bindings-fix
Conflicts:
js/stage/stage-deps.js
js/stage/stage.reel/stage.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-x | js/controllers/elements/element-controller.js | 23 | ||||
-rwxr-xr-x | js/controllers/styles-controller.js | 5 | ||||
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 11 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 5 | ||||
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 15 | ||||
-rwxr-xr-x | js/stage/layout.js | 13 | ||||
-rwxr-xr-x | js/stage/stage-deps.js | 16 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.html | 2 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 48 | ||||
-rw-r--r-- | scss/imports/scss/_Stage.scss | 14 |
10 files changed, 99 insertions, 53 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 20225c61..7bb07976 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -159,8 +159,6 @@ exports.ElementController = Montage.create(Component, { | |||
159 | el.elementModel.stroke = null; | 159 | el.elementModel.stroke = null; |
160 | return; | 160 | return; |
161 | case 'gradient': | 161 | case 'gradient': |
162 | this.setProperty(el, "border-image", color.color.css); | ||
163 | this.setProperty(el, "border-color", "none"); | ||
164 | if(color.borderInfo) { | 162 | if(color.borderInfo) { |
165 | if(color.borderInfo.borderWidth) { | 163 | if(color.borderInfo.borderWidth) { |
166 | this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); | 164 | this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); |
@@ -169,9 +167,11 @@ exports.ElementController = Montage.create(Component, { | |||
169 | this.setProperty(el, "border-style", color.borderInfo.borderStyle); | 167 | this.setProperty(el, "border-style", color.borderInfo.borderStyle); |
170 | } | 168 | } |
171 | } | 169 | } |
170 | this.setGradientBorder(el, color.color.gradientMode, color.color.css); | ||
172 | break; | 171 | break; |
173 | default: | 172 | default: |
174 | this.setProperty(el, "border-image", "none"); | 173 | this.setProperty(el, "border-image", "none"); |
174 | this.setProperty(el, "border-image-slice", ""); | ||
175 | this.setProperty(el, "border-color", color.color.css); | 175 | this.setProperty(el, "border-color", color.color.css); |
176 | if(color.borderInfo) { | 176 | if(color.borderInfo) { |
177 | if(color.borderInfo.borderWidth) { | 177 | if(color.borderInfo.borderWidth) { |
@@ -188,6 +188,25 @@ exports.ElementController = Montage.create(Component, { | |||
188 | } | 188 | } |
189 | }, | 189 | }, |
190 | 190 | ||
191 | setGradientBorder: { | ||
192 | value: function(el, gradientMode, css) { | ||
193 | if(gradientMode === "radial") { | ||
194 | this.setProperty(el, "border-image", css.replace("ellipse", "circle")); | ||
195 | } else { | ||
196 | this.setProperty(el, "border-image", css); | ||
197 | } | ||
198 | this.setProperty(el, "border-color", "none"); | ||
199 | // gradient slice = borderWidth/totalWidth | ||
200 | var b = parseInt(this.getProperty(el, "border-left-width", true)), | ||
201 | w = parseInt(this.getProperty(el, "width", true)), | ||
202 | h = parseInt(this.getProperty(el, "height", true)); | ||
203 | if(h > w) { | ||
204 | w = h; | ||
205 | } | ||
206 | this.setProperty(el, "border-image-slice", Math.floor(b/(w+b+b) * 100) + "%"); | ||
207 | } | ||
208 | }, | ||
209 | |||
191 | getStroke: { | 210 | getStroke: { |
192 | value: function(el) { | 211 | value: function(el) { |
193 | // TODO - Need to figure out which border side user wants | 212 | // TODO - Need to figure out which border side user wants |
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 217a536d..f35a6757 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -1261,9 +1261,10 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1261 | } | 1261 | } |
1262 | } | 1262 | } |
1263 | if(isNaN(dist)) { | 1263 | if(isNaN(dist)) { |
1264 | dist = null; | 1264 | return "none"; |
1265 | } else { | ||
1266 | return dist; | ||
1265 | } | 1267 | } |
1266 | return dist; | ||
1267 | } | 1268 | } |
1268 | }, | 1269 | }, |
1269 | 1270 | ||
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 871b832d..c98ad8bc 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -126,7 +126,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
126 | //initialize with current document | 126 | //initialize with current document |
127 | this._eltArray = []; | 127 | this._eltArray = []; |
128 | this._planesArray = []; | 128 | this._planesArray = []; |
129 | this.setDrawingSurfaceElement(stage.canvas); | 129 | this.setDrawingSurfaceElement(stage.gridCanvas); |
130 | this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); | 130 | this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); |
131 | this.setWorkingPlane( [0,0,1,0] ); | 131 | this.setWorkingPlane( [0,0,1,0] ); |
132 | 132 | ||
@@ -276,8 +276,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
276 | stage = this.application.ninja.stage, | 276 | stage = this.application.ninja.stage, |
277 | minLeft = stage.userPaddingLeft, | 277 | minLeft = stage.userPaddingLeft, |
278 | minTop = stage.userPaddingTop, | 278 | minTop = stage.userPaddingTop, |
279 | docLeft = stage.documentOffsetLeft, | 279 | docLeft = stage.userContentLeft, |
280 | docTop = stage.documentOffsetTop, | 280 | docTop = stage.userContentTop, |
281 | l, | 281 | l, |
282 | t, | 282 | t, |
283 | plane, | 283 | plane, |
@@ -307,7 +307,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
307 | } | 307 | } |
308 | 308 | ||
309 | if(!changed) { | 309 | if(!changed) { |
310 | stage.layout.draw(); | ||
311 | this.drawWorkingPlane(); | 310 | this.drawWorkingPlane(); |
312 | this.draw3DCompass(); | 311 | this.draw3DCompass(); |
313 | } | 312 | } |
@@ -628,11 +627,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
628 | { | 627 | { |
629 | value: function () | 628 | value: function () |
630 | { | 629 | { |
630 | this.application.ninja.stage.clearGridCanvas(); | ||
631 | if (!this.isDrawingGrid()) return; | 631 | if (!this.isDrawingGrid()) return; |
632 | 632 | ||
633 | var saveContext = this.getDrawingSurfaceElement(); | 633 | var saveContext = this.getDrawingSurfaceElement(); |
634 | //this.setDrawingSurfaceElement(window.stageManager.layoutCanvas); | 634 | this.setDrawingSurfaceElement(this.application.ninja.stage.gridCanvas); |
635 | this.setDrawingSurfaceElement(this.application.ninja.stage.layoutCanvas); | ||
636 | 635 | ||
637 | // 3 coordinate axes for the plane | 636 | // 3 coordinate axes for the plane |
638 | var zAxis = [this._workingPlane[0], this._workingPlane[1], this._workingPlane[2]]; | 637 | var zAxis = [this._workingPlane[0], this._workingPlane[1], this._workingPlane[2]]; |
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 069c6022..4dcda24a 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -21,8 +21,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
21 | /////////////////////////////////////////////////////////////////////// | 21 | /////////////////////////////////////////////////////////////////////// |
22 | // Instance variables | 22 | // Instance variables |
23 | /////////////////////////////////////////////////////////////////////// | 23 | /////////////////////////////////////////////////////////////////////// |
24 | drawingCanvas: { value: null, writable: true}, | 24 | |
25 | |||
26 | // we keep a stack of working planes to facilitate working on other planes temporarily | 25 | // we keep a stack of working planes to facilitate working on other planes temporarily |
27 | _workingPlaneStack : { value: [], writable: true }, | 26 | _workingPlaneStack : { value: [], writable: true }, |
28 | 27 | ||
@@ -2124,7 +2123,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
2124 | if (hitRec) | 2123 | if (hitRec) |
2125 | { | 2124 | { |
2126 | var saveContext = drawUtils.getDrawingSurfaceElement(); | 2125 | var saveContext = drawUtils.getDrawingSurfaceElement(); |
2127 | drawUtils.setDrawingSurfaceElement(this.drawingCanvas); | 2126 | drawUtils.setDrawingSurfaceElement(this.application.ninja.stage.drawingCanvas); |
2128 | var context = drawUtils.getDrawingContext(); | 2127 | var context = drawUtils.getDrawingContext(); |
2129 | if (context) | 2128 | if (context) |
2130 | { | 2129 | { |
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index a3d09404..3c7ae6ff 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -195,7 +195,12 @@ exports.ViewUtils = Montage.create(Component, { | |||
195 | 195 | ||
196 | getPerspectiveDistFromElement: { | 196 | getPerspectiveDistFromElement: { |
197 | value: function( elt ) { | 197 | value: function( elt ) { |
198 | return ElementsMediator.getPerspectiveDist(elt); | 198 | var pDist = ElementsMediator.getPerspectiveDist(elt); |
199 | if(pDist === "none") { | ||
200 | return null; | ||
201 | } else { | ||
202 | return pDist; | ||
203 | } | ||
199 | } | 204 | } |
200 | }, | 205 | }, |
201 | 206 | ||
@@ -1320,14 +1325,6 @@ exports.ViewUtils = Montage.create(Component, { | |||
1320 | } | 1325 | } |
1321 | }, | 1326 | }, |
1322 | 1327 | ||
1323 | getCurrentDocument: | ||
1324 | { | ||
1325 | value: function() | ||
1326 | { | ||
1327 | return snapManagerModule.SnapManager.application.ninja.currentDocument; | ||
1328 | } | ||
1329 | }, | ||
1330 | |||
1331 | setStageZoom: { | 1328 | setStageZoom: { |
1332 | value:function( globalPt, zoomFactor ) { | 1329 | value:function( globalPt, zoomFactor ) { |
1333 | var localPt; | 1330 | var localPt; |
diff --git a/js/stage/layout.js b/js/stage/layout.js index 284968e4..71296405 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js | |||
@@ -136,6 +136,10 @@ exports.Layout = Montage.create(Component, { | |||
136 | value: function() { | 136 | value: function() { |
137 | this.clearCanvas(); | 137 | this.clearCanvas(); |
138 | 138 | ||
139 | // TODO Bind the layoutview mode to the current document | ||
140 | // var mode = this.application.ninja.currentDocument.layoutMode; | ||
141 | if(this.layoutView === "layoutOff") return; | ||
142 | |||
139 | var els = this.elementsToDraw.length; | 143 | var els = this.elementsToDraw.length; |
140 | for(var i = 0, el; i < els; i++){ | 144 | fo |