diff options
author | Valerio Virgillito | 2012-02-09 13:41:45 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-09 13:41:45 -0800 |
commit | f5193cd04a2597051d88fced878efbc4802ea64c (patch) | |
tree | dc343dc98fa9f99133d9882bd9b92cfe81296d1a /js | |
parent | e2539230b8a297fa972af6d53fe9de3ef2ad43fa (diff) | |
parent | 666ae3e9119410cbf7fa974274d95336aaff091c (diff) | |
download | ninja-f5193cd04a2597051d88fced878efbc4802ea64c.tar.gz |
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js')
46 files changed, 2101 insertions, 2344 deletions
diff --git a/js/components/tools-properties/pen-properties.reel/pen-properties.html b/js/components/tools-properties/pen-properties.reel/pen-properties.html index 7af35a03..74a3a747 100644 --- a/js/components/tools-properties/pen-properties.reel/pen-properties.html +++ b/js/components/tools-properties/pen-properties.reel/pen-properties.html | |||
@@ -12,12 +12,25 @@ | |||
12 | <script type="text/montage-serialization"> | 12 | <script type="text/montage-serialization"> |
13 | { | 13 | { |
14 | 14 | ||
15 | "strokeSizeHT": { | ||
16 | "module": "js/components/hottextunit.reel", | ||
17 | "name": "HotTextUnit", | ||
18 | "properties": { | ||
19 | "element": {"#": "strokeSize"}, | ||
20 | "minValue": 1, | ||
21 | "maxValue": 100, | ||
22 | "value": 1, | ||
23 | "decimalPlace": 10, | ||
24 | "acceptableUnits" : ["px", "pt"] | ||
25 | } | ||
26 | }, | ||
27 | |||
15 | "owner": { | 28 | "owner": { |
16 | "module": "js/components/tools-properties/pen-properties.reel", | 29 | "module": "js/components/tools-properties/pen-properties.reel", |
17 | "name": "PenProperties", | 30 | "name": "PenProperties", |
18 | "properties": { | 31 | "properties": { |
19 | "element": {"#": "penProperties"}, | 32 | "element": {"#": "penProperties"}, |
20 | "reset": {"#": "resetPenTool"} | 33 | "_strokeSize": {"@": "strokeSizeHT"} |
21 | } | 34 | } |
22 | } | 35 | } |
23 | } | 36 | } |
@@ -26,9 +39,12 @@ | |||
26 | </head> | 39 | </head> |
27 | 40 | ||
28 | <body> | 41 | <body> |
29 | <div id="penProperties" class="subToolHolderPanel"> | 42 | <div id="penProperties" class="subToolHolderPanel"> |
30 | <button id="resetPenTool" tabindex="0" class="montage-button" aria-role="button" aria-busy="false">Reset</button> | 43 | <div id="strokesContainer" class="leftLabel" style="margin-left:25px; padding-top: 3px;"> |
44 | <label class="label"> Stroke:</label> | ||
45 | <div id="strokeSize" class="label"></div> | ||
31 | </div> | 46 | </div> |
47 | </div> | ||
32 | </body> | 48 | </body> |
33 | 49 | ||
34 | </html> \ No newline at end of file | 50 | </html> \ No newline at end of file |
diff --git a/js/components/tools-properties/pen-properties.reel/pen-properties.js b/js/components/tools-properties/pen-properties.reel/pen-properties.js index ec8efa69..b57f9a6f 100644 --- a/js/components/tools-properties/pen-properties.reel/pen-properties.js +++ b/js/components/tools-properties/pen-properties.reel/pen-properties.js | |||
@@ -5,24 +5,10 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage; | 7 | var Montage = require("montage/core/core").Montage; |
8 | var Component = require("montage/ui/component").Component; | ||
9 | var defaultEventManager = require("montage/core/event/event-manager").defaultEventManager; | ||
10 | var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; | 8 | var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; |
11 | 9 | ||
12 | exports.PenProperties = Montage.create(ToolProperties, { | 10 | exports.PenProperties = Montage.create(ToolProperties, { |
13 | reset: { value: null }, | 11 | strokeSize: { |
14 | 12 | get: function() { return this._strokeSize; } | |
15 | _subPrepare: { | ||
16 | value: function() { | ||
17 | this.reset.addEventListener("click", this, false); | ||
18 | } | ||
19 | }, | ||
20 | |||
21 | handleClick: { | ||
22 | value: function(event) { | ||
23 | var newEvent = document.createEvent( "CustomEvent" ); | ||
24 | newEvent.initCustomEvent( "resetPenTool", false, true ); | ||
25 | defaultEventManager.dispatchEvent( newEvent ); | ||
26 | } | ||
27 | } | 13 | } |
28 | }); \ No newline at end of file | 14 | }); \ No newline at end of file |
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 | } | ||