diff options
Diffstat (limited to 'js/panels/css-panel')
-rw-r--r-- | js/panels/css-panel/rule-list.reel/rule-list.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/js/panels/css-panel/rule-list.reel/rule-list.js b/js/panels/css-panel/rule-list.reel/rule-list.js index 0faff07e..4ed3ec11 100644 --- a/js/panels/css-panel/rule-list.reel/rule-list.js +++ b/js/panels/css-panel/rule-list.reel/rule-list.js | |||
@@ -8,10 +8,9 @@ var Montage = require("montage/core/core").Montage, | |||
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component; |
9 | 9 | ||
10 | exports.RuleList = Montage.create(Component, { | 10 | exports.RuleList = Montage.create(Component, { |
11 | focusDelegate : { | 11 | focusDelegate : { value: null }, |
12 | value: null | ||
13 | }, | ||
14 | ruleNodeName : { value: 'li' }, | 12 | ruleNodeName : { value: 'li' }, |
13 | _needsScrollToBottom: { value: null }, | ||
15 | 14 | ||
16 | _rules: { value: null }, | 15 | _rules: { value: null }, |
17 | rules: { | 16 | rules: { |
@@ -69,6 +68,8 @@ exports.RuleList = Montage.create(Component, { | |||
69 | this.rulesToDraw.push(instance); | 68 | this.rulesToDraw.push(instance); |
70 | this.needsDraw = true; | 69 | this.needsDraw = true; |
71 | } | 70 | } |
71 | |||
72 | return instance; | ||
72 | } | 73 | } |
73 | }, | 74 | }, |
74 | 75 | ||
@@ -93,9 +94,18 @@ exports.RuleList = Montage.create(Component, { | |||
93 | 94 | ||
94 | draw : { | 95 | draw : { |
95 | value: function() { | 96 | value: function() { |
97 | ///// If needed, scroll to bottom | ||
98 | if(this._needsScrollToBottom) { | ||
99 | ///// Make sure the appended rule item is visible (scrolled-to) | ||
100 | this.element.scrollTop = this.element.offsetHeight; | ||
101 | console.log("Scroll top:", this.element.scrollTop); | ||
102 | this._needsScrollToBottom = false; | ||
103 | } | ||
104 | |||
96 | //// Iterate through all rules that need draw and append them | 105 | //// Iterate through all rules that need draw and append them |
97 | this.rulesToDraw.forEach(function(component) { | 106 | this.rulesToDraw.forEach(function(component) { |
98 | this.element.appendChild(component.element); | 107 | this.element.appendChild(component.element); |
108 | this._needsScrollToBottom = this.needsDraw = true; | ||
99 | component.needsDraw = true; | 109 | component.needsDraw = true; |
100 | }, this); | 110 | }, this); |
101 | 111 | ||