mirror of
https://gitee.com/antv/g6.git
synced 2024-12-02 19:58:46 +08:00
test: minimap and bundling
This commit is contained in:
parent
d6b8b6c3d5
commit
6f7c6f188e
@ -41,6 +41,7 @@ export default {
|
||||
y: clientY,
|
||||
};
|
||||
this.graph.translate(dx, dy);
|
||||
this.graph.paint();
|
||||
},
|
||||
onMouseDown(e: IG6GraphEvent) {
|
||||
const self = this as any;
|
||||
|
@ -609,11 +609,9 @@ export default class Graph extends EventEmitter implements IGraph {
|
||||
} else {
|
||||
mat3.scale(matrix, matrix, [ratio, ratio]);
|
||||
}
|
||||
|
||||
if (minZoom && matrix[0] < minZoom) {
|
||||
return;
|
||||
}
|
||||
if (maxZoom && matrix[0] > maxZoom) {
|
||||
|
||||
if ((minZoom && matrix[0] < minZoom) || (maxZoom && matrix[0] > maxZoom)) {
|
||||
this.setAutoPaint(autoPaint);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,6 @@ export default class MiniMap extends Base {
|
||||
if (!isRefresh) {
|
||||
return;
|
||||
}
|
||||
console.log('update canvas')
|
||||
|
||||
// 如果是视口变换,也不刷新视图,但是需要重置视口大小和位置
|
||||
if (this.get('viewportChange')) {
|
||||
|
@ -1971,7 +1971,7 @@ describe.only('plugins', () => {
|
||||
],
|
||||
};
|
||||
|
||||
it('minimap', () => {
|
||||
it.only('minimap', () => {
|
||||
const minimap = new G6.Minimap();
|
||||
const graph = new Graph({
|
||||
container: div,
|
||||
@ -1985,6 +1985,67 @@ describe.only('plugins', () => {
|
||||
});
|
||||
graph.data(data);
|
||||
graph.render();
|
||||
graph.destroy();
|
||||
});
|
||||
it.only('minimap delegate', () => {
|
||||
const minimap = new G6.Minimap({
|
||||
width: 100,
|
||||
height: 80,
|
||||
type: 'delegate'
|
||||
});
|
||||
const graph = new Graph({
|
||||
container: div,
|
||||
width: 500,
|
||||
height: 500,
|
||||
renderer: 'svg',
|
||||
plugins: [minimap],
|
||||
modes: {
|
||||
default: ['drag-node', 'drag-canvas', 'zoom-canvas']
|
||||
}
|
||||
});
|
||||
graph.data(data);
|
||||
graph.render();
|
||||
graph.destroy();
|
||||
});
|
||||
it.only('minimap keyShape', () => {
|
||||
const minimap = new G6.Minimap({
|
||||
width: 100,
|
||||
height: 80,
|
||||
type: 'keyShape'
|
||||
});
|
||||
const graph = new Graph({
|
||||
container: div,
|
||||
width: 500,
|
||||
height: 500,
|
||||
renderer: 'svg',
|
||||
plugins: [minimap],
|
||||
modes: {
|
||||
default: ['drag-node', 'drag-canvas', 'zoom-canvas']
|
||||
}
|
||||
});
|
||||
data.nodes.forEach((node: any, i) => {
|
||||
node.label = `node-${i}`;
|
||||
});
|
||||
graph.data(data);
|
||||
graph.render();
|
||||
graph.destroy();
|
||||
});
|
||||
it.only('edge bundling', () => {
|
||||
const bundling = new G6.Bundling();
|
||||
const graph = new Graph({
|
||||
container: div,
|
||||
width: 500,
|
||||
height: 500,
|
||||
renderer: 'svg',
|
||||
plugins: [bundling]
|
||||
});
|
||||
graph.data(data);
|
||||
graph.render();
|
||||
setTimeout(() => {
|
||||
bundling.bundling(data);
|
||||
}, 5000);
|
||||
|
||||
// graph.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user