diff options
author | Jose Antonio Marquez | 2012-02-08 13:14:29 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-08 13:14:29 -0800 |
commit | 9b45b897949bf934c8bf2c90ee2ff78f8713cb12 (patch) | |
tree | e7c276a3934c823cab894f46ee7dc5d3eda9ca83 /js/helper-classes/3D | |
parent | aa01c1210f3a4d9fd55a771b9de2c58ee3fa4bb6 (diff) | |
parent | 10cdeb52403f16d5d4be43a516e8cdfbc866a2a2 (diff) | |
download | ninja-9b45b897949bf934c8bf2c90ee2ff78f8713cb12.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into Color
Conflicts:
js/controllers/elements/shapes-controller.js
js/data/pi/pi-data.js
js/panels/properties/content.reel/content.js
Diffstat (limited to 'js/helper-classes/3D')
-rw-r--r-- | js/helper-classes/3D/draw-utils.js | 47 | ||||
-rw-r--r-- | js/helper-classes/3D/snap-manager.js | 15 |
2 files changed, 51 insertions, 11 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index fd96af4d..c07391db 100644 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -71,6 +71,9 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
71 | 71 | ||
72 | _selectionCtr : {value: null, writable: true }, | 72 | _selectionCtr : {value: null, writable: true }, |
73 | 73 | ||
74 | // Properties that require element planes to be updated | ||
75 | _updatePlaneProps : {value: ["matrix", "left", "top", "width", "height"], writable: false }, | ||
76 | |||
74 | /////////////////////////////////////////////////////////////////////// | 77 | /////////////////////////////////////////////////////////////////////// |
75 | // Property accessors | 78 | // Property accessors |
76 | /////////////////////////////////////////////////////////////////////// | 79 | /////////////////////////////////////////////////////////////////////// |
@@ -107,6 +110,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
107 | 110 | ||
108 | this.eventManager.addEventListener("elementAdded", this, false); | 111 | this.eventManager.addEventListener("elementAdded", this, false); |
109 | this.eventManager.addEventListener("elementDeleted", this, false); | 112 | this.eventManager.addEventListener("elementDeleted", this, false); |
113 | this.eventManager.addEventListener("deleteSelection", this, false); | ||
110 | this.eventManager.addEventListener("elementChange", this, false); | 114 | this.eventManager.addEventListener("elementChange", this, false); |
111 | } | 115 | } |
112 | }, | 116 | }, |
@@ -124,11 +128,44 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
124 | } | 128 | } |
125 | }, | 129 | }, |
126 | 130 | ||
131 | handleDeleteSelection: { | ||
132 | value: function(event) { | ||
133 | this.drawWorkingPlane(); | ||
134 | } | ||
135 | }, | ||
136 | |||
137 | _shouldUpdatePlanes: { | ||
138 | value: function(props) { | ||
139 | if(!props) | ||
140 | { | ||
141 | return false; | ||
142 | } | ||
143 | else if (typeof props === "string") | ||
144 | { | ||
145 | return (this._updatePlaneProps.indexOf(props) !== -1); | ||
146 | } | ||
147 | |||
148 | for (var p in props) | ||
149 | { | ||
150 | if(this._updatePlaneProps.indexOf(p) !== -1) | ||
151 | { | ||
152 | return true; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | return false; | ||
157 | } | ||
158 | }, | ||
127 | 159 | ||
160 | // TODO - Check why handleElementChange is being fired before handleAddElement | ||
128 | handleElementChange: { | 161 | handleElementChange: { |
129 | value: function(event) { | 162 | value: function(event) { |
163 | if(!event.detail || !event.detail.data) | ||
164 | { | ||
165 | return; | ||
166 | } | ||
130 | var els = event.detail.data.els; | 167 | var els = event.detail.data.els; |
131 | if(els) | 168 | if(els && this._shouldUpdatePlanes(event.detail.data.prop)) |
132 | { | 169 | { |
133 | var len = els.length, | 170 | var len = els.length, |
134 | i = 0, | 171 | i = 0, |
@@ -138,10 +175,15 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
138 | for(i=0; i < len; i++) { | 175 | for(i=0; i < len; i++) { |
139 | item = els[i]; | 176 | item = els[i]; |
140 | el = item._element || item; | 177 | el = item._element || item; |
141 | el.elementModel.props3D.elementPlane.init(); | 178 | if(el.elementModel.props3D.elementPlane) |
179 | { | ||
180 | el.elementModel.props3D.elementPlane.init(); | ||
181 | } | ||
142 | } | 182 | } |
143 | 183 | ||
184 | this.application.ninja.stage.layout.draw(); | ||
144 | this.drawWorkingPlane(); | 185 | this.drawWorkingPlane(); |
186 | this.draw3DCompass(); | ||
145 | } | 187 | } |
146 | } | 188 | } |
147 | }, | 189 | }, |
@@ -1065,7 +1107,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1065 | var tmpCanvas = this.application.ninja.stage.canvas; | 1107 | var tmpCanvas = this.application.ninja.stage.canvas; |
1066 | var tmpStage = this.application.ninja.currentDocument.documentRoot; | 1108 | var tmpStage = this.application.ninja.currentDocument.documentRoot; |
1067 | this.viewUtils.pushViewportObj( tmpCanvas ); | 1109 | this.viewUtils.pushViewportObj( tmpCanvas ); |
1068 | var tmpStage = this.application.ninja.currentDocument.documentRoot; | ||
1069 | 1110 | ||
1070 | // save the source space object and set to the target object | 1111 | // save the source space object and set to the target object |
1071 | var saveSource = this._sourceSpaceElt; | 1112 | var saveSource = this._sourceSpaceElt; |
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 8819f637..3af7d8cf 100644 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -9,14 +9,13 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
9 | // Class to do hit testing of objects in the html page | 9 | // Class to do hit testing of objects in the html page |
10 | /////////////////////////////////////////////////////////////////////// | 10 | /////////////////////////////////////////////////////////////////////// |
11 | var Montage = require("montage/core/core").Montage, | 11 | var Montage = require("montage/core/core").Montage, |
12 | Component = require("montage/ui/component").Component; | 12 | Component = require("montage/ui/component").Component, |
13 | 13 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, | |
14 | var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils; | 14 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, |
15 | var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; | 15 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, |
16 | var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; | 16 | HitRecord = require("js/helper-classes/3D/hit-record").HitRecord, |
17 | var HitRecord = require("js/helper-classes/3D/hit-record").HitRecord; | 17 | Snap2DRecord = require("js/helper-classes/3D/snap-2d-record").Snap2DRecord, |
18 | var Snap2DRecord = require("js/helper-classes/3D/snap-2d-record").Snap2DRecord; | 18 | NJUtils = require("js/lib/NJUtils").NJUtils; |
19 | var NJUtils = require("js/lib/NJUtils").NJUtils; | ||
20 | 19 | ||
21 | var SnapManager = exports.SnapManager = Montage.create(Component, { | 20 | var SnapManager = exports.SnapManager = Montage.create(Component, { |
22 | /////////////////////////////////////////////////////////////////////// | 21 | /////////////////////////////////////////////////////////////////////// |