diff options
author | Nivesh Rajbhandari | 2012-04-16 16:06:24 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-16 16:06:24 -0700 |
commit | c253192a08b499ea7be46fa5438d273e51f7ec5a (patch) | |
tree | 18a1f0e3679c0eb993a9dedb537035d3861f49ac /js/panels/presets/style-presets.reel/style-presets.js | |
parent | e19376c54eedd1f1c457ba405b2f110be376a559 (diff) | |
parent | 4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff) | |
download | ninja-c253192a08b499ea7be46fa5438d273e51f7ec5a.tar.gz |
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Diffstat (limited to 'js/panels/presets/style-presets.reel/style-presets.js')
-rw-r--r-- | js/panels/presets/style-presets.reel/style-presets.js | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/js/panels/presets/style-presets.reel/style-presets.js b/js/panels/presets/style-presets.reel/style-presets.js index 11f41822..5f10bbe3 100644 --- a/js/panels/presets/style-presets.reel/style-presets.js +++ b/js/panels/presets/style-presets.reel/style-presets.js | |||
@@ -22,60 +22,13 @@ exports.StylesLibrary = Montage.create(Component, { | |||
22 | }, | 22 | }, |
23 | handleNodeActivation: { | 23 | handleNodeActivation: { |
24 | value: function(presetData) { | 24 | value: function(presetData) { |
25 | var selection = this.application.ninja.selectedElements, | 25 | this.application.ninja.presetsController.applyPreset(presetData, true); |
26 | stylesController = this.application.ninja.stylesController, | ||
27 | selectorBase = presetData.selectorBase, | ||
28 | self = this, className; | ||
29 | |||
30 | if(!selection || !selection.length || selection.length === 0) { | ||
31 | return false; | ||
32 | } | ||
33 | |||
34 | function setStopRuleSelector(selector) { | ||
35 | self.application.ninja | ||
36 | .currentDocument.documentRoot | ||
37 | .elementModel.controller | ||
38 | .changeSelector(self.application.ninja.currentDocument.documentRoot, null, selector); | ||
39 | } | 26 | } |
40 | |||
41 | selectorBase = stylesController.generateClassName(selectorBase); | ||
42 | |||
43 | presetData.rules.forEach(function(rule) { | ||
44 | stylesController.addRule('.'+selectorBase + rule.selectorSuffix, rule.styles); | ||
45 | }, this); | ||
46 | |||
47 | selection.forEach(function(el) { | ||
48 | el._element.style.webkitTransition = "all 450ms linear"; | ||
49 | |||
50 | el._element.addEventListener("webkitTransitionEnd", function presetTransition(e) { | ||
51 | el._element.style.webkitTransition = ''; | ||
52 | setStopRuleSelector("*"); | ||
53 | this.removeEventListener("webkitTransitionEnd", presetTransition, true); | ||
54 | |||
55 | }, true); | ||
56 | setStopRuleSelector("transitionStopRule"); | ||
57 | el._element.classList.add(selectorBase); | ||
58 | |||
59 | //// Keep track of elements with presets and don't add duplicates | ||
60 | |||
61 | }, this); | ||
62 | |||
63 | |||
64 | } | ||
65 | }, | 27 | }, |
66 | handleDragEnd : { | 28 | handleDragEnd : { |
67 | value: function(sourceObject) { | 29 | value: function(sourceObject) { |
68 | console.log(sourceObject); | 30 | console.log(sourceObject); |
69 | } | 31 | } |
70 | }, | 32 | } |
71 | shouldChangeSelection : { | ||
72 | value : function(controller, newSelection, oldSelection) { | ||
73 | // | ||
74 | //debugger; | ||
75 | console.log('1Handle should change selection'); | ||
76 | return false; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | 33 | ||
81 | }); | 34 | }); |