}\r
\r
_kiwi.app.view.doLayout();\r
-\r
- this.scrollToBottom();\r
this.alert('none');\r
\r
this.trigger('active', this.model);\r
_kiwi.app.panels.trigger('active', this.model);\r
+\r
+ this.scrollToBottom(true);\r
},\r
\r
\r
\r
\r
// Scroll to the bottom of the panel\r
- scrollToBottom: function () {\r
- // TODO: Don't scroll down if we're scrolled up the panel a little\r
- this.$container[0].scrollTop = this.$container[0].scrollHeight;\r
+ scrollToBottom: function (force_down) {\r
+ // If this isn't the active panel, don't scroll\r
+ if (this.model !== _kiwi.app.panels.active) return;\r
+\r
+ // Don't scroll down if we're scrolled up the panel a little\r
+ if (force_down || this.$container.scrollTop() + this.$container.height() > this.$el.outerHeight() - 150) {\r
+ this.$container[0].scrollTop = this.$container[0].scrollHeight;\r
+ }\r
}\r
});\r
\r