import "@polymer/iron-flex-layout/iron-flex-layout.js";
import * as Polymer from "@polymer/polymer";
class UtilScrollable extends Polymer.PolymerElement {
static get template() {
return Polymer.html`
`;
}
static get is() {
return "util-scrollable";
}
/**
* Returns the scrolling element.
*/
get scrollTarget() {
return this.$.scrollable;
}
attached() {
requestAnimationFrame(this.updateScrollState.bind(this));
}
updateScrollState() {
this.classList.toggle("is-scrolled", this.scrollTarget.scrollTop > 0);
this.classList.toggle(
"can-scroll",
this.scrollTarget.offsetHeight < this.scrollTarget.scrollHeight,
);
this.classList.toggle(
"scrolled-to-bottom",
this.scrollTarget.scrollTop + this.scrollTarget.offsetHeight >=
this.scrollTarget.scrollHeight,
);
}
}
customElements.define("util-scrollable", UtilScrollable);