Skip to content

Commit

Permalink
client: Fix center issue at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Sep 1, 2024
1 parent 6c54f3c commit b32f3ff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/public/app/widgets/type_widgets/mind_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit b32f3ff

Please sign in to comment.