Remove scroll event listener on tree menu plus style cleanup for matchinfos
Change-Id: I5f78792da7e3ada06c6dec9fe2d80343a82384d6
diff --git a/dev/js/src/match/treemenu.js b/dev/js/src/match/treemenu.js
index 6a39720..1a12774 100644
--- a/dev/js/src/match/treemenu.js
+++ b/dev/js/src/match/treemenu.js
@@ -48,10 +48,44 @@
// Attach menu to
attachTo : function (e) {
+
+ // this._attached = e;
+ this._repos(e);
+ this.slider().reInit();
+
+ /*
+ * This is a suboptimal scrolling solution, see
+ * see https://developer.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects
+ */
+ if (this._onscroll !== undefined) {
+ window.removeEventListener('scroll', this._onscroll);
+ };
+
+ this._onscroll = function () {
+ this._repos(e);
+ }.bind(this);
+
+ window.addEventListener('scroll', this._onscroll);
+ },
+
+
+ // Overwrite onHide method
+ onHide : function () {
+
+ // Remove listener
+ if (this._onscroll !== undefined) {
+ window.removeEventListener('scroll', this._onscroll);
+ };
+ },
+
+ _repos : function (e) {
var bounding = e.getBoundingClientRect();
this._element.style.left = bounding.left + "px";
- this._element.style.top = (bounding.top + bounding.height - this._element.clientHeight) + "px";
- this.slider().reInit();
+ this._element.style.top = (
+ bounding.top +
+ bounding.height -
+ this._element.clientHeight
+ ) + "px";
}
};
});