diff options
Diffstat (limited to 'js/panels/presets/style-presets.reel')
-rw-r--r-- | js/panels/presets/style-presets.reel/style-presets.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/js/panels/presets/style-presets.reel/style-presets.js b/js/panels/presets/style-presets.reel/style-presets.js index 0c44e20c..7871683e 100644 --- a/js/panels/presets/style-presets.reel/style-presets.js +++ b/js/panels/presets/style-presets.reel/style-presets.js | |||
@@ -15,25 +15,17 @@ exports.StylesLibrary = Montage.create(Component, { | |||
15 | presetData : { | 15 | presetData : { |
16 | value : null | 16 | value : null |
17 | }, | 17 | }, |
18 | contentPanel : { | ||
19 | value: "presets" // get from local storage | ||
20 | }, | ||
21 | templateDidLoad : { | 18 | templateDidLoad : { |
22 | value: function() { | 19 | value: function() { |
23 | this.presetData = DefaultPresets; | 20 | this.presetData = DefaultPresets; |
24 | } | 21 | } |
25 | }, | 22 | }, |
26 | treeList : { | ||
27 | value : null | ||
28 | }, | ||
29 | didDraw: { | ||
30 | value : function() { | ||
31 | } | ||
32 | }, | ||
33 | handleNodeActivation: { | 23 | handleNodeActivation: { |
34 | value: function(presetData) { | 24 | value: function(presetData) { |
35 | var selection = this.application.ninja.selectedElements, | 25 | var selection = this.application.ninja.selectedElements, |
36 | self = this; | 26 | stylesController = this.application.ninja.stylesController, |
27 | selectorBase = presetData.selectorBase, | ||
28 | self = this, className; | ||
37 | 29 | ||
38 | if(!selection || !selection.length || selection.length === 0) { | 30 | if(!selection || !selection.length || selection.length === 0) { |
39 | return false; | 31 | return false; |
@@ -46,19 +38,27 @@ exports.StylesLibrary = Montage.create(Component, { | |||
46 | .changeSelector(self.application.ninja.currentDocument.documentRoot, null, selector); | 38 | .changeSelector(self.application.ninja.currentDocument.documentRoot, null, selector); |
47 | } | 39 | } |
48 | 40 | ||
41 | selectorBase = stylesController.generateClassName(selectorBase); | ||
42 | |||
43 | presetData.rules.forEach(function(rule) { | ||
44 | stylesController.addRule('.'+selectorBase + rule.selectorSuffix, rule.styles); | ||
45 | }, this); | ||
46 | |||
49 | selection.forEach(function(el) { | 47 | selection.forEach(function(el) { |
50 | el._element.style.webkitTransition = "all 450ms linear"; | 48 | el._element.style.webkitTransition = "all 450ms linear"; |
51 | 49 | ||
52 | el._element.addEventListener("webkitTransitionEnd", function(e) { | 50 | el._element.addEventListener("webkitTransitionEnd", function(e) { |
53 | console.log("calling transition end"); | 51 | el._element.style.webkitTransition = ''; |
54 | setStopRuleSelector("*"); | 52 | setStopRuleSelector("*"); |
55 | }); | 53 | }, true); |
56 | |||
57 | setStopRuleSelector("transitionStopRule"); | 54 | setStopRuleSelector("transitionStopRule"); |
55 | el._element.classList.add(selectorBase); | ||
56 | |||
57 | //// Keep track of elements with presets and don't add duplicates | ||
58 | 58 | ||
59 | this.application.ninja.stylesController.setElementStyles(el._element, presetData.styles); | ||
60 | }, this); | 59 | }, this); |
61 | 60 | ||
61 | |||
62 | } | 62 | } |
63 | }, | 63 | }, |
64 | handleDragEnd : { | 64 | handleDragEnd : { |