aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/hit-record.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 14:35:44 -0700
committerValerio Virgillito2012-07-09 14:35:44 -0700
commit84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch)
tree3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/helper-classes/3D/hit-record.js
parentc0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff)
parent40c6eb2c06b34f65a74d59ef9687251952858bab (diff)
downloadninja-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/helper-classes/3D/hit-record.js')
-rwxr-xr-xjs/helper-classes/3D/hit-record.js322
1 files changed, 161 insertions, 161 deletions
diff --git a/js/helper-classes/3D/hit-record.js b/js/helper-classes/3D/hit-record.js
index 46462c20..7e39bb50 100755
--- a/js/helper-classes/3D/hit-record.js
+++ b/js/helper-classes/3D/hit-record.js
@@ -41,90 +41,90 @@ var snapManagerModule = require("js/helper-classes/3D/snap-manager");
41var HitRecord = exports.HitRecord = Object.create(Object.prototype, 41var HitRecord = exports.HitRecord = Object.create(Object.prototype,
42{ 42{
43 43
44 /////////////////////////////////////////////////////////////////////// 44 ///////////////////////////////////////////////////////////////////////
45 // Constant definitions 45 // Constant definitions
46 /////////////////////////////////////////////////////////////////////// 46 ///////////////////////////////////////////////////////////////////////
47 SNAP_TYPE_STAGE : { value: 1, writable: true }, 47 SNAP_TYPE_STAGE : { value: 1, writable: true },
48 SNAP_TYPE_GRID_VERTEX : { value: 2, writable: true }, 48 SNAP_TYPE_GRID_VERTEX : { value: 2, writable: true },
49 SNAP_TYPE_GRID_HORIZONTAL : { value: 13, writable: true }, 49 SNAP_TYPE_GRID_HORIZONTAL : { value: 13, writable: true },
50 SNAP_TYPE_GRID_VERTICAL: { value: 14, writable: true }, 50 SNAP_TYPE_GRID_VERTICAL: { value: 14, writable: true },
51 SNAP_TYPE_ALIGN_MERGED: { value: 15, writable: true }, 51 SNAP_TYPE_ALIGN_MERGED: { value: 15, writable: true },
52 SNAP_TYPE_HORIZONTAL_FROM_START: { value: 3, writable: true }, 52 SNAP_TYPE_HORIZONTAL_FROM_START: { value: 3, writable: true },
53 SNAP_TYPE_VERTICAL_FROM_START: { value: 4, writable: true }, 53 SNAP_TYPE_VERTICAL_FROM_START: { value: 4, writable: true },
54 SNAP_TYPE_ELEMENT: { value: 5, writable: true }, 54 SNAP_TYPE_ELEMENT: { value: 5, writable: true },
55 SNAP_TYPE_ELEMENT_EDGE: { value: 6, writable: true }, 55 SNAP_TYPE_ELEMENT_EDGE: { value: 6, writable: true },
56 SNAP_TYPE_ELEMENT_VERTEX: { value: 7, writable: true }, 56 SNAP_TYPE_ELEMENT_VERTEX: { value: 7, writable: true },
57 SNAP_TYPE_ALIGN_HORIZONTAL: { value: 8, writable: true }, 57 SNAP_TYPE_ALIGN_HORIZONTAL: { value: 8, writable: true },
58 SNAP_TYPE_ALIGN_VERTICAL: { value: 9, writable: true }, 58 SNAP_TYPE_ALIGN_VERTICAL: { value: 9, writable: true },
59 SNAP_TYPE_ALIGN_BOTH: { value: 10, writable: true }, 59 SNAP_TYPE_ALIGN_BOTH: { value: 10, writable: true },
60 SNAP_TYPE_ELEMENT_CENTER: { value: 11, writable: true }, 60 SNAP_TYPE_ELEMENT_CENTER: { value: 11, writable: true },
61 SNAP_TYPE_CONTAINED_ELEMENT: { value: 12, writable: true }, 61 SNAP_TYPE_CONTAINED_ELEMENT: { value: 12, writable: true },
62 SNAP_TYPE_UNDEFINED: { value: null, writable: -1 }, 62 SNAP_TYPE_UNDEFINED: { value: null, writable: -1 },
63 63
64 /////////////////////////////////////////////////////////////////////// 64 ///////////////////////////////////////////////////////////////////////
65 // Instance variables 65 // Instance variables
66 /////////////////////////////////////////////////////////////////////// 66 ///////////////////////////////////////////////////////////////////////
67 _type: { value: this.SNAP_TYPE_UNDEFINED, writable: true }, 67 _type: { value: this.SNAP_TYPE_UNDEFINED, writable: true },
68 _elt: { value: null, writable: true }, // this can be null. example: snapping to the working plane 68 _elt: { value: null, writable: true }, // this can be null. example: snapping to the working plane
69 _screenPt: { value: null, writable: true }, // snap point in global screen space 69 _screenPt: { value: null, writable: true }, // snap point in global screen space
70 _localPoint: { value: null, writable: true }, // snap point in the local space of the element 70 _localPoint: { value: null, writable: true }, // snap point in the local space of the element
71 _plane: { value: null, writable: true }, // plane equation at the snap point in local object space 71 _plane: { value: null, writable: true }, // plane equation at the snap point in local object space
72 _planeMat: { value: Matrix.I(4) , writable: true }, // transform to take the point from plane space to the transformed view space of the element 72 _planeMat: { value: Matrix.I(4) , writable: true }, // transform to take the point from plane space to the transformed view space of the element
73 _assocScrPt: { value: null, writable: true }, // associated screen point 73 _assocScrPt: { value: null, writable: true }, // associated screen point
74 _assocScrPt2: { value: null, writable: true }, // a second associated point for drawing multiple snap align hits 74 _assocScrPt2: { value: null, writable: true }, // a second associated point for drawing multiple snap align hits
75 _planarHit: { value: false, writable: true }, 75 _planarHit: { value: false, writable: true },
76 _snapBoundaryIndex : { value: -1, writable: true }, // this used for snap align to object boundaries 76 _snapBoundaryIndex : { value: -1, writable: true }, // this used for snap align to object boundaries
77 _isQuadPt :{ value: false, writable: true }, // used for snapping to an object's quadrant point 77 _isQuadPt :{ value: false, writable: true }, // used for snapping to an object's quadrant point
78 78
79 /////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////
80 // Property accessors 80 // Property accessors
81 /////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////
82 getElt : { value: function() { return this._elt; }}, 82 getElt : { value: function() { return this._elt; }},
83 setElt : { value: function(e) { this._elt = e; }}, 83 setElt : { value: function(e) { this._elt = e; }},
84 getElement : { value: function() { return this._elt; }}, 84 getElement : { value: function() { return this._elt; }},
85 setElement : { value: function(e) { this._elt = e; }}, 85 setElement : { value: function(e) { this._elt = e; }},
86 86
87 getZIndex : { value: function() { return this._zIndex; }}, 87 getZIndex : { value: function() { return this._zIndex; }},
88 setZIndex : { value: function(i) { this._zIndex = i; }}, 88 setZIndex : { value: function(i) { this._zIndex = i; }},
89 89
90 setScreenPoint : { value: function(s) { this._screenPt = s.slice(0); }}, 90 setScreenPoint : { value: function(s) { this._screenPt = s.slice(0); }},
91 getScreenPoint : { value: function() { return this._screenPt.slice(0); }}, 91 getScreenPoint : { value: function() { return this._screenPt.slice(0); }},
92 92
93 setLocalPoint : { value: function(s) { this._localPt = s.slice(0); }}, 93 setLocalPoint : { value: function(s) { this._localPt = s.slice(0); }},
94 getLocalPoint : { value: function() { return this._localPt.slice(0); }}, 94 getLocalPoint : { value: function() { return this._localPt.slice(0); }},
95 95
96 setAssociatedScreenPoint : { value: function(s) { this._assocScrPt = s.slice(0); }}, 96 setAssociatedScreenPoint : { value: function(s) { this._assocScrPt = s.slice(0); }},
97 getAssociatedScreenPoint : { value: function() { return this._assocScrPt.slice(0); }}, 97 getAssociatedScreenPoint : { value: function() { return this._assocScrPt.slice(0); }},
98 hasAssociatedScreenPoint : { value: function() { return this._assocScrPt != null; }}, 98 hasAssociatedScreenPoint : { value: function() { return this._assocScrPt != null; }},
99 99
100 setAssociatedScreenPoint2 : { value: function(s) { this._assocScrPt2 = s.slice(0); }}, 100 setAssociatedScreenPoint2 : { value: function(s) { this._assocScrPt2 = s.slice(0); }},
101 getAssociatedScreenPoint2 : { value: function() { return this._assocScrPt2.slice(0); }}, 101 getAssociatedScreenPoint2 : { value: function() { return this._assocScrPt2.slice(0); }},
102 hasAssociatedScreenPoint2 : { value: function() { return this._assocScrPt2 != null; }}, 102 hasAssociatedScreenPoint2 : { value: function() { return this._assocScrPt2 != null; }},
103 103
104 setPlane : { value: function(p) { this._plane = p.slice(0); }}, 104 setPlane : { value: function(p) { this._plane = p.slice(0); }},
105 getPlane : { value: function() { return this._plane.slice(0); }}, 105 getPlane : { value: function() { return this._plane.slice(0); }},
106 106
107 setPlaneMatrix : { value: function(pm) { this._planeMat = pm.slice(0); }}, 107 setPlaneMatrix : { value: function(pm) { this._planeMat = pm.slice(0); }},
108 getPlaneMatrix : { value: function() { return this._planeMat.slice(0); }}, 108 getPlaneMatrix : { value: function() { return this._planeMat.slice(0); }},
109 109
110 setPlanarHit : { value: function(p) { this._planarHit = p; }}, 110 setPlanarHit : { value: function(p) { this._planarHit = p; }},
111 isPlanarHit : { value: function() { return this._planarHit; }}, 111 isPlanarHit : { value: function() { return this._planarHit; }},
112 112
113 getSnapBoundaryIndex : { value: function() { return this._snapBoundaryIndex; }}, 113 getSnapBoundaryIndex : { value: function() { return this._snapBoundaryIndex; }},
114 setSnapBoundaryIndex : { value: function(i) { this._snapBoundaryIndex = i; }}, 114 setSnapBoundaryIndex : { value: function(i) { this._snapBoundaryIndex = i; }},
115 115
116 getType : { value: function() { return this._type; }}, 116 getType : { value: function() { return this._type; }},
117 setType : { value: function(t) {this._type = t; if (!this.checkType()) { throw new Error("invalid snap type"); return; } }}, 117 setType : { value: function(t) {this._type = t; if (!this.checkType()) { throw new Error("invalid snap type"); return; } }},
118 118
119 getUseQuadPoint : { value: function() { return this._isQuadPt; }}, 119 getUseQuadPoint : { value: function() { return this._isQuadPt; }},
120 setUseQuadPoint : { value: function(q) {this._isQuadPt = q; }}, 120 setUseQuadPoint : { value: function(q) {this._isQuadPt = q; }},
121 121
122 /////////////////////////////////////////////////////////////////////// 122 ///////////////////////////////////////////////////////////////////////
123 // Methods 123 // Methods
124 /////////////////////////////////////////////////////////////////////// 124 ///////////////////////////////////////////////////////////////////////
125 125
126 checkType :{ 126 checkType :{
127 value: function() { 127 value: function() {
128 var ok = false; 128 var ok = false;
129 switch (this._type) 129 switch (this._type)
130 { 130 {
@@ -161,7 +161,7 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype,
161 } 161 }
162 }, 162 },
163 163
164 isSomeGridTypeSnap : { 164 isSomeGridTypeSnap : {
165 value: function() { 165 value: function() {
166 return ((this._type == this.SNAP_TYPE_GRID_VERTEX) || 166 return ((this._type == this.SNAP_TYPE_GRID_VERTEX) ||
167 (this._type == this.SNAP_TYPE_GRID_HORIZONTAL) || 167 (this._type == this.SNAP_TYPE_GRID_HORIZONTAL) ||
@@ -170,7 +170,7 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype,
170 } 170 }
171 }, 171 },
172 172
173 convertToWorkingPlane : { 173 convertToWorkingPlane : {
174 value: function( wp ) { 174 value: function( wp ) {
175 var swp = this.calculateStageWorldPoint(); 175 var swp = this.calculateStageWorldPoint();
176 var wpMat = drawUtils.getPlaneToWorldMatrix(wp, MathUtils.getPointOnPlane(wp)); 176 var wpMat = drawUtils.getPlaneToWorldMatrix(wp, MathUtils.getPointOnPlane(wp));
@@ -191,7 +191,7 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype,
191 } 191 }
192 }, 192 },
193 193
194 calculateStageWorldPoint : { 194 calculateStageWorldPoint : {
195 value: function() { 195 value: function() {
196 var wPt; 196 var wPt;
197 var elt = this.getElt(); 197 var elt = this.getElt();
@@ -207,7 +207,7 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype,
207 }, 207 },
208 208
209 209
210 calculateScreenPoint : { 210 calculateScreenPoint : {
211 value: function() { 211 value: function() {
212 var scrPt; 212 var scrPt;
213 213
@@ -231,7 +231,7 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype,