diff options
author | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
commit | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch) | |
tree | 3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/stage/stage.reel/stage.js | |
parent | c0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff) | |
parent | 40c6eb2c06b34f65a74d59ef9687251952858bab (diff) | |
download | ninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz |
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts:
js/components/gradientpicker.reel/gradientpicker.js
js/components/tools-properties/text-properties.reel/text-properties.js
js/document/views/base.js
js/document/views/design.js
js/helper-classes/3D/StageLine.js
js/helper-classes/3D/draw-utils.js
js/lib/drawing/world.js
js/lib/geom/circle.js
js/lib/geom/line.js
js/lib/geom/rectangle.js
js/lib/geom/shape-primitive.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/flag-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/water-material.js
js/panels/Materials/materials-library-panel.reel/materials-library-panel.html
js/panels/Materials/materials-library-panel.reel/materials-library-panel.js
js/panels/Materials/materials-popup.reel/materials-popup.html
js/panels/Materials/materials-popup.reel/materials-popup.js
js/tools/LineTool.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/stage/stage.reel/stage.js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 86df0903..49e7b641 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -28,10 +28,10 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | POSSIBILITY OF SUCH DAMAGE. |
29 | </copyright> */ | 29 | </copyright> */ |
30 | 30 | ||
31 | var Montage = require("montage/core/core").Montage, | 31 | var Montage = require("montage/core/core").Montage, |
32 | Component = require("montage/ui/component").Component, | 32 | Component = require("montage/ui/component").Component, |
33 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, | 33 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, |
34 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | 34 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; |
35 | 35 | ||
36 | exports.Stage = Montage.create(Component, { | 36 | exports.Stage = Montage.create(Component, { |
37 | 37 | ||
@@ -65,13 +65,13 @@ exports.Stage = Montage.create(Component, { | |||
65 | 65 | ||
66 | _resizeCanvases: { value: true }, | 66 | _resizeCanvases: { value: true }, |
67 | 67 | ||
68 | viewUtils: { | 68 | viewUtils: { |
69 | get: function() { return this.stageDeps.viewUtils; } | 69 | get: function() { return this.stageDeps.viewUtils; } |
70 | }, | 70 | }, |
71 | 71 | ||
72 | snapManager: { | 72 | snapManager: { |
73 | get: function() { return this.stageDeps.snapManager; } | 73 | get: function() { return this.stageDeps.snapManager; } |
74 | }, | 74 | }, |
75 | 75 | ||
76 | drawUtils: { | 76 | drawUtils: { |
77 | get: function() { return this.stageDeps.drawUtils; } | 77 | get: function() { return this.stageDeps.drawUtils; } |
@@ -567,7 +567,7 @@ exports.Stage = Montage.create(Component, { | |||
567 | this._clickPoint.y = point.y; // event.layerY; | 567 | this._clickPoint.y = point.y; // event.layerY; |
568 | 568 | ||
569 | this.enableMouseInOut(); | 569 | this.enableMouseInOut(); |
570 | 570 | ||
571 | this.application.ninja.toolsData.selectedToolInstance.downPoint.x = point.x; | 571 | this.application.ninja.toolsData.selectedToolInstance.downPoint.x = point.x; |
572 | this.application.ninja.toolsData.selectedToolInstance.downPoint.y = point.y; | 572 | this.application.ninja.toolsData.selectedToolInstance.downPoint.y = point.y; |
573 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonDown(event); | 573 | this.application.ninja.toolsData.selectedToolInstance.HandleLeftButtonDown(event); |
@@ -895,16 +895,16 @@ exports.Stage = Montage.create(Component, { | |||
895 | this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; | 895 | this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; |
896 | this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness; | 896 | this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness; |
897 | 897 | ||
898 | //this._drawingContext.strokeRect(x,y,w,h); | 898 | //this._drawingContext.strokeRect(x,y,w,h); |
899 | this._drawingContext.beginPath(); | 899 | this._drawingContext.beginPath(); |
900 | this._drawingContext.moveTo( x0 + 0.5, y0 + 0.5 ); | 900 | this._drawingContext.moveTo( x0 + 0.5, y0 + 0.5 ); |
901 | this._drawingContext.lineTo( x1 + 0.5, y1 + 0.5 ); | 901 | this._drawingContext.lineTo( x1 + 0.5, y1 + 0.5 ); |
902 | this._drawingContext.lineTo( x2 + 0.5, y2 + 0.5 ); | 902 | this._drawingContext.lineTo( x2 + 0.5, y2 + 0.5 ); |
903 | this._drawingContext.lineTo( x3 + 0.5, y3 + 0.5 ); | 903 | this._drawingContext.lineTo( x3 + 0.5, y3 + 0.5 ); |
904 | this._drawingContext.lineTo( x0 + 0.5, y0 + 0.5 ); | 904 | this._drawingContext.lineTo( x0 + 0.5, y0 + 0.5 ); |
905 | 905 | ||
906 | this._drawingContext.closePath(); | 906 | this._drawingContext.closePath(); |
907 | this._drawingContext.stroke(); | 907 | this._drawingContext.stroke(); |
908 | 908 | ||
909 | this._drawingContext.font = "10px sans-serif"; | 909 | this._drawingContext.font = "10px sans-serif"; |
910 | this._drawingContext.textAlign = "right"; | 910 | this._drawingContext.textAlign = "right"; |
@@ -946,7 +946,7 @@ exports.Stage = Montage.create(Component, { | |||
946 | 946 | ||
947 | var zoomFactor = 1; | 947 | var zoomFactor = 1; |
948 | if (this._viewport && this._viewport.style && this._viewport.style.zoom) { | 948 | if (this._viewport && this._viewport.style && this._viewport.style.zoom) { |
949 | zoomFactor = Number(this._viewport.style.zoom); | 949 | zoomFactor = Number(this._viewport.style.zoom); |
950 | } | 950 | } |
951 | 951 | ||
952 | var tmpMat = this.stageDeps.viewUtils.getLocalToGlobalMatrix( elt ); | 952 | var tmpMat = this.stageDeps.viewUtils.getLocalToGlobalMatrix( elt ); |
@@ -1088,9 +1088,9 @@ exports.Stage = Montage.create(Component, { | |||
1088 | 1088 | ||
1089 | /** | 1089 | /** |
1090 | * draw3DProjectedAndUnprojectedRectangles -- Draws a 3D rectangle used for marquee selection. | 1090 | * draw3DProjectedAndUnprojectedRectangles -- Draws a 3D rectangle used for marquee selection. |
1091 | * Draws a second rectangle to indicate the projected | 1091 | * Draws a second rectangle to indicate the projected |
1092 | * location of the created geometry | 1092 | * location of the created geometry |
1093 | * Uses the _canvasDrawingPrefs for line thickness and color | 1093 | * Uses the _canvasDrawingPrefs for line thickness and color |
1094 | * | 1094 | * |
1095 | * @params: x, y, w, h | 1095 | * @params: x, y, w, h |
1096 | */ | 1096 | */ |
@@ -1100,24 +1100,24 @@ exports.Stage = Montage.create(Component, { | |||
1100 | this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; | 1100 | this._drawingContext.strokeStyle = this._canvasDrawingPrefs.color; |
1101 | this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness; | 1101 | this._drawingContext.lineWidth = this._canvasDrawingPrefs.thickness; |
1102 | 1102 | ||
1103 | this._drawingContext.beginPath(); | 1103 | this._drawingContext.beginPath(); |
1104 | var x0 = unProjPts[0][0], y0 = unProjPts[0][1], | 1104 | var x0 = unProjPts[0][0], y0 = unProjPts[0][1], |
1105 | x1 = unProjPts[1][0], y1 = unProjPts[1][1], | 1105 | x1 = unProjPts[1][0], y1 = unProjPts[1][1], |
1106 | x2 = unProjPts[2][0], y2 = unProjPts[2][1], | 1106 | x2 = unProjPts[2][0], y2 = unProjPts[2][1], |
1107 | x3 = unProjPts[3][0], y3 = unProjPts[3][1]; | 1107 | x3 = unProjPts[3][0], y3 = unProjPts[3][1]; |
1108 | this._drawingContext.moveTo( x0 + 0.5, y0 + 0.5 ); | 1108 | this._drawingContext.moveTo( x0 + 0.5, y0 + 0.5 ); |
1109 | this._drawingContext.lineTo( x1 + 0.5, y1 + 0.5 ); | 1109 | this._drawingContext.lineTo( x1 + 0.5, y1 + 0.5 ); |
1110 | this._drawingContext.lineTo( x2 + 0.5, y2 + 0.5 ); | 1110 | this._drawingContext.lineTo( x2 + 0.5, y2 + 0.5 ); |
1111 | this._drawingContext.lineTo( x3 + 0.5, y3 + 0.5 ); | 1111 | this._drawingContext.lineTo( x3 + 0.5, y3 + 0.5 ); |
1112 | this._drawingContext.lineTo( x0 + 0.5, y0 + 0.5 ); | 1112 | this._drawingContext.lineTo( x0 + 0.5, y0 + 0.5 ); |
1113 | 1113 | ||
1114 | this._drawingContext.closePath(); | 1114 | this._drawingContext.closePath(); |
1115 | this._drawingContext.stroke(); | 1115 | this._drawingContext.stroke(); |
1116 | 1116 | ||
1117 | this.stageDeps.snapManager.drawDashedLine( projPts[0], projPts[1], this._drawingContext ); | 1117 | this.stageDeps.snapManager.drawDashedLine( projPts[0], projPts[1], this._drawingContext ); |
1118 | this.stageDeps.snapManager.drawDashedLine( projPts[1], projPts[2], this._drawingContext ); | 1118 | this.stageDeps.snapManager.drawDashedLine( projPts[1], projPts[2], this._drawingContext ); |
1119 | this.stageDeps.snapManager.drawDashedLine( projPts[2], projPts[3], this._drawingContext ); | 1119 | this.stageDeps.snapManager.drawDashedLine( projPts[2], projPts[3], this._drawingContext ); |
1120 | this.stageDeps.snapManager.drawDashedLine( projPts[3], projPts[0], this._drawingContext ); | 1120 | this.stageDeps.snapManager.drawDashedLine( projPts[3], projPts[0], this._drawingContext ); |
1121 | 1121 | ||
1122 | this._drawingContext.font = "10px sans-serif"; | 1122 | this._drawingContext.font = "10px sans-serif"; |
1123 | this._drawingContext.textAlign = "right"; | 1123 | this._drawingContext.textAlign = "right"; |
@@ -1216,14 +1216,14 @@ exports.Stage = Montage.create(Component, { | |||
1216 | { | 1216 | { |
1217 | var w = this._canvas.width, | 1217 | var w = this._canvas.width, |
1218 | h = this._canvas.height; | 1218 | h = this._canvas.height; |
1219 | var globalPt = [w/2, h/2, 0]; | 1219 | var globalPt = [w/2, h/2, 0]; |
1220 | 1220 | ||
1221 | this.stageDeps.viewUtils.setStageZoom( globalPt, value/100 ); | 1221 | this.stageDeps.viewUtils.setStageZoom( globalPt, value/100 ); |
1222 | 1222 | ||
1223 | //TODO - Maybe move to mediator. | 1223 | //TODO - Maybe move to mediator. |
1224 | var newVal = value/100.0; | 1224 | var newVal = value/100.0; |
1225 | if (newVal >= 1) | 1225 | if (newVal >= 1) |
1226 | this.currentDocument.model.views.design.iframe.style.zoom = value/100; | 1226 | this.currentDocument.model.views.design.iframe.style.zoom = value/100; |
1227 | 1227 | ||
1228 | this.updatedStage = true; | 1228 | this.updatedStage = true; |
1229 | 1229 | ||
@@ -1233,35 +1233,35 @@ exports.Stage = Montage.create(Component, { | |||
1233 | } | 1233 | } |
1234 | }, | 1234 | }, |
1235 | 1235 | ||
1236 | getPlaneForView: | 1236 | getPlaneForView: |
1237 | { | 1237 | { |
1238 | value: function( side ) | 1238 | value: function( side ) |
1239 | { | 1239 | { |
1240 | var plane = [0,0,1,0]; | 1240 | var plane = [0,0,1,0]; |
1241 | switch(side) | 1241 | switch(side) |
1242 | { | 1242 | { |
1243 | case "top": | 1243 | case "top": |
1244 | plane = [0,1,0,0]; | 1244 | plane = [0,1,0,0]; |
1245 | plane[3] = this.currentDocument.model.documentRoot.offsetHeight / 2.0; | 1245 | plane[3] = this.currentDocument.model.documentRoot.offsetHeight / 2.0; |
1246 | break; | 1246 | break; |
1247 | 1247 | ||
1248 | case "side": | 1248 | case "side": |
1249 | plane = [1,0,0,0]; | 1249 | plane = [1,0,0,0]; |
1250 | plane[3] = this.currentDocument.model.documentRoot.offsetWidth / 2.0; | 1250 | plane[3] = this.currentDocument.model.documentRoot.offsetWidth / 2.0; |
1251 | break; | 1251 | break; |
1252 | 1252 | ||
1253 | case "front": | 1253 | case "front": |
1254 | plane = [0,0,1,0]; | 1254 | plane = [0,0,1,0]; |
1255 | break; | 1255 | break; |
1256 | 1256 | ||
1257 | default: | 1257 | default: |
1258 | console.log( "unrecognized view in snapManager.getPlaneForView: " + side ); | 1258 | console.log( "unrecognized view in snapManager.getPlaneForView: " + side ); |
1259 | break; | 1259 | break; |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | return plane; | 1262 | return plane; |
1263 | } | 1263 | } |
1264 | }, | 1264 | }, |
1265 | 1265 | ||
1266 |