diff options
Diffstat (limited to 'js/components/tools-properties/brush-properties.reel/brush-properties.js')
-rwxr-xr-x | js/components/tools-properties/brush-properties.reel/brush-properties.js | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/js/components/tools-properties/brush-properties.reel/brush-properties.js b/js/components/tools-properties/brush-properties.reel/brush-properties.js index fdcd50f8..7a0d21f1 100755 --- a/js/components/tools-properties/brush-properties.reel/brush-properties.js +++ b/js/components/tools-properties/brush-properties.reel/brush-properties.js | |||
@@ -8,7 +8,46 @@ var Montage = require("montage/core/core").Montage; | |||
8 | var Component = require("montage/ui/component").Component; | 8 | var Component = require("montage/ui/component").Component; |
9 | var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; | 9 | var ToolProperties = require("js/components/tools-properties/tool-properties").ToolProperties; |
10 | 10 | ||
11 | exports.BrushProperties = Montage.create(ToolProperties, { | 11 | var BrushProperties = exports.BrushProperties = Montage.create(ToolProperties, { |
12 | addedColorChips: { value: false }, | ||
13 | |||
14 | _fill: { | ||
15 | enumerable: false, | ||
16 | value: { colorMode: 'rgb', color: { r: 0, g: 0, b: 0, a: 1, css: 'rgb(0,0,0)', mode: 'rgb', wasSetByCode: true, type: 'change' }, webGlColor: [0, 0, 0, 1] } | ||
17 | }, | ||
18 | |||
19 | fill: { | ||
20 | enumerable: true, | ||
21 | get: function () { | ||
22 | return this._fill; | ||
23 | }, | ||
24 | set: function (value) { | ||
25 | if (value !== this._fill) { | ||
26 | this._fill = value; | ||
27 | } | ||
28 | } | ||
29 | }, | ||
30 | |||
31 | draw: { | ||
32 | enumerable: false, | ||
33 | value: function () { | ||
34 | Object.getPrototypeOf(BrushProperties).draw.call(this); | ||
35 | |||
36 | if (this.addedColorChips === false && this.application.ninja.colorController.colorPanelDrawn) { | ||
37 | this._fillColorCtrl.props = { side: 'top', align: 'center', wheel: true, palette: true, gradient: false, image: false, nocolor: true, offset: -80 }; | ||
38 | this.application.ninja.colorController.addButton("chip", this._fillColorCtrl); | ||
39 | |||
40 | this._fillColorCtrl.addEventListener("change", this.handleFillColorChange.bind(this), false); | ||
41 | |||
42 | this.addedColorChips = true; | ||
43 | } | ||
44 | |||
45 | if (this.addedColorChips) { | ||
46 | this._fillColorCtrl.color(this._fill.colorMode, this._fill.color); | ||
47 | } | ||
48 | } | ||
49 | }, | ||
50 | |||
12 | _subPrepare: { | 51 | _subPrepare: { |
13 | value: function() { | 52 | value: function() { |
14 | this.handleChange(null); | 53 | this.handleChange(null); |
@@ -36,6 +75,14 @@ exports.BrushProperties = Montage.create(ToolProperties, { | |||
36 | } | 75 | } |
37 | } | 76 | } |
38 | }, | 77 | }, |
78 | |||
79 | handleFillColorChange: { | ||
80 | value: function (e) { | ||
81 | this.fill = e._event; | ||
82 | this.fill.webGlColor = this.application.ninja.colorController.colorModel.colorToWebGl(e._event.color); | ||
83 | } | ||
84 | }, | ||
85 | |||
39 | strokeSize: { | 86 | strokeSize: { |
40 | get: function() { return this._strokeSize; } | 87 | get: function() { return this._strokeSize; } |
41 | }, | 88 | }, |