fix (image): remove console warning

This commit is contained in:
MickaelK 2025-05-16 12:25:19 +10:00
parent 6bf291a582
commit cdd0f3567a
2 changed files with 3 additions and 5 deletions

View file

@ -105,18 +105,16 @@ function initMobileNavigation({ $img, $navigation }) {
dist: null,
};
effect(rxjs.fromEvent($img, "touchstart").pipe(rxjs.debounceTime(10), rxjs.tap((event) => {
effect(rxjs.fromEvent($img, "touchstart", { passive: true }).pipe(rxjs.debounceTime(10), rxjs.tap((event) => {
if (event.touches.length !== 1) return;
event.preventDefault();
$img.style.transition = "0s ease transform";
state.active = true;
state.originT = performance.now();
state.originX = event.touches[0].pageX;
})));
effect(rxjs.fromEvent($img, "touchmove").pipe(rxjs.tap((event) => {
effect(rxjs.fromEvent($img, "touchmove", { passive: true }).pipe(rxjs.tap((event) => {
if (event.touches.length !== 1 || state.active === false) return;
event.preventDefault();
state.dist = event.touches[0].pageX - state.originX;
$img.style.transform = `translateX(${state.dist}px)`;
})));

View file

@ -62,7 +62,7 @@ function builder({ $img }) {
}),
),
// pinch zoom
rxjs.fromEvent($img.parentElement, "touchstart").pipe(
rxjs.fromEvent($img.parentElement, "touchstart", { passive: false }).pipe(
rxjs.filter((e) => e.touches.length === 2),
rxjs.switchMap((event) => rxjs.fromEvent($img.parentElement, "touchmove").pipe(
rxjs.filter((event) => event.touches.length >= 2),