mirror of
https://github.com/nasa/openmct.git
synced 2025-04-07 19:34:25 +00:00
changed from window resize event, to element ResizeObserver for more accurate tracking of tree size (#4132)
This commit is contained in:
parent
9f48764210
commit
a99ce7733c
@ -226,18 +226,21 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getSearchResults = _.debounce(this.getSearchResults, 400);
|
||||
this.handleWindowResize = _.debounce(this.handleWindowResize, 500);
|
||||
this.handleTreeResize = _.debounce(this.handleTreeResize, 300);
|
||||
this.scrollEndEvent = _.debounce(this.scrollEndEvent, 100);
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener('resize', this.handleWindowResize);
|
||||
if (this.treeResizeObserver) {
|
||||
this.treeResizeObserver.disconnect();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async initialize() {
|
||||
this.isLoading = true;
|
||||
this.openmct.$injector.get('searchService');
|
||||
this.getSavedOpenItems();
|
||||
window.addEventListener('resize', this.handleWindowResize);
|
||||
this.treeResizeObserver = new ResizeObserver(this.handleTreeResize);
|
||||
this.treeResizeObserver.observe(this.$el);
|
||||
|
||||
await this.calculateHeights();
|
||||
|
||||
@ -710,7 +713,7 @@ export default {
|
||||
setSavedOpenItems() {
|
||||
localStorage.setItem(LOCAL_STORAGE_KEY__TREE_EXPANDED, JSON.stringify(this.openTreeItems));
|
||||
},
|
||||
handleWindowResize() {
|
||||
handleTreeResize() {
|
||||
this.calculateHeights();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user