Skip to content

Commit

Permalink
refactor: adjust site demos (#5217)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Aarebecca authored Dec 4, 2023
1 parent 3534d46 commit 0b89bf7
Show file tree
Hide file tree
Showing 212 changed files with 275 additions and 164,153 deletions.
2 changes: 1 addition & 1 deletion packages/g6/src/runtime/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
// the container dom for the graph canvas
public container: HTMLElement;
// the tag to indicate whether the graph instance is destroyed
public destroyed: boolean;
public destroyed: boolean = false;
// the renderer type of current graph
public rendererType: RendererName;
// for transient shapes for interactions, e.g. transient node and related edges while draging, delegates
Expand Down
9 changes: 9 additions & 0 deletions packages/site/.dumi/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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]);
};
}
14 changes: 6 additions & 8 deletions packages/site/.dumi/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ if (window) {
// window.g6 = require('@antv/g6/es'); // import the source for debugging
window.g6 = require('@antv/g6/lib'); // import the source for debugging

window.layoutGPU = require('@antv/layout-gpu'); // import the source for debugging
window.Algorithm = require('@antv/algorithm');
window.layoutWASM = require('@antv/layout-wasm'); // import the source for debugging
window.GraphLib = require('@antv/graphlib');
window.layoutGpu = require('@antv/layout-gpu'); // import the source for debugging
window.algorithm = require('@antv/algorithm');
window.layoutWasm = require('@antv/layout-wasm'); // import the source for debugging
window.graphlib = require('@antv/graphlib');

window.MapViewPlugin = require('@antv/g6-plugin-map-view');
window.g6PluginMapView = require('@antv/g6-plugin-map-view');
// window.g6 = require('@antv/g6/diFst/g6.min.js'); // import the package for webworker
window.insertCss = require('insert-css');
window.Chart = require('@antv/chart-node-g6');
window.AntVUtil = require('@antv/util');
window.GraphLayoutPredict = require('@antv/vis-predict-engine');
window.util = require('@antv/util');
window.stats = require('stats.js');
window.g2 = require('@antv/g2');
}
5 changes: 0 additions & 5 deletions packages/site/examples/algorithm/algoDemos/API.en.md

This file was deleted.

5 changes: 0 additions & 5 deletions packages/site/examples/algorithm/algoDemos/API.zh.md

This file was deleted.

138 changes: 0 additions & 138 deletions packages/site/examples/algorithm/algoDemos/demo/colorSets.js

This file was deleted.

Loading

0 comments on commit 0b89bf7

Please sign in to comment.