aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/NJUtils.js4
-rwxr-xr-xjs/lib/drawing/world.js2
-rwxr-xr-xjs/lib/geom/circle.js19
-rwxr-xr-xjs/lib/geom/geom-obj.js388
-rwxr-xr-xjs/lib/geom/line.js10
-rwxr-xr-xjs/lib/geom/rectangle.js15
6 files changed, 249 insertions, 189 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index 904aa41e..18796da0 100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -136,7 +136,8 @@ exports.NJUtils = Object.create(Object.prototype, {
136 controller: { value: ControllerFactory.getController(controller)}, 136 controller: { value: ControllerFactory.getController(controller)},
137 pi: { value: pi}, 137 pi: { value: pi},
138 props3D: { value: p3d}, 138 props3D: { value: p3d},
139 shapeModel: { value: shapeProps} 139 shapeModel: { value: shapeProps},
140 isShape: { value: isShape}
140 }); 141 });
141 142
142 } 143 }
@@ -168,6 +169,7 @@ exports.NJUtils = Object.create(Object.prototype, {
168 // TODO - Need more info about the shape 169 // TODO - Need more info about the shape
169 selection = "canvas"; 170 selection = "canvas";
170 controller = "shape"; 171 controller = "shape";
172 isShape = true;
171 } 173 }
172 else 174 else
173 { 175 {
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 657c849f..945c9883 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -854,7 +854,7 @@ World.prototype.importObjectsJSON = function (jObj, parentGeomObj) {
854 854
855 // determine if we have children 855 // determine if we have children
856 if (jObj.children) { 856 if (jObj.children) {
857 var nKids = ojObjbj.chilodren.length; 857 var nKids = jObj.children.length;
858 for (var i = 0; i < nKids; i++) { 858 for (var i = 0; i < nKids; i++) {
859 var child = jObj.children[i]; 859 var child = jObj.children[i];
860 this.importObjectsJSON( child, gObj ); 860 this.importObjectsJSON( child, gObj );
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 7fa78b12..1073c2db 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -42,8 +42,8 @@ var Circle = function GLCircle() {
42 42
43 this._strokeWidth = strokeSize; 43 this._strokeWidth = strokeSize;
44 this._innerRadius = innerRadius; 44 this._innerRadius = innerRadius;
45 if (strokeColor) this._strokeColor = strokeColor; 45 this._strokeColor = strokeColor;
46 if (fillColor) this._fillColor = fillColor; 46 this._fillColor = fillColor;
47 47
48 this._strokeStyle = strokeStyle; 48 this._strokeStyle = strokeStyle;
49 } 49 }
@@ -631,6 +631,21 @@ var Circle = function GLCircle() {
631 this._strokeStyle = jObj.strokeStyle; 631 this._strokeStyle = jObj.strokeStyle;
632 var strokeMaterialName = jObj.strokeMat; 632 var strokeMaterialName = jObj.strokeMat;
633 var fillMaterialName = jObj.fillMat; 633 var fillMaterialName = jObj.fillMat;
634
635 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName );
636 if (!strokeMat) {
637 console.log( "object material not found in library: " + strokeMaterialName );
638 strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
639 }
640 this._strokeMaterial = strokeMat;
641
642 var fillMat = MaterialsModel.getMaterial( fillMaterialName );
643 if (!fillMat) {
644 console.log( "object material not found in library: " + fillMaterialName );
645 fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
646 }
647 this._fillMaterial = fillMat;
648
634 this.importMaterialsJSON( jObj.materials ); 649 this.importMaterialsJSON( jObj.materials );
635 }; 650 };
636 651
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index bb5b4a9a..56cf7c98 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -14,19 +14,19 @@ var GeomObj = function GLGeomObj() {
14 /////////////////////////////////////////////////////////////////////// 14 ///////////////////////////////////////////////////////////////////////
15 // Constants 15 // Constants
16 /////////////////////////////////////////////////////////////////////// 16 ///////////////////////////////////////////////////////////////////////
17 this.GEOM_TYPE_RECTANGLE = 1; 17 this.GEOM_TYPE_RECTANGLE = 1;
18 this.GEOM_TYPE_CIRCLE = 2; 18 this.GEOM_TYPE_CIRCLE = 2;
19 this.GEOM_TYPE_LINE = 3; 19 this.GEOM_TYPE_LINE = 3;
20 this.GEOM_TYPE_PATH = 4; 20 this.GEOM_TYPE_PATH = 4;
21 this.GEOM_TYPE_CUBIC_BEZIER = 5; 21 this.GEOM_TYPE_CUBIC_BEZIER = 5;
22 this.GEOM_TYPE_BRUSH_STROKE = 6; 22 this.GEOM_TYPE_BRUSH_STROKE = 6;
23 this.GEOM_TYPE_UNDEFINED = -1; 23 this.GEOM_TYPE_UNDEFINED = -1;
24 24
25 // Needed for calculating dashed/dotted strokes 25 // Needed for calculating dashed/dotted strokes
26 this.DASH_LENGTH = 0.15; 26 this.DASH_LENGTH = 0.15;
27 this.DOT_LENGTH = 0.05; 27 this.DOT_LENGTH = 0.05;
28 this.GAP_LENGTH = 0.05; 28 this.GAP_LENGTH = 0.05;
29 29
30 /////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////
31 // Instance variables 31 // Instance variables
32 /////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////
@@ -40,74 +40,74 @@ var GeomObj = function GLGeomObj() {
40 this.m_world = null; 40 this.m_world = null;
41 41
42 // stroke and fill colors 42 // stroke and fill colors
43 this._strokeColor = [0, 0, 0, 0]; 43 this._strokeColor = [0,0,0,0];
44 this._fillColor = [0, 0, 0, 0]; 44 this._fillColor = [0,0,0,0];
45 45
46 // stroke and fill materials 46 // stroke and fill materials
47 this._fillMaterial = null; 47 this._fillMaterial = null;
48 this._strokeMaterial = null; 48 this._strokeMaterial = null;
49 49
50 // array of primitives - used in RDGE 50 // array of primitives - used in RDGE
51 this._primArray = []; 51 this._primArray = [];
52 this._materialNodeArray = []; 52 this._materialNodeArray = [];
53 this._materialArray = []; 53 this._materialArray = [];
54 this._materialTypeArray = []; 54 this._materialTypeArray = [];
55 55
56 // the transform node used by RDGE 56 // the transform node used by RDGE
57 this._trNode = null; 57 this._trNode = null;
58 58
59 /////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////
60 // Property accessors 60 // Property accessors
61 /////////////////////////////////////////////////////////////////////// 61 ///////////////////////////////////////////////////////////////////////
62 this.setWorld = function (world) { 62 this.setWorld = function( world ) {
63 this.m_world = world; 63 this.m_world = world;
64 }; 64 };
65 65
66 this.getWorld = function () { 66 this.getWorld = function() {
67 return this.m_world; 67 return this.m_world;
68 }; 68 };
69 69
70 this.getMatrix = function () { 70 this.getMatrix = function() {
71 return this._matrix.slice(0); 71 return this._matrix.slice(0);
72 }; 72 };
73 73
74 this.setMatrix = function (m) { 74 this.setMatrix = function(m) {
75 this._matrix = m.slice(0); 75 this._matrix = m.slice(0);
76 }; 76 };
77 77
78 this.setNext = function (next) { 78 this.setNext = function( next ) {
79 this._next = next; 79 this._next = next;
80 }; 80 };
81 81
82 this.getNext = function () { 82 this.getNext = function() {
83 return this._next; 83 return this._next;
84 }; 84 };
85 85
86 this.setPrev = function (prev) { 86 this.setPrev = function( prev ) {
87 this._prev = prev; 87 this._prev = prev;
88 }; 88 };
89 89
90 this.getPrev = function () { 90 this.getPrev = function() {
91 return this._prev; 91 return this._prev;
92 }; 92 };
93 93
94 this.setChild = function (child) { 94 this.setChild = function( child ) {
95 this._child = child; 95 this._child = child;
96 }; 96 };
97 97
98 this.getChild = function () { 98 this.getChild = function() {
99 return this._child; 99 return this._child;
100 }; 100 };
101 101
102 this.setParent = function (parent) { 102 this.setParent = function( parent ) {
103 this._parent = parent; 103 this._parent = parent;
104 }; 104 };
105 105
106 this.getParent = function () { 106 this.getParent = function() {
107 return this._parent; 107 return this._parent;
108 }; 108 };
109 109
110 this.geomType = function () { 110 this.geomType = function() {
111 return this.GEOM_TYPE_UNDEFINED; 111 return this.GEOM_TYPE_UNDEFINED;
112 }; 112 };
113 113
@@ -115,7 +115,7 @@ var GeomObj = function GLGeomObj() {
115 return this._primArray; 115 return this._primArray;
116 }; 116 };
117 117
118 this.getMaterialNodeArray = function () { 118 this.getMaterialNodeArray = function() {
119 return this._materialNodeArray; 119 return this._materialNodeArray;
120 }; 120 };
121 121
@@ -123,110 +123,130 @@ var GeomObj = function GLGeomObj() {
123 return this._materialArray; 123 return this._materialArray;
124 }; 124 };
125