Merge branch 'master' of git.code.tencent.com:xian-ncc-da/xian-ncc-da-client

This commit is contained in:
Yuan 2023-09-01 17:14:13 +08:00
commit 7f292426c8
4 changed files with 27 additions and 15 deletions

@ -1 +1 @@
Subproject commit df9615fe48fb15a572746e51462e5508db7d4c07
Subproject commit c66f841526d22af7dcb8ce768ad96488f13468c3

View File

@ -15,6 +15,7 @@ import {
IGraphicStorage,
IJlCanvas,
} from './JlGraphicApp';
import { GraphicDataUpdateOperation } from './BasicOperation';
/**
* app
@ -34,7 +35,7 @@ export function newDrawApp(options: DrawAppOptions): IDrawApp {
return new JlDrawApp(options);
}
export { AppConsts, GraphicDrawAssistant };
export { AppConsts, GraphicDrawAssistant, GraphicDataUpdateOperation };
export type {
DrawAssistant,
ICanvasProperties,

View File

@ -1,5 +1,11 @@
import { DisplayObject, FederatedMouseEvent, Graphics, Point } from 'pixi.js';
import { IGraphicScene } from '../app';
import {
Color,
DisplayObject,
FederatedMouseEvent,
Graphics,
Point,
} from 'pixi.js';
import { ICanvasProperties, IGraphicScene } from '../app';
import { JlGraphic } from '../core';
import {
AppDragEvent,
@ -14,10 +20,6 @@ export interface IMouseToolOptions {
* ,
*/
boxSelect?: boolean;
/**
* --
*/
boxSelectColor?: string;
/**
* (),
*/
@ -36,7 +38,6 @@ class CompleteMouseToolOptions implements IMouseToolOptions {
boxSelect: boolean;
viewportDrag: boolean;
wheelZoom: boolean;
boxSelectColor?: string;
selectFilter?: GraphicSelectFilter | undefined;
constructor() {
this.boxSelect = true;
@ -53,7 +54,6 @@ class CompleteMouseToolOptions implements IMouseToolOptions {
if (options.wheelZoom != undefined) {
this.wheelZoom = options.wheelZoom;
}
this.boxSelectColor = options.boxSelectColor;
this.selectFilter = options.selectFilter;
}
}
@ -66,6 +66,7 @@ export class CommonMouseTool extends AppInteractionPlugin {
static SelectBox = '__select_box';
options: CompleteMouseToolOptions;
box: Graphics;
_boxLineColor: Color;
leftDownTarget: DisplayObject | null = null;
drag = false;
@ -73,16 +74,19 @@ export class CommonMouseTool extends AppInteractionPlugin {
rightTarget: DisplayObject | null = null;
constructor(graphicApp: IGraphicScene) {
super(CommonMouseTool.Name, graphicApp);
constructor(scene: IGraphicScene) {
super(CommonMouseTool.Name, scene);
this.options = new CompleteMouseToolOptions();
this.box = new Graphics();
this._boxLineColor = new Color();
scene.canvas.on('dataupdate', this.updateBoxLineColor, this);
this.box.name = CommonMouseTool.SelectBox;
this.box.visible = false;
this.app.canvas.addAssistantAppends(this.box);
graphicApp.on('options-update', (options) => {
scene.on('options-update', (options) => {
if (options.mouseToolOptions) {
this.options.update(options.mouseToolOptions);
if (this.isActive()) {
@ -97,6 +101,13 @@ export class CommonMouseTool extends AppInteractionPlugin {
return new CommonMouseTool(app);
}
private updateBoxLineColor(cp: ICanvasProperties) {
// 根据画布背景调整线色
const color = new Color(cp.backgroundColor);
const cn = color.toNumber() ^ 0xffffff;
this._boxLineColor.setValue(cn);
}
bind(): void {
const canvas = this.app.canvas;
canvas.on('mousedown', this.onMouseDown, this);
@ -294,7 +305,7 @@ export class CommonMouseTool extends AppInteractionPlugin {
if (!this.drag) return;
// 绘制框选矩形框
this.box.clear();
this.box.lineStyle({ width: 1, color: this.options.boxSelectColor });
this.box.lineStyle({ width: 1, color: this._boxLineColor });
const dsx = end.x - start.x;
const dsy = end.y - start.y;
let { x, y } = start;

@ -1 +1 @@
Subproject commit a65253b7a3685dabe0376caa36bda8b47d675ff7
Subproject commit 7aebba13bf04bf2c59df3595c5650a96e616bef4