v0.12.1 - fix $SlideViewer slide animate
This commit is contained in:
parent
9d1d8fca39
commit
4ecc5cd06b
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
gtag('config', 'G-59HBGP98WR');
|
gtag('config', 'G-59HBGP98WR');
|
||||||
</script>
|
</script>
|
||||||
<script type="module" crossorigin src="/assets/index-DOm6Phmh.js"></script>
|
<script type="module" crossorigin src="/assets/index-DUv7nhbW.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-Bmz9OSnh.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-Bmz9OSnh.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "danbooru-viewer",
|
"name": "danbooru-viewer",
|
||||||
"module": "index.ts",
|
"module": "index.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.12.0",
|
"version": "0.12.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun x vite",
|
"dev": "bun x vite",
|
||||||
"build": "bun x vite build",
|
"build": "bun x vite build",
|
||||||
|
@ -94,8 +94,9 @@ export class $SlideViewer extends $Container<HTMLElement, $SlideViewerEventMap>
|
|||||||
}, {
|
}, {
|
||||||
duration: 300,
|
duration: 300,
|
||||||
easing: ease ? 'ease' : 'ease-out',
|
easing: ease ? 'ease' : 'ease-out',
|
||||||
}, () => {
|
}, (animation) => {
|
||||||
this.__render__();
|
this.$container.css({left: `-${this.getPositionLeft(currentIndex)}px`})
|
||||||
|
this.__render__(false);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ export class $SlideViewer extends $Container<HTMLElement, $SlideViewerEventMap>
|
|||||||
|
|
||||||
protected getPositionLeft(index: number) { return index * this.dom.clientWidth }
|
protected getPositionLeft(index: number) { return index * this.dom.clientWidth }
|
||||||
|
|
||||||
protected __render__() {
|
protected __render__(positioning = true) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
this.slideMap.forEach($slide => {
|
this.slideMap.forEach($slide => {
|
||||||
$slide.hide(true, false);
|
$slide.hide(true, false);
|
||||||
@ -137,7 +138,7 @@ export class $SlideViewer extends $Container<HTMLElement, $SlideViewerEventMap>
|
|||||||
if (currentIndex !== 0) this.slideList.at(currentIndex - 1)?.build().hide(false, false);
|
if (currentIndex !== 0) this.slideList.at(currentIndex - 1)?.build().hide(false, false);
|
||||||
if (currentIndex !== this.slideList.length - 1) this.slideList.at(currentIndex + 1)?.build().hide(false, false);
|
if (currentIndex !== this.slideList.length - 1) this.slideList.at(currentIndex + 1)?.build().hide(false, false);
|
||||||
this.$container.children.render();
|
this.$container.children.render();
|
||||||
this.$container.css({left: `-${this.getPositionLeft(currentIndex)}px`})
|
if (positioning) this.$container.css({left: `-${this.getPositionLeft(currentIndex)}px`})
|
||||||
}
|
}
|
||||||
|
|
||||||
pointerException(resolver: (pointer: $Pointer, e: PointerEvent) => boolean) {
|
pointerException(resolver: (pointer: $Pointer, e: PointerEvent) => boolean) {
|
||||||
|
Loading…
Reference in New Issue
Block a user