aboutsummaryrefslogtreecommitdiff
path: root/js/tools/RotateObject3DTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/RotateObject3DTool.js')
-rw-r--r--js/tools/RotateObject3DTool.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/js/tools/RotateObject3DTool.js b/js/tools/RotateObject3DTool.js
new file mode 100644
index 00000000..72af6eff
--- /dev/null
+++ b/js/tools/RotateObject3DTool.js
@@ -0,0 +1,64 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7var Montage = require("montage/core/core").Montage;
8
9var Rotate3DToolBase = require("js/tools/Rotate3DToolBase").Rotate3DToolBase;
10var toolHandleModule = require("js/stage/tool-handle");
11
12exports.RotateObject3DTool = Montage.create(Rotate3DToolBase, {
13 _toolID: { value: "rotateObject3DTool" },
14 _imageID: { value: "rotateObject3DToolImg" },
15 _toolImageClass: { value: "rotateObject3DToolUp" },
16 _selectedToolImageClass: { value: "rotateObject3DToolDown" },
17 _toolTipText : { value : "3D Rotate Object Tool" },
18
19 _initializeToolHandles: {
20 value: function() {
21 if(!this._handles)
22 {
23 this._handles = [];
24 // rotateX
25 var rX = toolHandleModule.RotateHandle.create();
26 rX.init("url('images/cursors/Translate_X.png') 0 0, default", 'rgba(255,0,0,1)', "x");
27 this._handles.push(rX);
28 // rotateY
29 var rY = toolHandleModule.RotateHandle.create();
30 rY.init("url('images/cursors/Translate_Y.png') 0 0, default", 'rgba(0,255,0,1)', "y");
31 this._handles.push(rY);
32
33 // rotateZ
34 var rZ = toolHandleModule.RotateHandle.create();
35 rZ.init("url('images/cursors/Translate_Z.png') 0 0, default", 'rgba(0,0,255,1)', "z");
36 this._handles.push(rZ);
37 }
38 else
39 {
40 // may need to reset values if they were changed by the stage rotate tool
41 var len = this._handles.length;
42 var i = 0,
43 toolHandle;
44 for (i=0; i<len; i++)
45 {
46 toolHandle = this._handles[i];
47 toolHandle._lineWidth = 2;
48 toolHandle._radius = 50;
49 toolHandle._nTriangles = 30;
50 var angle = 2.0*Math.PI/Number(toolHandle._nTriangles);
51 toolHandle._rotMat = Matrix.RotationZ( angle );
52 }
53 }
54 }
55 },
56
57 _handleToolOptionsChange: {
58 value: function(event) {
59 this._inLocalMode = event.detail.mode;
60 this.DrawHandles();
61 }
62 }
63
64});