mirror of
https://gitee.com/antv/g6.git
synced 2024-12-02 11:48:29 +08:00
improve minimap event
This commit is contained in:
commit
d940fe436f
@ -29,13 +29,7 @@
|
||||
layoutCfg: {
|
||||
maxIteration: 600,
|
||||
kg: 10,
|
||||
prevOverlapping: true,
|
||||
onLayoutComplete: function () {
|
||||
const minimap = document.getElementById('minimap');
|
||||
const legend = document.getElementById('legend');
|
||||
if (minimap !== undefined) minimap.style.display = 'block';
|
||||
if (legend !== undefined) legend.style.display = 'block';
|
||||
}
|
||||
prevOverlapping: true
|
||||
}
|
||||
});
|
||||
let nodeSizeMapper = new Mapper('node', 'userview', 'size', [20, 50], {
|
||||
@ -92,10 +86,6 @@
|
||||
height: 500,
|
||||
});
|
||||
graph.read(Util.cloneDeep(data));
|
||||
const minimap = document.getElementById('minimap');
|
||||
// const legend = document.getElementById('legend');
|
||||
if (minimap !== undefined) minimap.style.display = 'none';
|
||||
// if (legend !== undefined) legend.style.display = 'none';
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -187,7 +187,7 @@ class Layout {
|
||||
loadingImg.style.setProperty('margin-top', top + 'px');
|
||||
loading.appendChild(loadingImg);
|
||||
graph.on('afterdestroy', () => {
|
||||
if (loading !== null && loading !== undefined) { loading.detroy(); }
|
||||
if (loading !== null && loading !== undefined) { loading.destroy(); }
|
||||
});
|
||||
|
||||
const worker = new Worker();
|
||||
|
@ -205,10 +205,8 @@ class Plugin {
|
||||
style: preNavi.style
|
||||
});
|
||||
}
|
||||
|
||||
graph.update(item, {
|
||||
style
|
||||
});
|
||||
item.getKeyShape().attr(style);
|
||||
graph.draw();
|
||||
this.preNavi = {
|
||||
item,
|
||||
style: preStyle
|
||||
@ -225,9 +223,8 @@ class Plugin {
|
||||
});
|
||||
});
|
||||
graph.on('node:mouseleave', ev => {
|
||||
graph.update(ev.item, {
|
||||
style: this.nodeStyle
|
||||
});
|
||||
ev.item.getKeyShape().attr(this.nodeStyle);
|
||||
graph.draw();
|
||||
graph.css({
|
||||
cursor: '-webkit-grab'
|
||||
});
|
||||
|
@ -35,9 +35,8 @@ class Plugin {
|
||||
const graph = this.graph;
|
||||
Util.each(freezeElements, freezeElement => {
|
||||
const freezePoint = freezeElement.get('freezePoint');
|
||||
const freezable = graph.get('freezable');
|
||||
const scale = graph.getScale();
|
||||
if (freezable !== false && freezeElement.isShape && freezePoint && freezeElement.get('visible')) {
|
||||
if (freezeElement.isShape && freezePoint && freezeElement.get('visible')) {
|
||||
freezeElement.resetMatrix();
|
||||
freezeElement.transform([
|
||||
[ 't', -freezePoint.x, -freezePoint.y ],
|
||||
|
@ -28,6 +28,10 @@ class Plugin {
|
||||
graph.on('afterviewportchange', () => {
|
||||
minimap.renderViewPort();
|
||||
});
|
||||
graph.on('afterfilter', () => {
|
||||
minimap.renderBackground();
|
||||
minimap.renderViewPort();
|
||||
});
|
||||
this.renderBackground = () => {
|
||||
minimap.renderBackground();
|
||||
};
|
||||
|
@ -46,6 +46,7 @@ Mixin.AUGMENT = {
|
||||
* do filter
|
||||
*/
|
||||
filter() {
|
||||
this.emit('beforefilter');
|
||||
const filters = this.get('filters');
|
||||
const items = this.getItems();
|
||||
let filteredItems = this.getItems();
|
||||
@ -60,6 +61,7 @@ Mixin.AUGMENT = {
|
||||
}
|
||||
});
|
||||
this.draw();
|
||||
this.emit('afterfilter');
|
||||
}
|
||||
};
|
||||
module.exports = Mixin;
|
||||
|
Loading…
Reference in New Issue
Block a user