Sha256: 85a6eb656c42a823392e4ffc1fed6a9dba83a0d0aa1f875fe5c03ef3349b2243
Contents?: true
Size: 932 Bytes
Versions: 23
Compression:
Stored size: 932 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.selectRow(); }, willInsertElement() { if (CHECKED_BOTTOM) { return; } const topPanel = document.getElementById("top-panel"); if (!topPanel) return; const height = parseFloat(getComputedStyle(topPanel).height); STICK_TO_BOTTOM = topPanel.scrollHeight - 20 < height + topPanel.scrollTop; CHECKED_BOTTOM = true; }, didInsertElement() { const topPanel = document.getElementById("top-panel"); if (!topPanel) return; CHECKED_BOTTOM = false; if (STICK_TO_BOTTOM) { STICK_TO_BOTTOM = false; topPanel.scrollTop = topPanel.scrollHeight - parseFloat(getComputedStyle(topPanel).height); } } });
Version data entries
23 entries across 23 versions & 1 rubygems