UNPKG

@uwdata/mosaic-plot

Version:

A Mosaic-powered plotting framework based on Observable Plot.

16 lines (15 loc) 450 B
/** * Patch the getScreenCTM method to memoize the last non-null * result seen. This will let the method continue to function * even after the node is removed from the DOM. */ export function patchScreenCTM() { /** @type {SVGGraphicsElement} */ // @ts-ignore const node = this; const getScreenCTM = node.getScreenCTM; let memo; node.getScreenCTM = () => { return node.isConnected ? (memo = getScreenCTM.call(node)) : memo; }; }