diff options
Diffstat (limited to 'js/panels/properties/sections/custom.reel/custom.js')
-rw-r--r-- | js/panels/properties/sections/custom.reel/custom.js | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index 992db8e6..5315defc 100644 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js | |||
@@ -6,6 +6,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
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; | 8 | var Component = require("montage/ui/component").Component; |
9 | var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | ||
9 | 10 | ||
10 | //Custom Rows | 11 | //Custom Rows |
11 | var SingleRow = require("js/panels/properties/sections/custom-rows/single-row.reel").SingleRow; | 12 | var SingleRow = require("js/panels/properties/sections/custom-rows/single-row.reel").SingleRow; |
@@ -18,7 +19,7 @@ var Dropdown = require("js/components/combobox.reel").Combobox; | |||
18 | var TextField = require("js/components/textfield.reel").TextField; | 19 | var TextField = require("js/components/textfield.reel").TextField; |
19 | var FileInput = require("js/components/ui/file-input.reel").FileInput; | 20 | var FileInput = require("js/components/ui/file-input.reel").FileInput; |
20 | var Checkbox = require("js/components/checkbox.reel").Checkbox; | 21 | var Checkbox = require("js/components/checkbox.reel").Checkbox; |
21 | 22 | var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; | |
22 | 23 | ||
23 | exports.CustomSection = Montage.create(Component, { | 24 | exports.CustomSection = Montage.create(Component, { |
24 | 25 | ||
@@ -88,10 +89,8 @@ exports.CustomSection = Montage.create(Component, { | |||
88 | value:{} | 89 | value:{} |
89 | }, | 90 | }, |
90 | 91 | ||
91 | handleChanging: | 92 | handleChanging: { |
92 | { | 93 | value:function(event) { |
93 | value:function(event) | ||
94 | { | ||
95 | var obj = event.currentTarget; | 94 | var obj = event.currentTarget; |
96 | this._dispatchPropEvent({"type": "changing", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); | 95 | this._dispatchPropEvent({"type": "changing", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); |
97 | } | 96 | } |
@@ -106,6 +105,26 @@ exports.CustomSection = Montage.create(Component, { | |||
106 | } | 105 | } |
107 | }, | 106 | }, |
108 | 107 | ||
108 | handleColorChange: { | ||
109 | value: function(event) { | ||
110 | // Change the stage color for now | ||
111 | console.log(this); | ||
112 | console.log(event); | ||
113 | console.log(event._event.color.css); | ||
114 | ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], "background", [event._event.color.css], "Change", "pi", 'foo'); | ||
115 | /* | ||
116 | var propEvent = document.createEvent("CustomEvent"); | ||
117 | propEvent.initEvent("propertyChange", true, true); | ||
118 | propEvent.type = "propertyChange"; | ||
119 | |||
120 | propEvent.prop = "background";//event.prop; | ||
121 | propEvent.value = event._event.color.css; | ||
122 | |||
123 | this.dispatchEvent(propEvent); | ||
124 | */ | ||
125 | } | ||
126 | }, | ||
127 | |||
109 | _dispatchPropEvent: { | 128 | _dispatchPropEvent: { |
110 | value: function(event) { | 129 | value: function(event) { |
111 | // console.log(event); | 130 | // console.log(event); |
@@ -140,6 +159,7 @@ exports.CustomSection = Montage.create(Component, { | |||
140 | case "textbox" : return this.createTextField(fields); | 159 | case "textbox" : return this.createTextField(fields); |
141 | case "file" : return this.createFileInput(fields); | 160 | case "file" : return this.createFileInput(fields); |
142 | case "checkbox" : return this.createCheckbox(fields); | 161 | case "checkbox" : return this.createCheckbox(fields); |
162 | case "chip" : return this.createColorChip(fields); | ||
143 | } | 163 | } |
144 | } | 164 | } |
145 | }, | 165 | }, |
@@ -305,6 +325,22 @@ exports.CustomSection = Montage.create(Component, { | |||
305 | 325 | ||
306 | return obj; | 326 | return obj; |
307 | } | 327 | } |
328 | }, | ||
329 | |||
330 | createColorChip: { | ||
331 | value: function(aField) { | ||
332 | var obj = ColorChip.create(); | ||
333 | obj.chip = true; | ||
334 | obj.iconType = "fillIcon"; | ||
335 | obj.mode = "chip"; | ||
336 | obj.offset = 0; | ||
337 | |||
338 | obj.changeDelegate = this.handleColorChange; | ||
339 | |||
340 | this.controls[aField.id] = obj; | ||
341 | |||
342 | return obj; | ||
343 | } | ||
308 | } | 344 | } |
309 | 345 | ||
310 | }); \ No newline at end of file | 346 | }); \ No newline at end of file |