diff options
author | Valerio Virgillito | 2012-02-16 16:11:28 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-16 16:11:28 -0800 |
commit | 014d5bd8f7a1a6271ab08d76f26dbf5148425569 (patch) | |
tree | 9fc463f534f17e2ff899fc64235943af89ec9a94 /js/panels/presets/transitions-presets.reel/transitions-presets.js | |
parent | be0318ed92d1fbc853568648f773322401d9c029 (diff) | |
parent | fa51b9cf6c034313c10cf2963e720feeeabcfc4a (diff) | |
download | ninja-014d5bd8f7a1a6271ab08d76f26dbf5148425569.tar.gz |
Merge pull request #46 from ericguzman/PresetsPanel
Presets panel initial merge into master
Diffstat (limited to 'js/panels/presets/transitions-presets.reel/transitions-presets.js')
-rw-r--r-- | js/panels/presets/transitions-presets.reel/transitions-presets.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/js/panels/presets/transitions-presets.reel/transitions-presets.js b/js/panels/presets/transitions-presets.reel/transitions-presets.js new file mode 100644 index 00000000..f7d84085 --- /dev/null +++ b/js/panels/presets/transitions-presets.reel/transitions-presets.js | |||
@@ -0,0 +1,46 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component, | ||
9 | DefaultPresets = require("js/panels/presets/default-transition-presets").transitionPresets; | ||
10 | |||
11 | exports.TransitionsLibrary = Montage.create(Component, { | ||
12 | hasTemplate: { | ||
13 | value: true | ||
14 | }, | ||
15 | presetData : { | ||
16 | value: null | ||
17 | }, | ||
18 | deserializedFromTemplate : { | ||
19 | value: function() { | ||
20 | this.presetData = DefaultPresets; | ||
21 | } | ||
22 | }, | ||
23 | handleNodeActivation: { | ||
24 | value: function(presetData) { | ||
25 | var selection = this.application.ninja.selectedElements, | ||
26 | stylesController = this.application.ninja.stylesController, | ||
27 | selectorBase = presetData.selectorBase, | ||
28 | self = this; | ||
29 | |||
30 | if(!selection || !selection.length || selection.length === 0) { | ||
31 | return false; | ||
32 | } | ||
33 | |||
34 | selectorBase = stylesController.generateClassName(selectorBase); | ||
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 | } | ||
46 | }); | ||