aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/lib/geom/brush-stroke.js5
-rwxr-xr-xjs/models/element-model.js4
-rwxr-xr-xjs/panels/properties.reel/sections/three-d-view.reel/three-d-view.js66
-rwxr-xr-xjs/tools/PenTool.js49
5 files changed, 99 insertions, 27 deletions
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index e9df5e58..03753da9 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.10.0.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.10.0.0"},
4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.9.0"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.6.0.0"}
5 ] 5 ]
6} \ No newline at end of file 6} \ No newline at end of file
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index d9c2ab53..0e0406dd 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -719,7 +719,10 @@ BrushStroke.prototype.drawToContext = function(ctx, drawStageWorldPts, stageWorl
719 var disp = [brushStamp[t][0], brushStamp[t][1]]; 719 var disp = [brushStamp[t][0], brushStamp[t][1]];
720 var alphaVal = 1.0; 720 var alphaVal = 1.0;
721 var distFromOpaqueRegion = Math.abs(t-halfNumTraces) - opaqueRegionHalfWidth; 721 var distFromOpaqueRegion = Math.abs(t-halfNumTraces) - opaqueRegionHalfWidth;
722 if (distFromOpaqueRegion>0) { 722 if (numTraces === 1){
723 distFromOpaqueRegion = 0;
724 }
725 else if (distFromOpaqueRegion>0) {
723 var transparencyFactor = distFromOpaqueRegion/maxTransparentRegionHalfWidth; 726 var transparencyFactor = distFromOpaqueRegion/maxTransparentRegionHalfWidth;
724 alphaVal = 1.0 - transparencyFactor;//(transparencyFactor*transparencyFactor);//the square term produces nonlinearly varying alpha values 727 alphaVal = 1.0 - transparencyFactor;//(transparencyFactor*transparencyFactor);//the square term produces nonlinearly varying alpha values
725 alphaVal *= 0.5; //factor that accounts for lineWidth == 2 728 alphaVal *= 0.5; //factor that accounts for lineWidth == 2
diff --git a/js/models/element-model.js b/js/models/element-model.js
index 76f15b21..e5a0f33a 100755
--- a/js/models/element-model.js
+++ b/js/models/element-model.js
@@ -91,6 +91,8 @@ var elementNameToController = function(name) {
91 return "block"; 91 return "block";
92 } else if(name === "img") { 92 } else if(name === "img") {
93 return "image"; 93 return "image";
94 } else if(name === "embed") {
95 return "image";
94 } else { 96 } else {
95 return name; 97 return name;
96 } 98 }
@@ -174,6 +176,8 @@ var elmo = exports.ElementModel = Montage.create(Montage, {
174 return "block"; 176 return "block";
175 } else if(name === "img") { 177 } else if(name === "img") {
176 return "image"; 178 return "image";
179 } else if(name === "embed") {
180 return "image";
177 } else { 181 } else {
178 return name; 182 return name;
179 } 183 }
diff --git a/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js b/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js
index 104d474d..f8d158ce 100755
--- a/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js
+++ b/js/panels/properties.reel/sections/three-d-view.reel/three-d-view.js
@@ -4,8 +4,8 @@ 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 Montage = require("montage/core/core").Montage; 7var Montage = require("montage/core/core").Montage,
8var Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10exports.ThreeD = Montage.create(Component, { 10exports.ThreeD = Montage.create(Component, {
11 11
@@ -107,6 +107,10 @@ exports.ThreeD = Montage.create(Component, {
107 value: null 107 value: null
108 }, 108 },
109 109
110 _transformCtr: {
111 value: null
112 },
113
110 handleAction: { 114 handleAction: {
111 value: function(event) { 115 value: function(event) {
112 if(event.currentTarget.identifier === "flatten") { 116 if(event.currentTarget.identifier === "flatten") {
@@ -143,10 +147,20 @@ exports.ThreeD = Montage.create(Component, {
143 value : function(prop, value, item, inGlobalMode, isChanging){ 147 value : function(prop, value, item, inGlobalMode, isChanging){
144 if(!this._curMat) { 148 if(!this._curMat) {
145 this._curMat = this.application.ninja.elementMediator.getMatrix(item); 149 this._curMat = this.application.ninja.elementMediator.getMatrix(item);
150// this._transformCtr = item.elementModel.props3D.m_transformCtr || [0,0,0];
151 // TODO - Always use the center for now until we support multiple selections
152 this._transformCtr = [0,0,0];
153 if(inGlobalMode) {
154 this._transformCtr = MathUtils.transformPoint(this._transformCtr, this._curMat);
155 }
146 } 156 }
147 157
148 var curMat = this._curMat; 158 var curMat = this._curMat,
149 var delta = value.value; 159 delta = value.value,
160 isRotating = false,
161 xFormMat = Matrix.I(4),
162 tMat = Matrix.I(4),
163 mat = [];
150 if(inGlobalMode) { 164 if(inGlobalMode) {
151 165
152 if(!this._curProp) { 166 if(!this._curProp) {
@@ -156,17 +170,19 @@ exports.ThreeD = Montage.create(Component, {
156 delta -= this._curProp; 170 delta -= this._curProp;
157 } 171 }
158 172
159 var xFormMat = Matrix.I(4);
160 switch (prop) 173 switch (prop)
161 { 174 {
162 case "xAngle": 175 case "xAngle":
163 xFormMat = Matrix.RotationX(MathUtils.DEG_TO_RAD * delta); 176 xFormMat = Matrix.RotationX(MathUtils.DEG_TO_RAD * delta);
177 isRotating = true;
164 break; 178 break;
165 case "yAngle": 179 case "yAngle":
166 xFormMat = Matrix.RotationY(MathUtils.DEG_TO_RAD * delta); 180 xFormMat = Matrix.RotationY(MathUtils.DEG_TO_RAD * delta);
181 isRotating = true;
167 break; 182 break;
168 case "zAngle": 183 case "zAngle":
169 xFormMat = Matrix.RotationZ(MathUtils.DEG_TO_RAD * delta); 184 xFormMat = Matrix.RotationZ(MathUtils.DEG_TO_RAD * delta);
185 isRotating = true;
170 break; 186 break;
171 case "x3D": 187 case "x3D":
172 xFormMat[12] = delta; 188 xFormMat[12] = delta;
@@ -179,11 +195,45 @@ exports.ThreeD = Montage.create(Component, {
179 break; 195 break;
180 } 196 }
181 197
182 var mat = [];
183 if(inGlobalMode) { 198 if(inGlobalMode) {
184 glmat4.multiply(xFormMat, curMat, mat); 199
200 if(isRotating) {
201
202 // pre-translate by the transformation center
203 tMat[12] = this._transformCtr[0];
204 tMat[13] = this._transformCtr[1];
205 tMat[14] = this._transformCtr[2];
206
207 glmat4.multiply(tMat, xFormMat, mat);
208
209 // translate back
210 tMat[12] = -this._transformCtr[0];
211 tMat[13] = -this._transformCtr[1];
212 tMat[14] = -this._transformCtr[2];
213
214 glmat4.multiply(mat, tMat, mat);
215 glmat4.multiply(mat, curMat, mat);
216 } else {
217 glmat4.multiply(xFormMat, curMat, mat);
218 }
185 } else { 219 } else {
186 glmat4.multiply(curMat, xFormMat, mat); 220 if(isRotating) {
221 tMat[12] = this._transformCtr[0];
222 tMat[13] = this._transformCtr[1];
223 tMat[14] = this._transformCtr[2];
224
225 glmat4.multiply(curMat, tMat, mat);
226
227 // translate back
228 tMat[12] = -this._transformCtr[0];
229 tMat[13] = -this._transformCtr[1];
230 tMat[14] = -this._transformCtr[2];
231
232 glmat4.multiply(mat, xFormMat, mat);
233 glmat4.multiply(mat, tMat, mat);
234 } else {
235 glmat4.multiply(curMat, xFormMat, mat);
236 }
187 } 237 }
188 238
189 if(isChanging) { 239 if(isChanging) {
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index e296d0e5..33ca5c71 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -288,16 +288,35 @@ exports.PenTool = Montage.create(ShapeTool, {
288 288
289 //assume we are not starting a new path as we will set this to true if we create a new Subpath() 289 //assume we are not starting a new path as we will set this to true if we create a new Subpath()
290 this._isNewPath = false; 290 this._isNewPath = false;
291
292 //if we had closed the selected subpath previously, or if we have not yet started anything, create a subpath
293 if (this._entryEditMode !== this.ENTRY_SELECT_PATH && this._selectedSubpath && this._selectedSubpath.getIsClosed() && this._makeMultipleSubpaths) {
294 this._selectedSubpath = null;
295 }
296 291
297 if (this._subtool !== this.SUBTOOL_NONE && this._selectedSubpath===null) { 292 if (this._subtool !== this.SUBTOOL_NONE && this._selectedSubpath===null) {
298 //do nothing becaus