g6/packages/site/.dumi/app.ts
Aaron 0b89bf7f86
refactor: adjust site demos (#5217)
* refactor: remove unused demos

* refactor: adjust onresize handle

* refactor: update 3d data resource

* docs: update demos imports

* refactor: handle resize uniformly and import module name

* fix: fix issue that demo cannot get container

* refactor: remove unused demos of algorithm and case
2023-12-04 14:42:33 +08:00

10 lines
377 B
TypeScript

if (typeof window !== 'undefined') {
window.onresize = () => {
const { graph, container, widthOffset = 0, heightOffset = 0 } = window as any;
if (!graph || graph.destroyed) return;
if (!container || !container.scrollWidth || !container.scrollHeight) return;
graph.setSize([container.scrollWidth + widthOffset, container.scrollHeight + heightOffset]);
};
}