Sha256: 177c60c1860b73a6e128216cb11489cc7975fcee7087f4b518d12315fac44270
Contents?: true
Size: 931 Bytes
Versions: 10
Compression:
Stored size: 931 Bytes
Contents
import Component from "@ember/component"; let CHECKED_BOTTOM; let STICK_TO_BOTTOM; export default Component.extend({ tagName: "div", classNameBindings: [ "model.rowClass", ":message-row", "model.selected:selected" ], click() { this.selectedMessage(this.get("model")); }, willInsertElement() { if (CHECKED_BOTTOM) { return; } const $topPanel = Em.$("#top-panel"); const scrollTop = $topPanel.scrollTop(); const height = $topPanel.height(); const scrollHeight = $topPanel[0].scrollHeight; STICK_TO_BOTTOM = scrollHeight - 20 < height + scrollTop; CHECKED_BOTTOM = true; }, didInsertElement() { const $topPanel = Em.$("#top-panel"); Em.run.next(() => { CHECKED_BOTTOM = false; if (STICK_TO_BOTTOM) { STICK_TO_BOTTOM = false; $topPanel.scrollTop($topPanel[0].scrollHeight - $topPanel.height()); } }); } });
Version data entries
10 entries across 10 versions & 1 rubygems