simplify isZoomed historical graph update logic

This commit is contained in:
Nick Krecklow
2020-06-12 18:32:53 -05:00
parent b7ed5fdd93
commit 5b6d65e1c9
2 changed files with 10 additions and 54 deletions

View File

@ -26,27 +26,3 @@ export function uPlotTooltipPlugin (onHover) {
}
}
}
export function uPlotIsZoomedPlugin (onZoomIn, onZoomOut) {
return {
hooks: {
setSelect: u => {
u._zoomPluginIgnoreNextSetScale = true
if (onZoomIn) {
onZoomIn(u)
}
},
setScale: u => {
if (typeof u._zoomPluginIgnoreNextSetScale !== 'boolean') {
return
}
if (u._zoomPluginIgnoreNextSetScale) {
u._zoomPluginIgnoreNextSetScale = false
} else if (onZoomOut) {
onZoomOut(u)
}
}
}
}
}