aboutsummaryrefslogtreecommitdiff
path: root/js/panels/presets/style-presets.reel/style-presets.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/presets/style-presets.reel/style-presets.js')
-rw-r--r--js/panels/presets/style-presets.reel/style-presets.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/js/panels/presets/style-presets.reel/style-presets.js b/js/panels/presets/style-presets.reel/style-presets.js
new file mode 100644
index 00000000..0c44e20c
--- /dev/null
+++ b/js/panels/presets/style-presets.reel/style-presets.js
@@ -0,0 +1,79 @@
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
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 DefaultPresets = require("js/panels/presets/default-style-presets").stylePresets;
10
11exports.StylesLibrary = Montage.create(Component, {
12 hasTemplate: {
13 value: true
14 },
15 presetData : {
16 value : null
17 },
18 contentPanel : {
19 value: "presets" // get from local storage
20 },
21 templateDidLoad : {
22 value: function() {
23 this.presetData = DefaultPresets;
24 }
25 },
26 treeList : {
27 value : null
28 },
29 didDraw: {
30 value : function() {
31 }
32 },
33 handleNodeActivation: {
34 value: function(presetData) {
35 var selection = this.application.ninja.selectedElements,
36 self = this;
37
38 if(!selection || !selection.length || selection.length === 0) {
39 return false;
40 }
41
42 function setStopRuleSelector(selector) {
43 self.application.ninja
44 .currentDocument.documentRoot
45 .elementModel.controller
46 .changeSelector(self.application.ninja.currentDocument.documentRoot, null, selector);
47 }
48
49 selection.forEach(function(el) {
50 el._element.style.webkitTransition = "all 450ms linear";
51
52 el._element.addEventListener("webkitTransitionEnd", function(e) {
53 console.log("calling transition end");
54 setStopRuleSelector("*");
55 });
56
57 setStopRuleSelector("transitionStopRule");
58
59 this.application.ninja.stylesController.setElementStyles(el._element, presetData.styles);
60 }, this);
61
62 }
63 },
64 handleDragEnd : {
65 value: function(sourceObject) {
66 console.log(sourceObject);
67 }
68 },
69 shouldChangeSelection : {
70 value : function(controller, newSelection, oldSelection) {
71 //
72 //debugger;
73 console.log('1Handle should change selection');
74 return false;
75 }
76 }
77
78
79});