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.js128
1 files changed, 128 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..f25c8067
--- /dev/null
+++ b/js/panels/presets/style-presets.reel/style-presets.js
@@ -0,0 +1,128 @@
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
10exports.StylesLibrary = Montage.create(Component, {
11 hasTemplate: {
12 value: true
13 },
14 contentPanel : {
15 value: "presets" // get from local storage
16 },
17 templateDidLoad : {
18 value: function() {
19 console.log('deserialized');
20 }
21 },
22 treeList : {
23 value : null
24 },
25 data2: {
26 value: {
27 "text": "styles",
28 "children": [{
29 "text": "Box Styles",
30 "children": [
31 {
32 "text": "Border-Radius",
33 "classNameBase" : "border-radius",
34 "styles" : {
35 "border-radius": "100px",
36 "border" : "1px solid #333"
37 }
38 },
39 {
40 "text": "Drop Shadow",
41 "classNameBase" : "drop-shadow",
42 "styles" : {
43 "box-shadow": "2px 2px 50px rgba(0,0,0,0.5)",
44 "border" : "1px solid #CCC"
45 }
46 },
47 {
48 "text": "Fancy Box",
49 "classNameBase" : "fancy-box",
50 "styles" : {
51 "box-shadow": "inset 0 0 0 1px #666, inset 0 0 0 2px rgba(225, 225, 225, 0.4), 0 0 20px -10px #333",
52 "border" : "1px solid #FFF",
53 "border-radius": "30px",
54 "background-color": "#7db9e8",
55 "background-image": "-webkit-linear-gradient(top, rgba(255,255,255,0.74) 0%,rgba(255,255,255,0) 100%)"
56 }
57 }]
58 }, {
59 "text": "Text Styles",
60 "children": [
61 { "text": "Italic" },
62 { "text": "Text Shadow" },
63 { "text": "Text Color" } ]
64 }, {
65 "text": "Color Styles",
66 "children": [
67 { "text": "Background Gradient" },
68 { "text": "Background Color" },
69 { "text": "Text Highlight" } ]
70 }]
71 }
72 },
73 didDraw: {
74 value : function() {
75 console.log('Presets Panel prepare for draw.');
76// this.treeList.items.push({
77// label : "Box Style",
78// type : 'leaf'
79// });
80 }
81 },
82 handleNodeActivation: {
83 value: function(presetData) {
84 var selection = this.application.ninja.selectedElements,
85 self = this;
86
87 if(!selection || !selection.length || selection.length === 0) {
88 return false;
89 }
90
91 function setStopRuleSelector(selector) {
92 self.application.ninja
93 .currentDocument.documentRoot
94 .elementModel.controller
95 .changeSelector(self.application.ninja.currentDocument.documentRoot, null, selector);
96 }
97
98 selection.forEach(function(el) {
99 el._element.style.webkitTransition = "all 450ms linear";
100
101 el._element.addEventListener("webkitTransitionEnd", function(e) {
102 console.log("calling transition end");
103 setStopRuleSelector("*");
104 });
105
106 setStopRuleSelector("transitionStopRule");
107
108 this.application.ninja.stylesController.setElementStyles(el._element, presetData.styles);
109 }, this);
110
111 }
112 },
113 handleDragEnd : {
114 value: function(sourceObject) {
115 console.log(sourceObject);
116 }
117 },
118 shouldChangeSelection : {
119 value : function(controller, newSelection, oldSelection) {
120 //
121 //debugger;
122 console.log('1Handle should change selection');
123 return false;
124 }
125 }
126
127
128});