Merge remote-tracking branch 'origin/develop' into local-test
All checks were successful
CI / Docker-Build (push) Successful in 2m39s

This commit is contained in:
joylink_fanyuhong 2024-04-07 09:58:13 +08:00
commit 4624e3f2d4
4 changed files with 47 additions and 6 deletions

View File

@ -9,7 +9,7 @@ function getHost(): string {
// return '192.168.3.7:9091';
// return '192.168.3.47:9091';
// return '192.168.3.37:9091';
return '192.168.33.207:9091'; // 张骞
// return '192.168.33.207:9091'; // 张骞
// return '192.168.33.93:9091';
// return '192.168.3.37:9091'; //卫志宏
// return 'test.joylink.club/bjrtsts-service'; // 测试

View File

@ -20,6 +20,7 @@ import { request } from 'src/protos/request';
import { useLineStore } from 'src/stores/line-store';
import { Dialog } from 'quasar';
import XcjOperation from 'src/components/draw-app/dialogs/XcjOperation.vue';
import { CarWashingGraphicHitArea } from 'src/graphics/carWashing/CarWashingDrawAssistant';
export class CarWashingData extends GraphicDataBase implements ICarWashingData {
constructor(data?: graphicData.CarWashing) {
@ -192,6 +193,7 @@ export class CarWashingOperationInteraction extends GraphicInteractionPlugin<Car
bind(g: CarWashing): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g.rectBody.hitArea = new CarWashingGraphicHitArea(g);
g.selectable = true;
g.on('mousedown', this.onPress, this);
g.on('_rightclick', this.onContextMenu);

View File

@ -48,11 +48,11 @@ export interface ICarWashingState extends GraphicState {
set tgyxj(v: boolean);
}
const carWashingConsts = {
export const carWashingConsts = {
codeFontSize: 12,
codeColor: 0xffffff,
bodyRectLineColor: 0xffffff,
bodyRectLineWidth: 2,
bodyRectLineWidth: 6,
bodyRectWidth: 60,
bodyRectHeight: 40,
bodyColor: 0xffffff,
@ -99,7 +99,11 @@ export class CarWashing extends JlGraphic {
codeGraph.position.set(0, -30);
}
this.rectBody.clear();
this.rectBody.beginFill(carWashingConsts.bodyColor, 1);
this.rectBody.lineStyle(
carWashingConsts.bodyRectLineWidth,
carWashingConsts.bodyRectLineColor
);
this.rectBody.beginFill(carWashingConsts.bodyColor, 0);
const width = this.datas.width || carWashingConsts.bodyRectWidth;
this.rectBody.drawRect(
-width / 2,
@ -108,6 +112,7 @@ export class CarWashing extends JlGraphic {
carWashingConsts.bodyRectHeight
);
this.rectBody.endFill();
this.stopText.text = '';
if (this.states.jtj) {
this.stopText.text = '紧';
this.stopText.style.fill = carWashingConsts.codeColor;

View File

@ -1,4 +1,4 @@
import { DisplayObject, FederatedMouseEvent, Point } from 'pixi.js';
import { DisplayObject, FederatedMouseEvent, Point, IHitArea } from 'pixi.js';
import {
AbsorbableLine,
AbsorbablePosition,
@ -8,7 +8,12 @@ import {
IDrawApp,
JlGraphic,
} from 'jl-graphic';
import { CarWashing, CarWashingTemplate, ICarWashingData } from './CarWashing';
import {
CarWashing,
CarWashingTemplate,
ICarWashingData,
carWashingConsts,
} from './CarWashing';
import { Section } from '../section/Section';
export interface ICarWashingDataDrawOptions {
@ -75,6 +80,33 @@ function buildAbsorbablePositions(
return aps;
}
export class CarWashingGraphicHitArea implements IHitArea {
carWashing: CarWashing;
constructor(carWashing: CarWashing) {
this.carWashing = carWashing;
}
contains(x: number, y: number): boolean {
const bound = this.carWashing.rectBody.getLocalBounds();
const maxX = bound.x + bound.width;
const minX = bound.x;
const maxY = bound.y + bound.height;
const minY = bound.y;
const flag1 = maxX >= x && x >= minX && maxY >= y && y >= minY;
const maxX1 = bound.x + bound.width - carWashingConsts.bodyRectLineWidth;
const minX1 = bound.x + carWashingConsts.bodyRectLineWidth;
const maxY1 = bound.y + bound.height - carWashingConsts.bodyRectLineWidth;
const minY1 = bound.y + carWashingConsts.bodyRectLineWidth;
const flag2 = maxX1 >= x && x >= minX1 && maxY1 >= y && y >= minY1;
const bound1 = this.carWashing.codeGraph.getLocalBounds();
const maxX2 = bound1.x + bound1.width;
const minX2 = bound1.x;
const maxY2 = bound1.y + bound1.height;
const minY2 = bound1.y;
const flag3 = maxX2 >= x && x >= minX2 && maxY2 >= y && y >= minY2;
return (flag1 && !flag2) || flag3;
}
}
export class CarWashingInteraction extends GraphicInteractionPlugin<CarWashing> {
static Name = 'car_washing_transform';
constructor(app: IDrawApp) {
@ -93,6 +125,8 @@ export class CarWashingInteraction extends GraphicInteractionPlugin<CarWashing>
g.cursor = 'pointer';
g.scalable = true;
g.rotatable = true;
g.rectBody.hitArea = new CarWashingGraphicHitArea(g);
g.codeGraph.cursor = 'pointer';
g.codeGraph.draggable = true;
g.codeGraph.selectable = true;
g.codeGraph.rotatable = true;