aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js12
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/lib/drawing/world.js6
-rwxr-xr-xjs/lib/geom/brush-stroke.js2
-rwxr-xr-xjs/lib/geom/circle.js1435
-rwxr-xr-xjs/lib/geom/geom-obj.js852
-rwxr-xr-xjs/lib/geom/line.js914
-rwxr-xr-xjs/lib/geom/rectangle.js1400
-rwxr-xr-xjs/lib/geom/sub-path.js2
-rwxr-xr-xjs/tools/LineTool.js3
-rwxr-xr-xjs/tools/OvalTool.js2
-rwxr-xr-xjs/tools/RectTool.js2
12 files changed, 2406 insertions, 2226 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 27a95941..346ad014 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -1810,8 +1810,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1810 hSnap.setScreenPoint( scrPt ); 1810 hSnap.setScreenPoint( scrPt );
1811 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1811 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1812 hSnap.setElement( stage ); 1812 hSnap.setElement( stage );
1813 hSnap.setPlane( [0,0,1,0] ); 1813 //hSnap.setPlane( [0,0,1,0] );
1814 hSnap.setPlaneMatrix( Matrix.I(4) ); 1814 //hSnap.setPlaneMatrix( Matrix.I(4) );
1815 if (vSnap.hasAssociatedScreenPoint() ) 1815 if (vSnap.hasAssociatedScreenPoint() )
1816 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1816 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1817 if (vSnap.hasAssociatedScreenPoint2() ) 1817 if (vSnap.hasAssociatedScreenPoint2() )
@@ -1859,8 +1859,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1859 hSnap.setScreenPoint( scrPt ); 1859 hSnap.setScreenPoint( scrPt );
1860 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1860 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1861 hSnap.setElement( stage ); 1861 hSnap.setElement( stage );
1862 hSnap.setPlane( [0,0,1,0] ); 1862 //hSnap.setPlane( [0,0,1,0] );
1863 hSnap.setPlaneMatrix( Matrix.I(4) ); 1863 //hSnap.setPlaneMatrix( Matrix.I(4) );
1864 if (vSnap.hasAssociatedScreenPoint() ) 1864 if (vSnap.hasAssociatedScreenPoint() )
1865 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1865 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1866 if (vSnap.hasAssociatedScreenPoint2() ) 1866 if (vSnap.hasAssociatedScreenPoint2() )
@@ -1914,8 +1914,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1914 hSnap.setScreenPoint( scrPt ); 1914 hSnap.setScreenPoint( scrPt );
1915 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1915 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1916 hSnap.setElement( stage ); 1916 hSnap.setElement( stage );
1917 hSnap.setPlane( [0,0,1,0] ); 1917 //hSnap.setPlane( [0,0,1,0] );
1918 hSnap.setPlaneMatrix( Matrix.I(4) ); 1918 //hSnap.setPlaneMatrix( Matrix.I(4) );
1919 if (vSnap.hasAssociatedScreenPoint() ) 1919 if (vSnap.hasAssociatedScreenPoint() )
1920 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1920 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1921 if (vSnap.hasAssociatedScreenPoint2() ) 1921 if (vSnap.hasAssociatedScreenPoint2() )
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index f7b87a91..feced079 100644
--- a/js/io/system/ninjalibrary.json
+++ b/js/io/system/ninjalibrary.json
@@ -1,6 +1,6 @@
1{ 1{
2 "libraries": [ 2 "libraries": [
3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.8.0.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.8.0.0"},
4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.5.0"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.6.0"}
5 ] 5 ]
6} \ No newline at end of file 6} \ No newline at end of file
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 7ce23921..0dde9af4 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -874,17 +874,17 @@ World.prototype.importObjectJSON = function( jObj, parentGeomObj )
874 switch (type) 874 switch (type)
875 { 875 {
876 case 1: 876 case 1:
877 obj = new Rectangle(); 877 obj = Object.create(Rectangle, {});
878 obj.importJSON( jObj ); 878 obj.importJSON( jObj );
879 break; 879 break;
880 880
881 case 2: // circle 881 case 2: // circle
882 obj = new Circle(); 882 obj = Object.create(Circle, {});
883 obj.importJSON( jObj ); 883 obj.importJSON( jObj );
884 break; 884 break;
885 885
886 case 3: // line 886 case 3: // line
887 obj = new Line(); 887 obj = Object.create(Line, {});
888 obj.importJSON( jObj ); 888 obj.importJSON( jObj );
889 break; 889 break;
890 890
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index 1fae0c1d..6facdd5d 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -768,7 +768,7 @@ var BrushStroke = function GLBrushStroke() {
768 768
769}; //function BrushStroke ...class definition 769}; //function BrushStroke ...class definition
770 770
771BrushStroke.prototype = new GeomObj(); 771BrushStroke.prototype = Object.create(GeomObj, {});
772 772
773BrushStroke.prototype._CatmullRomSplineInterpolate = function(ctrlPts, t) 773BrushStroke.prototype._CatmullRomSplineInterpolate = function(ctrlPts, t)
774{ 774{
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index afeed449..b60ad58f 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -4,9 +4,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var GeomObj = require("js/lib/geom/geom-obj").GeomObj; 7var GeomObj = require("js/lib/geom/geom-obj").GeomObj;
8var ShapePrimitive = require("js/lib/geom/shape-primitive").ShapePrimitive; 8var ShapePrimitive = require("js/lib/geom/shape-primitive").ShapePrimitive;
9var MaterialsModel = require("js/models/materials-model").MaterialsModel; 9var MaterialsModel = require("js/models/materials-model").MaterialsModel;
10var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; 10var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils;
11var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; 11var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
12 12
@@ -16,747 +16,793 @@ var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils;
16// Derived from class GLGeomObj 16// Derived from class GLGeomObj
17// The position and dimensions of the stroke, fill, and inner Radius should be in pixels 17// The position and dimensions of the stroke, fill, and inner Radius should be in pixels
18/////////////////////////////////////////////////////////////////////// 18///////////////////////////////////////////////////////////////////////
19var Circle = function GLCircle() { 19exports.Circle = Object.create(GeomObj, {
20 20
21 this.init = function( world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) { 21 ///////////////////////////////////////////////////////////////////////
22 /////////////////////////////////////////////////////////////////////// 22 // Instance variables
23 // Instance variables 23 ///////////////////////////////////////////////////////////////////////
24 /////////////////////////////////////////////////////////////////////// 24 _width: { value : 2.0, writable: true },
25 this._width = 2.0; 25 _height: { value : 2.0, writable: true },
26 this._height = 2.0; 26 _xOffset: { value : 0, writable: true },
27 this._xOffset = 0; 27 _yOffset: { value : 0, writable: true },
28 this._yOffset = 0; 28
29 29 _radius: { value : 2.0, writable: true },
30 this._radius = 2.0; 30 _strokeWidth: { value : 0.25, writable: true },
31 this._strokeWidth = 0.25; 31 _innerRadius: { value : 0, writable: true },
32 this._innerRadius = 0; 32 _ovalHeight: { value : 4.0, writable: true },
33 33 _strokeStyle: { value : "Solid", writable: true },
34 this._ovalHeight = this._ovalHeight = 2.0 * this._radius; 34 _aspectRatio: { value : 1.0, writable: true },
35 35
36 this._strokeStyle = "Solid"; 36 init: {
37 37 value: function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle) {
38 this._aspectRatio = 1.0; 38 if(arguments.length > 0) {
39 39 this._width = width;
40 if (arguments.length > 0) { 40 this._height = height;
41 this._width = width; 41 this._xOffset = xOffset;
42 this._height = height; 42 this._yOffset = yOffset;
43 this._xOffset = xOffset; 43 this._ovalHeight = 2.0 * this._radius;
44 this._yOffset = yOffset; 44
45 45 this._strokeWidth = strokeSize;
46 this._strokeWidth = strokeSize; 46 this._innerRadius = innerRadius;
47 this._innerRadius = innerRadius; 47 this._strokeColor = strokeColor;
48 this._strokeColor = strokeColor; 48 this._fillColor = fillColor;
49 this._fillColor = fillColor; 49
50 50 this._strokeStyle = strokeStyle;
51 this._strokeStyle = strokeStyle; 51
52 52 this._matrix = Matrix.I(4);
53 this._matrix = Matrix.I(4); 53 //this._matrix[12] = xOffset;
54 //this._matrix[12] = xOffset; 54 //this._matrix[13] = yOffset;
55 //this._matrix[13] = yOffset; 55 }
56 } 56
57 57 this.m_world = world;
58 this.m_world = world;
59
60 if(strokeMaterial){
61 this._strokeMaterial = strokeMaterial;
62 } else {
63 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
64 }
65 58
66 if(fillMaterial) { 59 if(strokeMaterial) {
67 this._fillMaterial = fillMaterial; 60 this._strokeMaterial = strokeMaterial;
68 } else { 61 } else {
69 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); 62 this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
63 }
64
65 if(fillMaterial) {
66 this._fillMaterial = fillMaterial;
67 } else {
68 this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() );
69 }
70 } 70 }
71 }; 71 },
72 72
73 /////////////////////////////////////////////////////////////////////// 73 ///////////////////////////////////////////////////////////////////////
74</