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

Version Path
logster-2.11.4 client-app/app/components/message-row.js
logster-2.11.3 client-app/app/components/message-row.js
logster-2.11.2 client-app/app/components/message-row.js
logster-2.11.1 client-app/app/components/message-row.js
logster-2.11.0 client-app/app/components/message-row.js
logster-2.10.1 client-app/app/components/message-row.js
logster-2.10.0 client-app/app/components/message-row.js
logster-2.9.8 client-app/app/components/message-row.js
logster-2.9.7 client-app/app/components/message-row.js
logster-2.9.6 client-app/app/components/message-row.js
logster-2.9.5 client-app/app/components/message-row.js
logster-2.9.4 client-app/app/components/message-row.js
logster-2.9.3 client-app/app/components/message-row.js
logster-2.9.2 client-app/app/components/message-row.js
logster-2.9.1 client-app/app/components/message-row.js
logster-2.9.0 client-app/app/components/message-row.js
logster-2.8.0 client-app/app/components/message-row.js
logster-2.7.1 client-app/app/components/message-row.js
logster-2.7.0 client-app/app/components/message-row.js
logster-2.6.3 client-app/app/components/message-row.js