diff options
author | Nivesh Rajbhandari | 2012-06-22 17:02:55 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-06-22 17:02:55 -0700 |
commit | 11ae8b91c30322074adb3cae753193d0bae3c995 (patch) | |
tree | 0915f8ff9e39f460136fb37f2a553f9b6b4b139d /js/helper-classes | |
parent | 0f62fd5d06af6933530a151126fe054bf1b68419 (diff) | |
download | ninja-11ae8b91c30322074adb3cae753193d0bae3c995.tar.gz |
Make stage transparent when rotating/zooming templates and draw an outline around the user's root instead.
Also, fixed the background color setting on banner and animation templates' "body."
Stage outline draws using drawGridLines code so it can show intersection with element planes.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index bd47ffc3..87151964 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -1185,8 +1185,38 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1185 | var context = this.application.ninja.stage.gridContext; | 1185 | var context = this.application.ninja.stage.gridContext; |
1186 | var stage = this.application.ninja.stage; | 1186 | var stage = this.application.ninja.stage; |
1187 | var stageRoot = this.application.ninja.currentDocument.model.documentRoot; | 1187 | var stageRoot = this.application.ninja.currentDocument.model.documentRoot; |
1188 | var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot); | ||
1189 | 1188 | ||
1189 | // draw an outline around the template body if stage has any transforms | ||
1190 | if(stage.currentDocument.model.views.design._template && !MathUtils.isIdentityMatrix(this.viewUtils.getMatrixFromElement(stageRoot))) { | ||
1191 | var saveContext = this.getDrawingSurfaceElement(); | ||
1192 | this.setDrawingSurfaceElement(this.application.ninja.stage.gridCanvas); | ||
1193 | |||
1194 | var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); | ||
1195 | var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); | ||
1196 | var width = this.snapManager.getStageWidth(), | ||
1197 | height = this.snapManager.getStageHeight(), | ||
1198 | pt0 = [0, 0, 0], | ||
1199 | pt1 = [0, height, 0], | ||
1200 | delta = [width, 0, 0]; | ||
1201 | |||
1202 | this._gridLineArray.length = 0; | ||
1203 | this.drawGridLines(pt0, pt1, delta, stageMat, 2); | ||
1204 | |||
1205 | pt0 = [0, 0, 0]; | ||
1206 | pt1 = [width, 0, 0]; | ||
1207 | delta = [0, height, 0]; | ||
1208 | this.drawGridLines(pt0, pt1, delta, stageMat, 2); | ||
1209 | |||
1210 | this._lineColor = "red"; | ||
1211 | for (var i = 0; i < 4; i++) { | ||
1212 | this.drawIntersectedLine(this._gridLineArray[i], this._drawingContext); | ||
1213 | } | ||
1214 | |||
1215 | this.setDrawingSurfaceElement(saveContext); | ||
1216 | } | ||
1217 | |||
1218 | // draw reference lines across origin | ||
1219 | var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot); | ||
1190 | var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1); | 1220 | var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1); |
1191 | if(!l) return; | 1221 | if(!l) return; |
1192 | var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); | 1222 | var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); |