aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorKris Kowal2012-07-06 11:52:06 -0700
committerKris Kowal2012-07-06 15:01:48 -0700
commit648ee61ae84216d0236e0dbc211addc13b2cfa3a (patch)
tree8f0f55557bd0c47a84e49c1977c950645d284607 /js/stage
parentaedd14b18695d031f695d27dfbd94df5614495bb (diff)
downloadninja-648ee61ae84216d0236e0dbc211addc13b2cfa3a.tar.gz
Expand tabs
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/layout.js2
-rwxr-xr-xjs/stage/stage-deps.js16
-rwxr-xr-xjs/stage/stage.reel/stage.js114
-rwxr-xr-xjs/stage/tool-handle.js10
4 files changed, 71 insertions, 71 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index 650d448f..3fcfe9eb 100755
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -221,7 +221,7 @@ exports.Layout = Montage.create(Component, {
221 221
222 var zoomFactor = 1; 222 var zoomFactor = 1;
223 if (this.stage._viewport && this.stage._viewport.style && this.stage._viewport.style.zoom) { 223 if (this.stage._viewport && this.stage._viewport.style && this.stage._viewport.style.zoom) {
224 zoomFactor = Number(this.stage._viewport.style.zoom); 224 zoomFactor = Number(this.stage._viewport.style.zoom);
225 } 225 }
226 226
227 var sSL = this.stage._scrollLeft; 227 var sSL = this.stage._scrollLeft;
diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js
index 058c6dbc..73164013 100755
--- a/js/stage/stage-deps.js
+++ b/js/stage/stage-deps.js
@@ -28,14 +28,14 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE. 28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 29</copyright> */
30 30
31var Montage = require("montage/core/core").Montage, 31var Montage = require("montage/core/core").Montage,
32 Component = require("montage/ui/component").Component, 32 Component = require("montage/ui/component").Component,
33 snapManager = require("js/helper-classes/3D/snap-manager").SnapManager, 33 snapManager = require("js/helper-classes/3D/snap-manager").SnapManager,
34 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, 34 viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils,
35 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, 35 drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils,
36 ElementPlanes = require("js/helper-classes/3D/element-planes").ElementPlanes, 36 ElementPlanes = require("js/helper-classes/3D/element-planes").ElementPlanes,
37 MathUtilsClass = require("js/helper-classes/3D/math-utils").MathUtilsClass, 37 MathUtilsClass = require("js/helper-classes/3D/math-utils").MathUtilsClass,
38 VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; 38 VecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
39 39
40exports.StageDeps = Montage.create(Component, { 40exports.StageDeps = Montage.create(Component, {
41 41
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js
index 86df0903..67ce5081 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
28POSSIBILITY OF SUCH DAMAGE. 28POSSIBILITY OF SUCH DAMAGE.
29</copyright> */ 29</copyright> */
30 30
31var Montage = require("montage/core/core").Montage, 31var 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
36exports.Stage = Montage.create(Component, { 36exports.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; }
@@ -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