aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorhwc4872012-03-06 13:10:19 -0800
committerhwc4872012-03-06 13:10:19 -0800
commit11c3fa444217a34fa481b156d4d919d10e817350 (patch)
tree1b81aef7684df9ed01cc88a4a1a7099cae136723 /js/document
parente87069b43027b6b1707bb065a1f331b600b5db58 (diff)
downloadninja-11c3fa444217a34fa481b156d4d919d10e817350.tar.gz
update the shapeModel after import
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/html-document.js48
1 files changed, 46 insertions, 2 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 8722e223..f1847357 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -226,8 +226,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
226 world.import( importStr ); 226 world.import( importStr );
227 canvas.elementModel.shapeModel.GLWorld = world; 227 canvas.elementModel.shapeModel.GLWorld = world;
228 228
229 /////////////////////////// 229 this.buildShapeModel( canvas.elementModel.shapeModel, world );
230 //something.buildShapeModel( world ); // to come from Nivesh
231 } 230 }
232 } 231 }
233 } 232 }
@@ -239,6 +238,51 @@ exports.HTMLDocument = Montage.create(TextDocument, {
239 } 238 }
240 }, 239 },
241 240
241 buildShapeModel:
242 {
243 value: function( shapeModel, world )
244 {
245 shapeModel.shapeCount = 1; // for now...
246 shapeModel.useWebGl = world._useWebGL;
247 shapeModel.GLWorld = world;
248 var root = world.getGeomRoot();
249 if (root)
250 {
251 shapeModel.GLGeomObj = root;
252 shapeModel.strokeSize = root._strokeWidth;
253 shapeModel.stroke = root._strokeColor.slice();
254 shapeModel.strokeMaterial = root._strokeMaterial.dup();
255 shapeModel.strokeStyle = "solid";
256 //shapeModel.strokeStyleIndex
257 //shapeModel.border
258 shapeModel.fill = root._fillColor.slice();
259 shapeModel.fillMaterial = root._fillMaterial.dup();
260 //shapeModel.background
261 switch (root.geomType())
262 {
263 case root.GEOM_TYPE_RECTANGLE:
264 shapeModel.tlRadius = root._tlRadius;
265 shapeModel.trRadius = root._trRadius;
266 shapeModel.blRadius = root._blRadius;
267 shapeModel.brRadius = root._brRadius;
268 break;
269
270 case root.GEOM_TYPE_CIRCLE:
271 shapeModel.innerRadius = root._innerRadius;
272 break;
273
274 case root.GEOM_TYPE_LINE:
275 shapeModel.slope = root._slope;
276 break;
277
278 default:
279 console.log( "geometry type not supported for file I/O, " + root.geomType());
280 break;
281 }
282 }
283 }
284 },
285
242 zoomFactor: { 286 zoomFactor: {
243 get: function() { return this._zoomFactor; }, 287 get: function() { return this._zoomFactor; },
244 set: function(value) { this._zoomFactor = value; } 288 set: function(value) { this._zoomFactor = value; }