fix(Swipe): leak when width has decimal (#7562)

This commit is contained in:
neverland 2020-11-15 15:33:49 +08:00 committed by GitHub
parent 66204dfcf1
commit 5b4e063fa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,8 +167,8 @@ export default createComponent({
this.rect = rect;
this.swiping = true;
this.active = active;
this.computedWidth = Math.floor(+this.width || rect.width);
this.computedHeight = Math.floor(+this.height || rect.height);
this.computedWidth = +this.width || rect.width;
this.computedHeight = +this.height || rect.height;
this.offset = this.getTargetOffset(active);
this.children.forEach((swipe) => {
swipe.offset = 0;
@ -260,7 +260,7 @@ export default createComponent({
currentPosition = Math.min(currentPosition, -this.minOffset);
}
let targetOffset = Math.round(offset - currentPosition);
let targetOffset = offset - currentPosition;
if (!this.loop) {
targetOffset = range(targetOffset, this.minOffset, 0);
}