aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js20
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js4
-rwxr-xr-xjs/helper-classes/3D/view-utils.js8
-rwxr-xr-xjs/helper-classes/RDGE/GLAnchorPoint.js7
-rwxr-xr-xjs/helper-classes/RDGE/GLCircle.js142
-rwxr-xr-xjs/helper-classes/RDGE/GLGeomObj.js4
-rwxr-xr-xjs/helper-classes/RDGE/GLLine.js69
-rwxr-xr-xjs/helper-classes/RDGE/GLRectangle.js83
-rwxr-xr-xjs/helper-classes/RDGE/GLSubpath.js66
-rwxr-xr-xjs/helper-classes/RDGE/GLWorld.js29
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js28
-rw-r--r--js/helper-classes/RDGE/runtime/CanvasDataManager.js98
-rw-r--r--js/helper-classes/RDGE/runtime/GLRuntime.js159
-rw-r--r--js/helper-classes/RDGE/src/tools/rdge-compiled.js28
14 files changed, 542 insertions, 203 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index c07391db..85870097 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -115,6 +115,26 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
115 } 115 }
116 }, 116 },
117 117
118 initializeFromDocument:{
119 value:function(){
120 var documentRootChildren = null, i;
121 //initialize with current document
122 this._eltArray = [];
123 this._planesArray = [];
124 this.setDrawingSurfaceElement(this.application.ninja.stage.canvas);
125 this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage );
126 this.setWorkingPlane( Vector.create( [0,0,1,0] ) );
127
128 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
129 if(this.application.ninja.currentDocument._liveNodeList.length > 0){
130 documentRootChildren = this.application.ninja.currentDocument._liveNodeList;
131 for(i=0;i<documentRootChildren.length;i++){
132 this.addElement(documentRootChildren[i]);
133 }
134 }
135 }
136 },
137
118 handleElementAdded: { 138 handleElementAdded: {
119 value: function(event) { 139 value: function(event) {
120 this.addElement(event.detail); 140 this.addElement(event.detail);
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index ada6960b..94202dc5 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -521,7 +521,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
521 521
522 if (!elt.elementModel) 522 if (!elt.elementModel)
523 { 523 {
524 NJUtils.makeElementModel2(elt); 524 NJUtils.makeModelFromElement(elt);
525 } 525 }
526 elt.elementModel.isIn2DSnapCache = true; 526 elt.elementModel.isIn2DSnapCache = true;
527 } 527 }
@@ -588,7 +588,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
588 588
589 if (!elt.elementModel) 589 if (!elt.elementModel)
590 { 590 {
591 NJUtils.makeElementModel2(elt); 591 NJUtils.makeModelFromElement(elt);
592 } 592 }
593 elt.elementModel.isIn2DSnapCache = true; 593 elt.elementModel.isIn2DSnapCache = true;
594 } 594 }
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index a2fac34f..bedda8bf 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -1226,6 +1226,14 @@ exports.ViewUtils = Montage.create(Component, {
1226 } 1226 }
1227 }, 1227 },
1228 1228
1229 getCurrentDocument:
1230 {
1231 value: function()
1232 {
1233 return snapManagerModule.SnapManager.application.ninja.currentDocument;
1234 }
1235 },
1236
1229 setStageZoom: { 1237 setStageZoom: {
1230 value:function( globalPt, zoomFactor ) { 1238 value:function( globalPt, zoomFactor ) {
1231 var localPt; 1239 var localPt;
diff --git a/js/helper-classes/RDGE/GLAnchorPoint.js b/js/helper-classes/RDGE/GLAnchorPoint.js
index 716f59d4..c3e95b34 100755
--- a/js/helper-classes/RDGE/GLAnchorPoint.js
+++ b/js/helper-classes/RDGE/GLAnchorPoint.js
@@ -133,6 +133,13 @@ GLAnchorPoint.prototype.translateAll = function (x, y, z) {
133} 133}
134 134
135 135
136GLAnchorPoint.prototype.scaleAll = function(sx,sy,sz){
137 this._x *= sx;this._prevX *= sx;this._nextX *= sx;
138 this._y *= sy;this._prevY *= sy;this._nextY *= sy;
139 this._z *= sz;this._prevZ *= sz;this._nextZ *= sz;
140}
141
142
136// ********* getters ********** 143// ********* getters **********
137GLAnchorPoint.prototype.getPosX = function () { return this._x; } 144GLAnchorPoint.prototype.getPosX = function () { return this._x; }
138GLAnchorPoint.prototype.getPosY = function () { return this._y; } 145GLAnchorPoint.prototype.getPosY = function () { return this._y; }
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js
index 5b32547e..15ed6b6d 100755
--- a/js/helper-classes/RDGE/GLCircle.js
+++ b/js/helper-classes/RDGE/GLCircle.js
@@ -47,8 +47,8 @@ function GLCircle()
47 47
48 this._strokeWidth = strokeSize; 48 this._strokeWidth = strokeSize;
49 this._innerRadius = innerRadius; 49 this._innerRadius = innerRadius;
50 this._strokeColor = strokeColor; 50 if (strokeColor) this._strokeColor = strokeColor;
51 this._fillColor = fillColor; 51 if (fillColor) this._fillColor = fillColor;
52 52
53 this._strokeStyle = strokeStyle; 53 this._strokeStyle = strokeStyle;
54 } 54 }
@@ -135,7 +135,7 @@ function GLCircle()
135 if (!world._useWebGL) return; 135 if (!world._useWebGL) return;
136 136
137 // make sure RDGE has the correct context 137 // make sure RDGE has the correct context
138 g_Engine.setContext( world.getCanvas().uuid ); 138 g_Engine.setContext( world.getCanvas().rdgeid );
139 139
140 // create the gl buffer 140 // create the gl buffer
141 var gl = world.getGLContext(); 141 var gl = world.getGLContext();
@@ -398,59 +398,58 @@ function GLCircle()
398 // set up the fill style 398 // set up the fill style
399 ctx.beginPath(); 399 ctx.beginPath();
400 ctx.lineWidth = 0; 400 ctx.lineWidth = 0;
401 ctx.fillStyle = "#990000";
402 if (this._fillColor) 401 if (this._fillColor)
403 { 402 {
404 var c = "rgba(" + 255*this._fillColor[0] + "," + 255*this._fillColor[1] + "," + 255*this._fillColor[2] + "," + this._fillColor[3] + ")"; 403 var c = "rgba(" + 255*this._fillColor[0] + "," + 255*this._fillColor[1] + "," + 255*this._fillColor[2] + "," + this._fillColor[3] + ")";
405 ctx.fillStyle = c; 404 ctx.fillStyle = c;
406 }
407 405
408 // draw the fill 406 // draw the fill
409 ctx.beginPath(); 407 ctx.beginPath();
410 var p = MathUtils.transformPoint( bezPts[0], mat ); 408 var p = MathUtils.transformPoint( bezPts[0], mat );
411 ctx.moveTo( p[0], p[1] ); 409 ctx.moveTo( p[0], p[1] );
412 var index = 1; 410 var index = 1;
413 while (index < n) 411 while (index < n)
414 { 412 {
415 p0 = MathUtils.transformPoint( bezPts[index], mat ); 413 p0 = MathUtils.transformPoint( bezPts[index], mat );
416 p1 = MathUtils.transformPoint( bezPts[index+1], mat ); 414 p1 = MathUtils.transformPoint( bezPts[index+1], mat );
417 415
418 x0 = p0[0]; y0 = p0[1]; 416 x0 = p0[0]; y0 = p0[1];
419 x1 = p1[0]; y1 = p1[1]; 417 x1 = p1[0]; y1 = p1[1];
420 ctx.quadraticCurveTo( x0, y0, x1, y1 ); 418 ctx.quadraticCurveTo( x0, y0, x1, y1 );
421 index += 2; 419 index += 2;
422 } 420 }
423 421
424 if ( MathUtils.fpSign(innerRad) > 0) 422 if ( MathUtils.fpSign(innerRad) > 0)
425 {
426 xScale = 0.5*innerRad*this._width;
427 yScale = 0.5*innerRad*this._height;
428 mat[0] = xScale;
429 mat[5] = yScale;
430
431 // get the bezier points
432 var bezPts = MathUtils.circularArcToBezier( Vector.create([0,0,0]), Vector.create([1,0,0]), -2.0*Math.PI );
433 if (bezPts)
434 { 423 {
435 var n = bezPts.length; 424 xScale = 0.5*innerRad*this._width;
436 p = MathUtils.transformPoint( bezPts[0], mat ); 425 yScale = 0.5*innerRad*this._height;
437 ctx.moveTo( p[0], p[1] ); 426 mat[0] = xScale;
438 index = 1; 427 mat[5] = yScale;
439 while (index < n) 428
429 // get the bezier points
430 var bezPts = MathUtils.circularArcToBezier( Vector.create([0,0,0]), Vector.create([1,0,0]), -2.0*Math.PI );
431 if (bezPts)
440 { 432 {
441 p0 = MathUtils.transformPoint( bezPts[index], mat ); 433 var n = bezPts.length;
442 p1 = MathUtils.transformPoint( bezPts[index+1], mat ); 434 p = MathUtils.transformPoint( bezPts[0], mat );
443 435 ctx.moveTo( p[0], p[1] );
444 var x0 = p0[0], y0 = p0[1], 436 index = 1;
445 x1 = p1[0], y1 = p1[1]; 437 while (index < n)
446 ctx.quadraticCurveTo( x0, y0, x1, y1 ); 438 {
447 index += 2;