fix(behaviors): fix optimize viewport transform does not hide edge arrow (#6217)

Co-authored-by: antv <antv@antfin.com>
This commit is contained in:
Aaron 2024-08-22 19:14:54 +08:00 committed by GitHub
parent e8f7a05702
commit 7cb9d269e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1265 additions and 730 deletions

View File

@ -20,6 +20,7 @@ export const behaviorOptimizeViewportTransform: TestCase = async (context) => {
style: { style: {
labelFontSize: 8, labelFontSize: 8,
labelText: (datum) => datum.id, labelText: (datum) => datum.id,
startArrow: true,
}, },
}, },
behaviors: ['drag-canvas', 'zoom-canvas', 'scroll-canvas', 'optimize-viewport-transform'], behaviors: ['drag-canvas', 'zoom-canvas', 'scroll-canvas', 'optimize-viewport-transform'],

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 115 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 108 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -59,22 +59,16 @@ export class OptimizeViewportTransform extends BaseBehavior<OptimizeViewportTran
this.bindEvents(); this.bindEvents();
} }
private filterShapes = (shapes: DisplayObject[], classnames?: string[]) => {
return shapes.filter((shape) => shape.className && !classnames?.includes(shape.className));
};
private setElementsVisibility = ( private setElementsVisibility = (
elements: DisplayObject[], elements: DisplayObject[],
visibility: BaseStyleProps['visibility'], visibility: BaseStyleProps['visibility'],
excludedClassnames?: string[], excludedClassnames?: string[],
) => { ) => {
elements.forEach((element) => { elements.forEach((element) => {
setVisibility( setVisibility(element, visibility, false, (shape) => {
element, if (!shape.className) return true;
visibility, return !excludedClassnames?.includes(shape.className);
false, });
(shape) => !!shape.className && !excludedClassnames?.includes(shape.className),
);
}); });
}; };