Revize 27d65c14
Přidáno uživatelem Pavel Fidranský před více než 5 roky(ů)
sources/imiger-core/src/main/webapp/js/components/sidebarNodeList.js | ||
---|---|---|
3 | 3 |
constructor(props) { |
4 | 4 |
this._properties = props; |
5 | 5 |
|
6 |
this._isScrolling = null; |
|
6 | 7 |
this._nodeList = []; |
7 | 8 |
} |
8 | 9 |
|
... | ... | |
93 | 94 |
this._rootElement = DOM.h('div', { |
94 | 95 |
class: this._properties.class, |
95 | 96 |
id: this._properties.id, |
96 |
onScroll: () => app.redrawEdges(),
|
|
97 |
onScroll: this._onScroll.bind(this),
|
|
97 | 98 |
}, [ |
98 | 99 |
// title |
99 | 100 |
DOM.h('h2', { |
... | ... | |
123 | 124 |
this.toggleControls(); |
124 | 125 |
} |
125 | 126 |
|
127 |
_onScroll() { |
|
128 |
if (this._isScrolling !== null) { |
|
129 |
window.clearTimeout(this._isScrolling); |
|
130 |
} |
|
131 |
|
|
132 |
this._isScrolling = window.setTimeout(() => { |
|
133 |
// NOTE: edges are only redrawn when scrolling ends in the sake of better performance |
|
134 |
app.redrawEdges(); |
|
135 |
}, 100); |
|
136 |
} |
|
137 |
|
|
126 | 138 |
_sortByName(sortOrder) { |
127 | 139 |
this._nodeList.sort((a, b) => { |
128 | 140 |
return sortOrder * a.name.localeCompare(b.name); |
Také k dispozici: Unified diff
re #18: edges are only redrawn every 100ms when sidebar is scrolled