增加可选配置--框选框的颜色

This commit is contained in:
joylink_zhaoerwei 2023-08-21 17:38:08 +08:00
parent 1e09b4c3c4
commit 897ed67ba4

View File

@ -14,6 +14,10 @@ export interface IMouseToolOptions {
* , * ,
*/ */
boxSelect?: boolean; boxSelect?: boolean;
/**
* --
*/
boxSelectColor?: string;
/** /**
* (), * (),
*/ */
@ -32,6 +36,7 @@ class CompleteMouseToolOptions implements IMouseToolOptions {
boxSelect: boolean; boxSelect: boolean;
viewportDrag: boolean; viewportDrag: boolean;
wheelZoom: boolean; wheelZoom: boolean;
boxSelectColor?: string;
selectFilter?: GraphicSelectFilter | undefined; selectFilter?: GraphicSelectFilter | undefined;
constructor() { constructor() {
this.boxSelect = true; this.boxSelect = true;
@ -48,6 +53,7 @@ class CompleteMouseToolOptions implements IMouseToolOptions {
if (options.wheelZoom != undefined) { if (options.wheelZoom != undefined) {
this.wheelZoom = options.wheelZoom; this.wheelZoom = options.wheelZoom;
} }
this.boxSelectColor = options.boxSelectColor;
this.selectFilter = options.selectFilter; this.selectFilter = options.selectFilter;
} }
} }
@ -287,7 +293,7 @@ export class CommonMouseTool extends AppInteractionPlugin {
if (!this.drag) return; if (!this.drag) return;
// 绘制框选矩形框 // 绘制框选矩形框
this.box.clear(); this.box.clear();
this.box.lineStyle({ width: 1, color: 0x000000 }); this.box.lineStyle({ width: 1, color: this.options.boxSelectColor });
const dsx = end.x - start.x; const dsx = end.x - start.x;
const dsy = end.y - start.y; const dsy = end.y - start.y;
let { x, y } = start; let { x, y } = start;