框选、全选添加默认过滤不可见图形

This commit is contained in:
walker 2023-11-09 10:12:01 +08:00
parent 3fe8f895fa
commit 0338431267
2 changed files with 9 additions and 3 deletions

View File

@ -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));
}
/**

View File

@ -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);