aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/style.reel
diff options
context:
space:
mode:
authorEric Guzman2012-04-13 01:45:31 -0700
committerEric Guzman2012-04-13 01:45:31 -0700
commitdb9d44fea7856a8fba9e9e306dafa8777f1eb015 (patch)
treef05f18a6908c5becaa936c38bcc75e593f2ae7d7 /js/panels/css-panel/style.reel
parente39cc380ef2c0479f57b35dcadedccb0fb3fd22f (diff)
downloadninja-db9d44fea7856a8fba9e9e306dafa8777f1eb015.tar.gz
CSS Panel - Add drag and drop UI
Diffstat (limited to 'js/panels/css-panel/style.reel')
-rw-r--r--js/panels/css-panel/style.reel/style.css40
-rw-r--r--js/panels/css-panel/style.reel/style.js41
2 files changed, 77 insertions, 4 deletions
diff --git a/js/panels/css-panel/style.reel/style.css b/js/panels/css-panel/style.reel/style.css
index afcb7ca4..66c25fe0 100644
--- a/js/panels/css-panel/style.reel/style.css
+++ b/js/panels/css-panel/style.reel/style.css
@@ -4,8 +4,11 @@
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */ 5 </copyright> */
6 6
7/* ------------------------
8 Style item container styles
9------------------------ */
7.style-item { 10.style-item {
8 11 border-bottom: 1px solid rgba(0,0,0,0);
9 cursor: url(/js/../images/tools/hand_down.png), default; 12 cursor: url(/js/../images/tools/hand_down.png), default;
10 display: block; 13 display: block;
11 overflow: hidden; 14 overflow: hidden;
@@ -13,10 +16,14 @@
13 text-overflow: ellipsis; 16 text-overflow: ellipsis;
14} 17}
15.style-item:hover { 18.style-item:hover {
16 background-color: #fafafa;
17 border-right: 3px double #999; 19 border-right: 3px double #999;
18 margin-right: 1px; 20 margin-right: 3px;
19} 21}
22
23/* ------------------------
24 Checkbox
25------------------------ */
26
20.style-item input { 27.style-item input {
21 height: 10px; 28 height: 10px;
22 width: 10px; 29 width: 10px;
@@ -29,6 +36,11 @@
29.style-item-disabled { 36.style-item-disabled {
30 opacity: .5; 37 opacity: .5;
31} 38}
39
40/* ------------------------
41 Property/value styles
42------------------------ */
43
32.css-property, .css-value { 44.css-property, .css-value {
33 border: 1px solid rgba(0,0,0,0); 45 border: 1px solid rgba(0,0,0,0);
34 border-radius: 2px; 46 border-radius: 2px;
@@ -57,6 +69,11 @@
57.css-value { 69.css-value {
58 display: inline; 70 display: inline;
59} 71}
72
73/* ------------------------
74 Editable Styles
75------------------------ */
76
60.style-item .editable { 77.style-item .editable {
61 background-color: transparent; 78 background-color: transparent;
62 border: 1px solid #999; 79 border: 1px solid #999;
@@ -73,4 +90,21 @@
73 position: relative; 90 position: relative;
74 margin-right: -7px; 91 margin-right: -7px;
75 right: -1px; 92 right: -1px;
93}
94
95/* ------------------------
96 Drag/Drop Styles
97------------------------ */
98
99.style-item.dragged {
100 background: none;
101 border-right-style: none;
102 opacity: .85;
103}
104.style-item.dragging {
105 background-color: #f2f2f2;
106 opacity: .55;
107}
108.style-item.drag-enter {
109 border-bottom: 1px solid #CCC;
76} \ No newline at end of file 110} \ No newline at end of file
diff --git a/js/panels/css-panel/style.reel/style.js b/js/panels/css-panel/style.reel/style.js
index 6ff102b2..c3e9efdf 100644
--- a/js/panels/css-panel/style.reel/style.js
+++ b/js/panels/css-panel/style.reel/style.js
@@ -28,7 +28,36 @@ exports.Style = Montage.create(TreeNode, {
28 this.needsDraw = true; 28 this.needsDraw = true;
29 } 29 }
30 }, 30 },
31 handleEvent : {
32 value: function(e) {
33 console.log(e);
34 }
35 },
36
37 handleDragstart : {
38 value: function(e) {
39 e.dataTransfer.effectAllowed = 'move';
40 e.dataTransfer.setData('Text', 'my styles, baby!');
41 this.element.classList.add("dragged");
42 }
43 },
31 44
45 handleDragend : {
46 value: function(e) {
47 this.element.classList.remove("dragging");
48 this.element.classList.remove("dragged");
49 }
50 },
51 handleDrag : {
52 value: function(e) {
53 this.element.classList.add("dragging");
54 }
55 },
56 handleDrop : {
57 value: function(e) {
58 this.element.classList.remove("drag-enter");
59 }
60 },
32 handleSourceObjectSet: { 61 handleSourceObjectSet: {
33 value: function() { 62 value: function() {
34 //debugger; 63 //debugger;
@@ -41,7 +70,17 @@ exports.Style = Montage.create(TreeNode, {
41 console.log("style - template did load"); 70 console.log("style - template did load");
42 } 71 }
43 }, 72 },
44 73 prepareForDraw : {
74 value: function() {
75 console.log("style's prepare for draw");
76 this.element.addEventListener('dragstart', this, false);
77 this.element.addEventListener('drag', this, false);
78// this.element.addEventListener('dragenter', this, false);
79// this.element.addEventListener('dragleave', this, false);
80 this.element.addEventListener('dragend', this, false);
81 this.element.addEventListener('drop', this, false);
82 }
83 },
45 draw : { 84 draw : {
46 value : function() { 85 value : function() {
47 //debugger; 86 //debugger;