fix: zoom-canvas with optimizeZoom, drag-canvas shows the node shapes hiden by zoom-canvas optimizeZoom, closes: #2996;

This commit is contained in:
Yanyan-Wang 2021-07-01 10:22:43 +08:00
parent c85470832b
commit a3bbe03a79
2 changed files with 17 additions and 9 deletions

View File

@ -5,6 +5,7 @@
- fix: when select a node with click-select, selected combos should be deselected;
- fix: contextmenu with click trigger does not show the menu up, closes: #2982;
- fix: layout with collapsed combo, closes: #2988;
- fix: zoom-canvas with optimizeZoom, drag-canvas shows the node shapes hiden by zoom-canvas optimizeZoom, closes: #2996;
#### 4.3.3

View File

@ -202,6 +202,11 @@ export default {
if (this.keydown) return;
const currentZoom = graph.getZoom();
const modeController = graph.get('modeController');
const zoomCanvas = modeController?.modes[modeController.mode]?.filter(behavior => behavior.type === 'zoom-canvas')?.[0];
const optimizeZoom = zoomCanvas ? zoomCanvas.optimizeZoom || 0.1 : 0;
if (this.enableOptimize) {
// 拖动结束后显示所有的边
const edges = graph.getEdges();
@ -213,15 +218,17 @@ export default {
if (oriVis) shape.show();
});
}
const nodes = graph.getNodes();
for (let j = 0, nodeLen = nodes.length; j < nodeLen; j++) {
const container = nodes[j].getContainer();
const children = container.get('children');
for (const child of children) {
const isKeyShape = child.get('isKeyShape');
if (!isKeyShape) {
const oriVis = child.get('ori-visibility');
if (oriVis) child.show();
if (currentZoom > optimizeZoom) {
const nodes = graph.getNodes();
for (let j = 0, nodeLen = nodes.length; j < nodeLen; j++) {
const container = nodes[j].getContainer();
const children = container.get('children');
for (const child of children) {
const isKeyShape = child.get('isKeyShape');
if (!isKeyShape) {
const oriVis = child.get('ori-visibility');
if (oriVis) child.show();
}
}
}
}