Merge branch 'master' of git.code.tencent.com:xian-ncc-da/xian-ncc-da-client
This commit is contained in:
commit
7f292426c8
@ -1 +1 @@
|
|||||||
Subproject commit df9615fe48fb15a572746e51462e5508db7d4c07
|
Subproject commit c66f841526d22af7dcb8ce768ad96488f13468c3
|
@ -15,6 +15,7 @@ import {
|
|||||||
IGraphicStorage,
|
IGraphicStorage,
|
||||||
IJlCanvas,
|
IJlCanvas,
|
||||||
} from './JlGraphicApp';
|
} from './JlGraphicApp';
|
||||||
|
import { GraphicDataUpdateOperation } from './BasicOperation';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实例化图形app
|
* 实例化图形app
|
||||||
@ -34,7 +35,7 @@ export function newDrawApp(options: DrawAppOptions): IDrawApp {
|
|||||||
return new JlDrawApp(options);
|
return new JlDrawApp(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { AppConsts, GraphicDrawAssistant };
|
export { AppConsts, GraphicDrawAssistant, GraphicDataUpdateOperation };
|
||||||
export type {
|
export type {
|
||||||
DrawAssistant,
|
DrawAssistant,
|
||||||
ICanvasProperties,
|
ICanvasProperties,
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
import { DisplayObject, FederatedMouseEvent, Graphics, Point } from 'pixi.js';
|
import {
|
||||||
import { IGraphicScene } from '../app';
|
Color,
|
||||||
|
DisplayObject,
|
||||||
|
FederatedMouseEvent,
|
||||||
|
Graphics,
|
||||||
|
Point,
|
||||||
|
} from 'pixi.js';
|
||||||
|
import { ICanvasProperties, IGraphicScene } from '../app';
|
||||||
import { JlGraphic } from '../core';
|
import { JlGraphic } from '../core';
|
||||||
import {
|
import {
|
||||||
AppDragEvent,
|
AppDragEvent,
|
||||||
@ -14,10 +20,6 @@ export interface IMouseToolOptions {
|
|||||||
* 是否启用框选,默认启用
|
* 是否启用框选,默认启用
|
||||||
*/
|
*/
|
||||||
boxSelect?: boolean;
|
boxSelect?: boolean;
|
||||||
/**
|
|
||||||
* 框选框的颜色--默认黑色
|
|
||||||
*/
|
|
||||||
boxSelectColor?: string;
|
|
||||||
/**
|
/**
|
||||||
* 是否启用视口拖拽(默认右键),默认启用
|
* 是否启用视口拖拽(默认右键),默认启用
|
||||||
*/
|
*/
|
||||||
@ -36,7 +38,6 @@ 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;
|
||||||
@ -53,7 +54,6 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,6 +66,7 @@ export class CommonMouseTool extends AppInteractionPlugin {
|
|||||||
static SelectBox = '__select_box';
|
static SelectBox = '__select_box';
|
||||||
options: CompleteMouseToolOptions;
|
options: CompleteMouseToolOptions;
|
||||||
box: Graphics;
|
box: Graphics;
|
||||||
|
_boxLineColor: Color;
|
||||||
leftDownTarget: DisplayObject | null = null;
|
leftDownTarget: DisplayObject | null = null;
|
||||||
|
|
||||||
drag = false;
|
drag = false;
|
||||||
@ -73,16 +74,19 @@ export class CommonMouseTool extends AppInteractionPlugin {
|
|||||||
|
|
||||||
rightTarget: DisplayObject | null = null;
|
rightTarget: DisplayObject | null = null;
|
||||||
|
|
||||||
constructor(graphicApp: IGraphicScene) {
|
constructor(scene: IGraphicScene) {
|
||||||
super(CommonMouseTool.Name, graphicApp);
|
super(CommonMouseTool.Name, scene);
|
||||||
this.options = new CompleteMouseToolOptions();
|
this.options = new CompleteMouseToolOptions();
|
||||||
|
|
||||||
this.box = new Graphics();
|
this.box = new Graphics();
|
||||||
|
this._boxLineColor = new Color();
|
||||||
|
|
||||||
|
scene.canvas.on('dataupdate', this.updateBoxLineColor, this);
|
||||||
this.box.name = CommonMouseTool.SelectBox;
|
this.box.name = CommonMouseTool.SelectBox;
|
||||||
this.box.visible = false;
|
this.box.visible = false;
|
||||||
this.app.canvas.addAssistantAppends(this.box);
|
this.app.canvas.addAssistantAppends(this.box);
|
||||||
|
|
||||||
graphicApp.on('options-update', (options) => {
|
scene.on('options-update', (options) => {
|
||||||
if (options.mouseToolOptions) {
|
if (options.mouseToolOptions) {
|
||||||
this.options.update(options.mouseToolOptions);
|
this.options.update(options.mouseToolOptions);
|
||||||
if (this.isActive()) {
|
if (this.isActive()) {
|
||||||
@ -97,6 +101,13 @@ export class CommonMouseTool extends AppInteractionPlugin {
|
|||||||
return new CommonMouseTool(app);
|
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 {
|
bind(): void {
|
||||||
const canvas = this.app.canvas;
|
const canvas = this.app.canvas;
|
||||||
canvas.on('mousedown', this.onMouseDown, this);
|
canvas.on('mousedown', this.onMouseDown, this);
|
||||||
@ -294,7 +305,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: this.options.boxSelectColor });
|
this.box.lineStyle({ width: 1, color: this._boxLineColor });
|
||||||
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;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit a65253b7a3685dabe0376caa36bda8b47d675ff7
|
Subproject commit 7aebba13bf04bf2c59df3595c5650a96e616bef4
|
Loading…
Reference in New Issue
Block a user