diff options
Diffstat (limited to 'js/panels/presets/transitions-presets.reel/transitions-presets.js')
-rw-r--r-- | js/panels/presets/transitions-presets.reel/transitions-presets.js | 71 |
1 files changed, 25 insertions, 46 deletions
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.js b/js/panels/presets/transitions-presets.reel/transitions-presets.js index bc91b3ad..f7d84085 100644 --- a/js/panels/presets/transitions-presets.reel/transitions-presets.js +++ b/js/panels/presets/transitions-presets.reel/transitions-presets.js | |||
@@ -5,63 +5,42 @@ | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component, |
9 | DefaultPresets = require("js/panels/presets/default-transition-presets").transitionPresets; | ||
9 | 10 | ||
10 | exports.TransitionsLibrary = Montage.create(Component, { | 11 | exports.TransitionsLibrary = Montage.create(Component, { |
11 | hasTemplate: { | 12 | hasTemplate: { |
12 | value: true | 13 | value: true |
13 | }, | 14 | }, |
14 | contentPanel : { | 15 | presetData : { |
15 | value: "presets" // get from local storage | 16 | value: null |
16 | }, | 17 | }, |
17 | templateDidLoad : { | 18 | deserializedFromTemplate : { |
18 | value: function() { | 19 | value: function() { |
19 | console.log('deserialized'); | 20 | this.presetData = DefaultPresets; |
20 | } | 21 | } |
21 | }, | 22 | }, |
22 | treeList : { | 23 | handleNodeActivation: { |
23 | value : null | 24 | value: function(presetData) { |
24 | }, | 25 | var selection = this.application.ninja.selectedElements, |
25 | data2: { | 26 | stylesController = this.application.ninja.stylesController, |
26 | value: { | 27 | selectorBase = presetData.selectorBase, |
27 | "meta": "Blah", | 28 | self = this; |
28 | "status": "OK", | ||
29 | "text" : "Root", | ||
30 | "data" : { | ||
31 | "date": "1.1.01", | ||
32 | "text": "Transitions", | ||
33 | "children": [{ | ||
34 | "date": "3.3.01", | ||
35 | "text": "Kid 1" | ||
36 | }, | ||
37 | { | ||
38 | "date": "3.3.01", | ||
39 | "text": "Kid 2", | ||
40 | "children": [{ | ||
41 | "date": "3.4.01", | ||
42 | "text": "Grand Kid 1", | ||
43 | "children": [{ | ||
44 | "date": "4.4.01", | ||
45 | "text": "Great Grand Kid 1" | ||
46 | }] | ||
47 | }] | ||
48 | 29 | ||
49 | },{ | 30 | if(!selection || !selection.length || selection.length === 0) { |
50 | "date": "5.5.01", | 31 | return false; |
51 | "text": "Kid 3" | ||
52 | }] | ||
53 | } | 32 | } |
54 | } | ||
55 | }, | ||
56 | didDraw: { | ||
57 | value : function() { | ||
58 | console.log('Presets Panel prepare for draw.'); | ||
59 | // this.treeList.items.push({ | ||
60 | // label : "Box Style", | ||
61 | // type : 'leaf' | ||
62 | // }); | ||
63 | } | ||
64 | } | ||
65 | 33 | ||
34 | selectorBase = stylesController.generateClassName(selectorBase); | ||
66 | 35 | ||
36 | presetData.rules.forEach(function(rule) { | ||
37 | this.application.ninja.stylesController.addRule('.' + selectorBase + rule.selectorSuffix, rule.styles); | ||
38 | }, this); | ||
39 | |||
40 | selection.forEach(function(el) { | ||
41 | el._element.classList.add(selectorBase); | ||
42 | }, this); | ||
43 | |||
44 | } | ||
45 | } | ||
67 | }); | 46 | }); |