Fixed a bug where the list refresh was being activated when the scroll top wasn't 0.

This commit is contained in:
MattMo 2022-05-24 08:01:28 -07:00
parent b805dc4bca
commit 9a8705b715

View File

@ -231,7 +231,7 @@ class IgniteTemplate {
if (live) {
this.on("input", valueChanged);
}
this.on("change", valueChanged);
this.on("keyup", valueChanged);
}
@ -2405,28 +2405,33 @@ class list extends IgniteTemplate {
onRefreshTouchMove(event) {
var touch = event.touches[0];
var diff = Math.max(touch.clientY - this.refreshTouchStartY, 0);
if (diff < 100) {
if (this.refreshPlaceholderElement instanceof IgniteTemplate) {
this.refreshPlaceholderElement.element.style.setProperty("min-height", `${diff}px`);
this.refreshPlaceholderElement.element.style.setProperty("height", `${diff}px`);
} else {
this.refreshPlaceholderElement.style.setProperty("min-height", `${diff}px`);
this.refreshPlaceholderElement.style.setProperty("height", `${diff}px`);
}
if (this.element.parentElement.scrollTop > 0) {
this.refreshTouchStartY = touch.clientY;
} else {
if (this.refreshPlaceholderElement instanceof IgniteTemplate) {
this.refreshPlaceholderElement.element.style.setProperty("min-height", "0px");
this.refreshPlaceholderElement.element.style.setProperty("height", "0px");
var diff = Math.max(touch.clientY - this.refreshTouchStartY, 0);
if (diff < 100) {
if (this.refreshPlaceholderElement instanceof IgniteTemplate) {
this.refreshPlaceholderElement.element.style.setProperty("min-height", `${diff}px`);
this.refreshPlaceholderElement.element.style.setProperty("height", `${diff}px`);
} else {
this.refreshPlaceholderElement.style.setProperty("min-height", `${diff}px`);
this.refreshPlaceholderElement.style.setProperty("height", `${diff}px`);
}
} else {
this.refreshPlaceholderElement.style.setProperty("min-height", "0px");
this.refreshPlaceholderElement.style.setProperty("height", "0px");
if (this.refreshPlaceholderElement instanceof IgniteTemplate) {
this.refreshPlaceholderElement.element.style.setProperty("min-height", "0px");
this.refreshPlaceholderElement.element.style.setProperty("height", "0px");
} else {
this.refreshPlaceholderElement.style.setProperty("min-height", "0px");
this.refreshPlaceholderElement.style.setProperty("height", "0px");
}
this.element.parentElement.removeEventListener("touchmove", this.refreshTouchMoveListener);
this.refreshCallback();
}
this.element.parentElement.removeEventListener("touchmove", this.refreshTouchMoveListener);
this.refreshCallback();
}
}