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