diff options
author | Valerio Virgillito | 2012-03-28 22:44:35 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-03-28 22:44:35 -0700 |
commit | 7542f62ee7a4845c2472834d0dbe91bf669634da (patch) | |
tree | 657e63dfec155ba18dc8c170d1b8f8179a936603 /js/panels/presets/animations-presets.reel | |
parent | f09921e6085f4b16c6e69ac8bfd67eef644fc04e (diff) | |
parent | 3fd2cdb59027b3f973b9165db9db4fdd22026941 (diff) | |
download | ninja-7542f62ee7a4845c2472834d0dbe91bf669634da.tar.gz |
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js/panels/presets/animations-presets.reel')
-rw-r--r-- | js/panels/presets/animations-presets.reel/animations-presets.js | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/js/panels/presets/animations-presets.reel/animations-presets.js b/js/panels/presets/animations-presets.reel/animations-presets.js index ab200212..6a16da54 100644 --- a/js/panels/presets/animations-presets.reel/animations-presets.js +++ b/js/panels/presets/animations-presets.reel/animations-presets.js | |||
@@ -22,52 +22,7 @@ exports.AnimationsLibrary = Montage.create(Component, { | |||
22 | }, | 22 | }, |
23 | handleNodeActivation: { | 23 | handleNodeActivation: { |
24 | value: function(presetData) { | 24 | value: function(presetData) { |
25 | //debugger; | 25 | this.application.ninja.presetsController.applyPreset(presetData); |
26 | var selection = this.application.ninja.selectedElements, | ||
27 | stylesController = this.application.ninja.stylesController, | ||
28 | selectorBase = presetData.selectorBase, | ||
29 | self = this; | ||
30 | |||
31 | if(!selection || !selection.length || selection.length === 0) { | ||
32 | return false; | ||
33 | } | ||
34 | |||
35 | selectorBase = stylesController.generateClassName(selectorBase); | ||
36 | |||
37 | presetData.rules.forEach(function(rule) { | ||
38 | if(rule.isKeyFrameRule) { | ||
39 | this.application.ninja.stylesController.addRule( | ||
40 | '@-webkit-keyframes ' + presetData.selectorBase, | ||
41 | this.stringifyKeys(rule.keys) | ||
42 | ); | ||
43 | } else { | ||
44 | this.application.ninja.stylesController.addRule('.' + selectorBase + rule.selectorSuffix, rule.styles); | ||
45 | } | ||
46 | |||
47 | }, this); | ||
48 | |||
49 | selection.forEach(function(el) { | ||
50 | el._element.classList.add(selectorBase); | ||
51 | }, this); | ||
52 | |||
53 | } | ||
54 | }, | ||
55 | |||
56 | stringifyKeys : { | ||
57 | value: function(keysArray) { | ||
58 | var keysString = ''; | ||
59 | |||
60 | keysArray.forEach(function(key) { | ||
61 | var styles = '', style; | ||
62 | |||
63 | for(style in key.styles) { | ||
64 | styles += style + ':' + key.styles[style] + '; '; | ||
65 | } | ||
66 | |||
67 | keysString += key.keyText + ' {' + styles + ' }'; | ||
68 | }); | ||
69 | |||
70 | return keysString; | ||
71 | } | 26 | } |
72 | } | 27 | } |
73 | }); | 28 | }); |