From 4bf4aa13d7c2d6bb76fabf80223a311729cd7915 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Thu, 9 Nov 2023 10:18:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jl-graphic/app/JlGraphicApp.ts | 7 +++++-- src/jl-graphic/plugins/CommonMousePlugin.ts | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/jl-graphic/app/JlGraphicApp.ts b/src/jl-graphic/app/JlGraphicApp.ts index aed59ab..e306cb8 100644 --- a/src/jl-graphic/app/JlGraphicApp.ts +++ b/src/jl-graphic/app/JlGraphicApp.ts @@ -943,8 +943,11 @@ abstract class GraphicSceneBase /** * 全选 */ - selectAllGraphics() { - this.updateSelected(...this.queryStore.getAllGraphics()); + selectAllGraphics(filter?: (g: JlGraphic) => boolean) { + if (filter == undefined) { + filter = (g) => g.visible; + } + this.updateSelected(...this.queryStore.getAllGraphics().filter(filter)); } /** diff --git a/src/jl-graphic/plugins/CommonMousePlugin.ts b/src/jl-graphic/plugins/CommonMousePlugin.ts index 5fc367b..8804548 100644 --- a/src/jl-graphic/plugins/CommonMousePlugin.ts +++ b/src/jl-graphic/plugins/CommonMousePlugin.ts @@ -386,7 +386,10 @@ export class CommonMouseTool extends AppInteractionPlugin { const app = this.app; const selects: JlGraphic[] = []; app.queryStore.getAllGraphics().forEach((g) => { - if (!this.selectFilter || this.selectFilter(g)) { + if ( + (this.selectFilter == undefined && g.visible) || + (!!this.selectFilter && this.selectFilter(g)) + ) { // 选择过滤器 if (g.boxIntersectCheck(boxRect)) { selects.push(g);