同步框架代码

This commit is contained in:
fan 2023-09-01 17:15:37 +08:00
parent f8e6f60e6f
commit fb8e0df87d
2 changed files with 20 additions and 4 deletions

@ -1 +1 @@
Subproject commit c66f841526d22af7dcb8ce768ad96488f13468c3
Subproject commit cc737578baa0dadef5c2b82b6ada66c117ba3d6b

View File

@ -101,11 +101,27 @@ export class CommonMouseTool extends AppInteractionPlugin {
return new CommonMouseTool(app);
}
/**
*
* @param rgb
* @returns
*/
private calContrastColor(rgb: number): number {
if (rgb > 0.45 && rgb < 0.55) {
return 0;
} else {
return 1 - rgb;
}
}
private updateBoxLineColor(cp: ICanvasProperties) {
// 根据画布背景调整线色
const color = new Color(cp.backgroundColor);
const cn = color.toNumber() ^ 0xffffff;
this._boxLineColor.setValue(cn);
// 对比色
const r = this.calContrastColor(color.red);
const g = this.calContrastColor(color.green);
const b = this.calContrastColor(color.blue);
this._boxLineColor.setValue([r, g, b]);
}
bind(): void {
@ -305,7 +321,7 @@ export class CommonMouseTool extends AppInteractionPlugin {
if (!this.drag) return;
// 绘制框选矩形框
this.box.clear();
this.box.lineStyle({ width: 1, color: this._boxLineColor });
this.box.lineStyle({ width: 2, color: this._boxLineColor });
const dsx = end.x - start.x;
const dsy = end.y - start.y;
let { x, y } = start;