client: Fix center issue at startup

This commit is contained in:
Elian Doran 2024-09-01 16:44:55 +03:00
parent 6c54f3c804
commit b32f3ffd84
No known key found for this signature in database

View File

@ -26,7 +26,7 @@ export default class MindMapWidget extends TypeWidget {
this.$widget = $(TPL);
this.$content = this.$widget.find(".mind-map-container");
super.doRender();
super.doRender();
}
async doRefresh(note) {
@ -69,6 +69,12 @@ export default class MindMapWidget extends TypeWidget {
this.spacedUpdate.scheduleUpdate();
}
});
// If the note is displayed directly after a refresh, the scroll ends up at (0,0), making it difficult for the user to see.
// Adding an arbitrary wait until the element is attached to the DOM seems to do the trick for now.
setTimeout(() => {
mind.toCenter();
}, 200);
}
async getData() {