aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/GLRectangle.js
diff options
context:
space:
mode:
authorJonathan Duran2012-03-06 11:38:39 -0800
committerJonathan Duran2012-03-06 11:38:39 -0800
commit342fb451bd251358068a0dcb10e9dc218b79a176 (patch)
treeaa0195d581c3934fb6dc09981506b3c070002806 /js/helper-classes/backup-delete/GLRectangle.js
parent2815adfd7c19b3dff89dc3e1bda9af8d30dca8d6 (diff)
downloadninja-342fb451bd251358068a0dcb10e9dc218b79a176.tar.gz
Squashed commit of the following:
commit 1cd89d4d06e3a8f2c221628b19cf26a2c69f5d3f Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 11:24:25 2012 -0800 Fixing WebGL not available bug commit 84332ab81c1b445195f1d9be8bbeae0725c8e758 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Mar 6 10:58:25 2012 -0800 Squashed commit of preload-fix into Master - Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 13f52cf0c74f53a919fa864f86669e8155f82961 Merge: dced508 abc04f3 Author: Valerio Virgillito <valerio@motorola.com> Date: Fri Mar 2 15:46:11 2012 -0800 Merge pull request #93 from imix23ways/Timeline Timeline: Critical bug fixes commit dced508bb19a7bcd467ff1b86b5df5bbec4be794 Merge: 0aeb400 cc772ef Author: Valerio Virgillito <valerio@motorola.com> Date: Fri Mar 2 15:45:35 2012 -0800 Merge pull request #92 from mqg734/WebGLFixes Selection Tool Fixes for elements flying off into space when they overlap commit 0aeb400070762cf01d83cf9f9ee25a5595098b7f Merge: ff0a956 aabb48a Author: Valerio Virgillito <valerio@motorola.com> Date: Fri Mar 2 14:05:21 2012 -0800 Merge pull request #94 from ericguzman/PresetsPanel Presets Panel - Fix single-click activation, and transition cut-off bug. commit cc772ef3333ed419d269a2bda7aea5b0150a7bd9 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Fri Mar 2 11:34:58 2012 -0800 Fixing flying off into space bug for translate tool too. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit abc04f3d50311ed1c21067344bc7e448686f8c5c Author: Jonathan Duran <jduran@motorola.com> Date: Fri Mar 2 11:26:25 2012 -0800 Timeline Fix timing function Signed-off-by: Jonathan Duran <jduran@motorola.com> commit aabb48a1c8d34bc968f4c6b0ffee4e31c1d5d286 Author: Eric Guzman <ericg@motorola.com> Date: Fri Mar 2 11:22:44 2012 -0800 Presets Panel - Fix single-click activation, and transition cut-off bug. Use double-click as the activation event for transition presets. Also fixed the bug when applying a style preset before the transition preset, which disabled transitions after the first one. commit f3207f39ea9d8c1c34246217a23d3a689671903d Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Fri Mar 2 11:21:29 2012 -0800 Don't draw transform handles if the stage is the target element. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 5425be91e7125c22955b4459a62412ff574e49a8 Author: Jonathan Duran <jduran@motorola.com> Date: Fri Mar 2 11:11:48 2012 -0800 Timeline: Fix for animation iteration count Add default webkit css properties to allow animations with integer iteration counts. Signed-off-by: Jonathan Duran <jduran@motorola.com> commit 1760bac1da9218315ad1bacdcf3a157495a049e8 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Fri Mar 2 10:48:41 2012 -0800 Fix for jumping issue when moving items that have any 3d on them. We can't translate 3d moves into 2d space due to perspective, so we must update the matrix3d values instead of the top-left values if items have 3d. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 2c04935f0ccb1cb7c98371fc10b43155f2d956c4 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 22:20:06 2012 -0800 Fix for elements flying off into space when moving elements that overlap. This was happening because our hit record's element and the browser's element from point did not match. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 50058746779f714ed9b0287f49e56c9f0d35593e Merge: 500426d ff0a956 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 21:49:44 2012 -0800 Merge branch 'refs/heads/ninja-internal' into WebGLFixes commit 500426dea0ca95a6b45be8ea8d132cfdb4d2c940 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 10:11:39 2012 -0800 Fixed logic error when resizing with the top-left transform handles. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 7980d9bde2b43aa5a494ddf6f1db5c4959a57b91 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 10:04:15 2012 -0800 Re-fixing IKNinja-940 - Can't select objects when in side/top view. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit f04cc0146d8f7573628678613a99c270116768e4 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Wed Feb 29 16:45:40 2012 -0800 Last-used material (instead of FlatMaterial) is applied to shape when turning on use WebGL checkbox in the PI. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/helper-classes/backup-delete/GLRectangle.js')
-rwxr-xr-xjs/helper-classes/backup-delete/GLRectangle.js1236
1 files changed, 1236 insertions, 0 deletions
diff --git a/js/helper-classes/backup-delete/GLRectangle.js b/js/helper-classes/backup-delete/GLRectangle.js
new file mode 100755
index 00000000..a801d3c4
--- /dev/null
+++ b/js/helper-classes/backup-delete/GLRectangle.js
@@ -0,0 +1,1236 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7 ///////////////////////////////////////////////////////////////////////
8// Class GLRectangle
9// GL representation of a rectangle.
10// Derived from class GLGeomObj
11///////////////////////////////////////////////////////////////////////
12function GLRectangle()
13{
14 // CONSTANTS
15 this.N_TRIANGLES = 15;
16
17 // initialize the inherited members
18 this.inheritedFrom = GLGeomObj;
19 this.inheritedFrom();
20
21 ///////////////////////////////////////////////////////////////////////
22 // Instance variables
23 ///////////////////////////////////////////////////////////////////////
24 this._width = 2.0;
25 this._height = 2.0;
26 this._xOffset = 0;
27 this._yOffset = 0;
28
29 this._tlRadius = 0;
30 this._trRadius = 0;
31 this._blRadius = 0;
32 this._brRadius = 0;
33
34 this._strokeWidth = 0.25;
35
36 this._strokeStyle = "Solid";
37 this.init = function(world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor,
38 tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle)
39 {
40
41
42 this.m_world = world;
43
44 if (arguments.length > 0)
45 {
46 this._width = width;
47 this._height = height;
48 this._xOffset = xOffset;
49 this._yOffset = yOffset;
50
51 this._strokeWidth = strokeSize;
52 this._strokeColor = strokeColor;
53 this._fillColor = fillColor;
54
55 this.setTLRadius(tlRadius);
56 this.setTRRadius(trRadius);
57 this.setBLRadius(blRadius);
58 this.setBRRadius(brRadius);
59
60 this._strokeStyle = strokeStyle;
61 }
62
63 // the overall radius includes the fill and the stroke. separate the two based onthe stroke width
64 // this._fillRad = this._radius - this._strokeWidth;
65 // var err = 0.05;
66 var err = 0;
67 this._fillWidth = this._width - this._strokeWidth + err;
68 this._fillHeight = this._height - this._strokeWidth + err;
69
70 this._materialAmbient = [0.2, 0.2, 0.2, 1.0];
71 this._materialDiffuse = [0.4, 0.4, 0.4, 1.0];
72 this._materialSpecular = [0.4, 0.4, 0.4, 1.0];
73
74 if(strokeMaterial)
75 this._strokeMaterial = strokeMaterial;
76 else
77 this._strokeMaterial = new FlatMaterial();
78
79 if(fillMaterial)
80 this._fillMaterial = fillMaterial;
81 else
82 this._fillMaterial = new FlatMaterial();
83 }
84
85 ///////////////////////////////////////////////////////////////////////
86 // Property Accessors
87 ///////////////////////////////////////////////////////////////////////
88 this.getStrokeWidth = function() { return this._strokeWidth; }
89 this.setStrokeWidth = function(w) { this._strokeWidth = w; }
90
91 this.getStrokeMaterial = function() { return this._strokeMaterial; }
92 this.setStrokeMaterial = function(m) { this._strokeMaterial = m; }
93
94 this.getFillMaterial = function() { return this._fillMaterial; }
95 this.setFillMaterial = function(m) { this._fillMaterial = m; }
96
97 this.getStrokeColor = function() { return this._strokeColor; }
98 //this.setStrokeColor = function(c) { this._strokeColor = c; }
99
100 this.getFillColor = function() { return this._fillColor; }
101 //this.setFillColor = function(c) { this._fillColor = c.slice(0); }
102
103 this.getTLRadius = function() { return this._tlRadius; }
104 this.setTLRadius = function(r) { this._tlRadius = Math.min(r, (this._height - this._strokeWidth)/2, (this._width - this._strokeWidth)/2); }
105
106 this.getTRRadius = function() { return this._trRadius; }
107 this.setTRRadius = function(r) { this._trRadius = Math.min(r, (this._height - this._strokeWidth)/2, (this._width - this._strokeWidth)/2); }
108
109 this.getBLRadius = function() { return this._blRadius; }
110 this.setBLRadius = function(r) { this._blRadius = Math.min(r, (this._height - this._strokeWidth)/2, (this._width - this._strokeWidth)/2); }
111
112 this.getBRRadius = function() { return this._brRadius; }
113 this.setBRRadius = function(r) { this._brRadius = Math.min(r, (this._height - this._strokeWidth)/2, (this._width - this._strokeWidth)/2); }
114
115 this.getStrokeStyle = function() { return this._strokeStyle; }
116 this.setStrokeStyle = function(s) { this._strokeStyle = s; }
117
118 this.getWidth = function() { return this._width; }
119 this.setWidth = function(w) { this._width = w; }
120
121 this.getHeight = function() { return this._height; }
122 this.setHeight = function(h) { this._height = h; }
123
124 this.geomType = function() { return this.GEOM_TYPE_RECTANGLE; }
125
126
127 ///////////////////////////////////////////////////////////////////////
128 // Methods
129 ///////////////////////////////////////////////////////////////////////
130 this.export = function()
131 {
132 var rtnStr = "type: " + this.geomType() + "\n";
133
134 /////////////////////////////////////////////////////////////////////////
135 //
136 // world, xOffset, yOffset, width, height, strokeSize, strokeColor, fillColor,
137 // tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle
138 //
139 /////////////////////////////////////////////////////////////////////////////
140
141 rtnStr += "xoff: " + this._xOffset + "\n";
142 rtnStr += "yoff: " + this._yOffset + "\n";
143 rtnStr += "width: " + this._width + "\n";
144 rtnStr += "height: " + this._height + "\n";
145 rtnStr += "strokeWidth: " + this._strokeWidth + "\n";
146 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n";
147 rtnStr += "fillColor: " + String(this._fillColor) + "\n";
148 rtnStr += "tlRadius: " + this._tlRadius + "\n";
149 rtnStr += "trRadius: " + this._trRadius + "\n";
150 rtnStr += "blRadius: " + this._blRadius + "\n";
151 rtnStr += "brRadius: " + this._brRadius + "\n";
152 rtnStr += "innerRadius: " + this._innerRadius + "\n";
153 rtnStr += "strokeStyle: " + this._strokeStyle + "\n";
154
155 rtnStr += "strokeMat: ";
156 if (this._strokeMaterial)
157 rtnStr += this._strokeMaterial.getName();
158 else
159 rtnStr += "flatMaterial";
160 rtnStr += "\n";
161
162 rtnStr += "fillMat: ";
163 if (this._fillMaterial)
164 rtnStr += this._fillMaterial.getName();
165 else
166 rtnStr += "flatMaterial";
167 rtnStr += "\n";
168
169 return rtnStr;
170 }
171
172 this.import = function( importStr )
173 {
174 this._xOffset = Number( this.getPropertyFromString( "xoff: ", importStr ) );
175 this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) );
176 this._width = Number( this.getPropertyFromString( "width: ", importStr ) );
177 this._height = Number( this.getPropertyFromString( "height: ", importStr ) );
178 this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) );
179 this._innerRadius = Number( this.getPropertyFromString( "innerRadius: ", importStr ) );
180 this._strokeStyle = Number( this.getPropertyFromString( "strokeStyle: ", importStr ) );
181 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
182 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr );
183 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr );
184 this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" );
185 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
186 this._tlRadius = Number( this.getPropertyFromString( "tlRadius: ", importStr ) );
187 this._trRadius = Number( this.getPropertyFromString( "trRadius: ", importStr ) );
188