mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 02:52:27 +08:00
fix(mobile): spurious error when drag ends
This commit is contained in:
parent
c5004491f7
commit
aad5b6cdbd
@ -57,7 +57,7 @@ export default class SidebarContainer extends FlexContainer {
|
||||
const deltaX = x - this.startX;
|
||||
const width = this.sidebarWrapper.offsetWidth;
|
||||
const translatePercentage = Math.min(0, Math.max(this.currentTranslate + (deltaX / width) * 100, -100));
|
||||
|
||||
this.translatePercentage = translatePercentage;
|
||||
this.sidebarWrapper.style.transform = `translateX(${translatePercentage}%)`;
|
||||
}
|
||||
|
||||
@ -66,8 +66,7 @@ export default class SidebarContainer extends FlexContainer {
|
||||
return;
|
||||
}
|
||||
|
||||
const translateX = parseFloat(this.sidebarWrapper.style.transform.match(/-?\d+/)[0]);
|
||||
const isOpen = translateX > -50;
|
||||
const isOpen = this.translatePercentage > -50;
|
||||
this.sidebarWrapper.classList.toggle("show", isOpen);
|
||||
this.sidebarWrapper.style.transform = isOpen ? 'translateX(0)' : 'translateX(-100%)';
|
||||
this.sidebarWrapper.style.transition = this.originalTransition;
|
||||
|
Loading…
x
Reference in New Issue
Block a user