diff options
Diffstat (limited to 'js/controllers')
-rw-r--r-- | js/controllers/elements/shapes-controller.js | 25 | ||||
-rw-r--r-- | js/controllers/styles-controller.js | 4 |
2 files changed, 25 insertions, 4 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index e764de4e..b9c033aa 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -63,11 +63,11 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
63 | canvas.height = el.height; | 63 | canvas.height = el.height; |
64 | this.application.ninja.elementMediator.replaceElement(el, canvas); | 64 | this.application.ninja.elementMediator.replaceElement(el, canvas); |
65 | NJevent("elementDeleted", el); | 65 | NJevent("elementDeleted", el); |
66 | this.application.ninja.selectionController.selectElement(canvas); | ||
67 | el = canvas; | 66 | el = canvas; |
68 | this.toggleWebGlMode(el, value); | 67 | this.toggleWebGlMode(el, value); |
69 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | 68 | el.elementModel.shapeModel.GLWorld.render(); |
70 | break; | 69 | this.application.ninja.selectionController.selectElement(el); |
70 | return; | ||
71 | case "strokeMaterial": | 71 | case "strokeMaterial": |
72 | var sm = Object.create(MaterialsLibrary.getMaterial(value)); | 72 | var sm = Object.create(MaterialsLibrary.getMaterial(value)); |
73 | if(sm) | 73 | if(sm) |
@@ -338,13 +338,26 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
338 | { | 338 | { |
339 | return; | 339 | return; |
340 | } | 340 | } |
341 | var world, | 341 | var sm, |
342 | fm, | ||
343 | world, | ||
342 | worldData = el.elementModel.shapeModel.GLWorld.export(); | 344 | worldData = el.elementModel.shapeModel.GLWorld.export(); |
343 | if(worldData) | 345 | if(worldData) |
344 | { | 346 | { |
345 | world = new GLWorld(el, true); | 347 | world = new GLWorld(el, true); |
346 | el.elementModel.shapeModel.GLWorld = world; | 348 | el.elementModel.shapeModel.GLWorld = world; |
349 | el.elementModel.shapeModel.GLGeomObj.setWorld(world); | ||
347 | el.elementModel.shapeModel.useWebGl = true; | 350 | el.elementModel.shapeModel.useWebGl = true; |
351 | sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); | ||
352 | fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); | ||
353 | if(sm && fm) | ||
354 | { | ||
355 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); | ||
356 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); | ||
357 | el.elementModel.shapeModel.strokeMaterial = sm; | ||
358 | el.elementModel.shapeModel.fillMaterial = fm; | ||
359 | el.elementModel.shapeModel.GLGeomObj.buildBuffers(); | ||
360 | } | ||
348 | world.import(worldData); | 361 | world.import(worldData); |
349 | } | 362 | } |
350 | 363 | ||
@@ -365,6 +378,10 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
365 | world = new GLWorld(el, false); | 378 | world = new GLWorld(el, false); |
366 | el.elementModel.shapeModel.GLWorld = world; | 379 | el.elementModel.shapeModel.GLWorld = world; |
367 | el.elementModel.shapeModel.useWebGl = false; | 380 | el.elementModel.shapeModel.useWebGl = false; |
381 | el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null); | ||
382 | el.elementModel.shapeModel.GLGeomObj.setFillMaterial(null); | ||
383 | el.elementModel.shapeModel.strokeMaterial = null; | ||
384 | el.elementModel.shapeModel.fillMaterial = null; | ||
368 | world.import(worldData); | 385 | world.import(worldData); |
369 | } | 386 | } |
370 | 387 | ||
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 011caec5..44e0e798 100644 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -181,6 +181,10 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
181 | rule = stylesheet.rules[index]; | 181 | rule = stylesheet.rules[index]; |
182 | 182 | ||
183 | ///// attach specificity to rule object | 183 | ///// attach specificity to rule object |
184 | // if rule is css keyframes, return rule and don't attach specificity | ||
185 | if (rule instanceof WebKitCSSKeyframesRule) { | ||
186 | return rule; | ||
187 | } | ||
184 | rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText); | 188 | rule[this.CONST.SPECIFICITY_KEY] = this.getSpecificity(rule.selectorText); |
185 | 189 | ||
186 | ///// return the rule we just inserted | 190 | ///// return the rule we just inserted |