Skip to content

Commit

Permalink
fix: Slider shows not centered initially with center: true
Browse files Browse the repository at this point in the history
  • Loading branch information
janschoenherr committed Dec 15, 2022
1 parent 9419e20 commit d90b157
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,7 @@
- Fix height calculation for `box-sizing: border-box` on Accordion content
- Fix error in console if image can't be loaded in Svg component with `stroke-animation: true`
- Fix `scrollIntoView()` no longer considers elements with `position: clip` as scrollable parents
- Fix Slider shows not centered initially with `center: true`

### Changed

Expand Down
17 changes: 5 additions & 12 deletions src/js/mixin/slider.js
Expand Up @@ -97,7 +97,7 @@ export default {

if (!force && stack.length > 1) {
if (stack.length === 2) {
this._transitioner.forward(Math.min(this.duration, 200));
this._transitioner?.forward(Math.min(this.duration, 200));
}

return;
Expand Down Expand Up @@ -130,17 +130,10 @@ export default {
prev && trigger(prev, 'itemhidden', [this]);
trigger(next, 'itemshown', [this]);

return new Promise((resolve) => {
requestAnimationFrame(() => {
stack.shift();
if (stack.length) {
this.show(stack.shift(), true);
} else {
this._transitioner = null;
}
resolve();
});
});
stack.shift();
this._transitioner = null;

requestAnimationFrame(() => stack.length && this.show(stack.shift(), true));
});

prev && trigger(prev, 'itemhide', [this]);
Expand Down

0 comments on commit d90b157

Please sign in to comment.