aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
diff options
context:
space:
mode:
authorEric Guzman2012-04-23 22:37:34 -0700
committerEric Guzman2012-04-23 22:37:34 -0700
commit946fae3acf8ca9f384b662e40f406506e8b90ea7 (patch)
tree4b7afe0543a37f678ac1e12512bc9bd6315a40cd /js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
parentcdd1189e349e2974681e2c451e861e5b0db570e4 (diff)
downloadninja-946fae3acf8ca9f384b662e40f406506e8b90ea7.tar.gz
CSSPanel - Resizer
Diffstat (limited to 'js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js')
-rw-r--r--js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
index b1315311..95adddd0 100644
--- a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
+++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js
@@ -14,6 +14,27 @@ exports.StyleSheetsView = Montage.create(Component, {
14 showToolbar : { 14 showToolbar : {
15 value: false 15 value: false
16 }, 16 },
17 _resizedHeight : {
18 value: null
19 },
20 isResizing : {
21 value: null
22 },
23 _height: {
24 value: null
25 },
26 height: {
27 get: function() {
28 return this._height;
29 },
30 set: function(val) {
31 if(this._height !== val) {
32 this._height = val;
33 this.needsDraw = true;
34 }
35 }
36 },
37
17 styleSheets : { 38 styleSheets : {
18 value: [] 39 value: []
19 }, 40 },
@@ -33,6 +54,7 @@ exports.StyleSheetsView = Montage.create(Component, {
33 _initView : { 54 _initView : {
34 value: false 55 value: false
35 }, 56 },
57
36 handleStyleSheetsReady : { 58 handleStyleSheetsReady : {
37 value: function(e) { 59 value: function(e) {
38 this._initView = this.needsDraw = true; 60 this._initView = this.needsDraw = true;
@@ -48,6 +70,30 @@ exports.StyleSheetsView = Montage.create(Component, {
48 this.styleSheets.push(e._event.detail); 70 this.styleSheets.push(e._event.detail);
49 } 71 }
50 }, 72 },
73 handleResizeStart: {
74 value:function(e) {
75 this.isResizing = true;
76 this.needsDraw = true;
77 }
78 },
79
80 handleResizeMove: {
81 value:function(e) {
82 this._resizedHeight = e._event.dY;
83 this.needsDraw = true;
84 }
85 },
86
87 handleResizeEnd: {
88 value: function(e) {
89 this.height += this._resizedHeight;
90 this._resizedHeight = 0;
91 this.isResizing = false;
92 this.needsDraw = true;
93 }
94 },
95
96
51 prepareForDraw : { 97 prepareForDraw : {
52 value: function() { 98 value: function() {
53 console.log("style sheet view - prepare for draw"); 99 console.log("style sheet view - prepare for draw");
@@ -63,6 +109,18 @@ exports.StyleSheetsView = Montage.create(Component, {
63 this.styleSheets = this.stylesController.userStyleSheets; 109 this.styleSheets = this.stylesController.userStyleSheets;
64 this._initView = false; 110 this._initView = false;
65 } 111 }
112
113 if(this.height) {
114 console.log("StyleSheetsView draw - resizing to", (this.height + this._resizedHeight) + "px");
115 this.styleSheetList.element.style.height = (this.height + this._resizedHeight) + "px";
116 }
117 }
118 },
119 didDraw: {
120 value: function() {
121 if(!this.isResizing) {
122 this.height = this.styleSheetList.element.offsetHeight;
123 }
66 } 124 }
67 } 125 }
68}); \ No newline at end of file 126}); \ No newline at end of file