aboutsummaryrefslogtreecommitdiff
path: root/js/panels/presets/style-presets.reel
diff options
context:
space:
mode:
authorhwc4872012-04-05 17:09:51 -0700
committerhwc4872012-04-05 17:09:51 -0700
commit2d21b01d6dd64af643f5f38818b57fcace05ea0b (patch)
tree44fac83294dae2efad48389ddb44cb1dbe06caad /js/panels/presets/style-presets.reel
parent7656b6eac7aec59697c6cddbe2a507fe9e4aa187 (diff)
parent96bfeee2e6b735b87e8482d6e2cf24d5224c6417 (diff)
downloadninja-2d21b01d6dd64af643f5f38818b57fcace05ea0b.tar.gz
Merge branch 'Snapping' of github.com:ericmueller/ninja-internal into Snapping_II
Diffstat (limited to 'js/panels/presets/style-presets.reel')
-rw-r--r--js/panels/presets/style-presets.reel/style-presets.js49
1 files changed, 48 insertions, 1 deletions
diff --git a/js/panels/presets/style-presets.reel/style-presets.js b/js/panels/presets/style-presets.reel/style-presets.js
index 5f10bbe3..a742213e 100644
--- a/js/panels/presets/style-presets.reel/style-presets.js
+++ b/js/panels/presets/style-presets.reel/style-presets.js
@@ -22,13 +22,60 @@ exports.StylesLibrary = Montage.create(Component, {
22 }, 22 },
23 handleNodeActivation: { 23 handleNodeActivation: {
24 value: function(presetData) { 24 value: function(presetData) {
25 this.application.ninja.presetsController.applyPreset(presetData, true); 25 var selection = this.application.ninja.selectedElements,
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 }
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
26 } 64 }
27 }, 65 },
28 handleDragEnd : { 66 handleDragEnd : {
29 value: function(sourceObject) { 67 value: function(sourceObject) {
30 console.log(sourceObject); 68 console.log(sourceObject);
31 } 69 }
70 },
71 shouldChangeSelection : {
72 value : function(controller, newSelection, oldSelection) {
73 //
74 //debugger;
75 console.log('1Handle should change selection');
76 return false;
77 }
32 } 78 }
33 79
80
34}); 81});