diff --git a/src/drawApp/graphics/TccHandleInteraction.ts b/src/drawApp/graphics/TccHandleInteraction.ts index 07eb7bd..bd6dfd3 100644 --- a/src/drawApp/graphics/TccHandleInteraction.ts +++ b/src/drawApp/graphics/TccHandleInteraction.ts @@ -3,6 +3,7 @@ import { ITccHandleData, ITccHandleState, TccHandle, + tccHandleHeight, zeroOffset, } from 'src/graphics/tccHandle/TccHandle'; import { tccGraphicData } from 'src/protos/tccGraphics'; @@ -138,15 +139,15 @@ export class TccHandleInteraction extends GraphicInteractionPlugin { if ( this.isMouseDown && useTccStore().canvasMouseDown && - tccHandle._tccHandle.y > -145 && - tccHandle._tccHandle.y < 145 + tccHandle._tccHandle.y > -tccHandleHeight - 1 && + tccHandle._tccHandle.y < tccHandleHeight + 1 ) { tccHandle._tccHandle.y = this.mouseDownTccHandleBeginPos + e.clientY - this.mouseDownBeginPos; - if (tccHandle._tccHandle.y >= 145) { - tccHandle._tccHandle.y = 144; - } else if (tccHandle._tccHandle.y <= -145) { - tccHandle._tccHandle.y = -144; + if (tccHandle._tccHandle.y >= tccHandleHeight + 1) { + tccHandle._tccHandle.y = tccHandleHeight; + } else if (tccHandle._tccHandle.y <= -tccHandleHeight - 1) { + tccHandle._tccHandle.y = -tccHandleHeight; } let transFormHandleVal = 0; if ( @@ -160,7 +161,7 @@ export class TccHandleInteraction extends GraphicInteractionPlugin { transFormHandleVal = tccHandle._tccHandle.y - zeroOffset; } tccHandle._stateVal = Number( - (-(transFormHandleVal / (144 - zeroOffset)) * 100).toFixed() + (-(transFormHandleVal / (tccHandleHeight - zeroOffset)) * 100).toFixed() ); tccHandle.labelGraphic.text = Math.abs(tccHandle._stateVal) + '%'; tccHandle.labelGraphic.y = tccHandle._tccHandle.y; diff --git a/src/graphics/tccButton/TccButton.ts b/src/graphics/tccButton/TccButton.ts index 9b42c3c..5962a8f 100644 --- a/src/graphics/tccButton/TccButton.ts +++ b/src/graphics/tccButton/TccButton.ts @@ -40,6 +40,7 @@ export class TccButton extends JlGraphic { this._tccButton = new Sprite(); this._tccButton.texture = this.tccButtonTextures.redBtn; this._tccButton.anchor.set(0.5); + this._tccButton.scale.set(0.7); this.addChild(this._tccButton); } get code(): string { diff --git a/src/graphics/tccButton/TccButtonDrawAssistant.ts b/src/graphics/tccButton/TccButtonDrawAssistant.ts index 6e1562f..2f28947 100644 --- a/src/graphics/tccButton/TccButtonDrawAssistant.ts +++ b/src/graphics/tccButton/TccButtonDrawAssistant.ts @@ -9,6 +9,7 @@ import { JlGraphic, } from 'jl-graphic'; import { ITccButtonData, TccButton, TccButtonTemplate } from './TccButton'; +import { TccLight } from '../tccLight/TccLight'; export class TccButtonDraw extends GraphicDrawAssistant< TccButtonTemplate, @@ -66,6 +67,7 @@ function buildAbsorbablePositions(tccButton: TccButton): AbsorbablePosition[] { const tccButtons = tccButton.queryStore.queryByType( TccButton.Type ); + const tccLights = tccButton.queryStore.queryByType(TccLight.Type); const canvas = tccButton.getCanvas(); tccButtons.forEach((item) => { if (item.id === tccButton.id) { @@ -82,6 +84,18 @@ function buildAbsorbablePositions(tccButton: TccButton): AbsorbablePosition[] { aps.push(ala); aps.push(alb); }); + tccLights.forEach((item) => { + const ala = new AbsorbableLine( + new Point(item.x, 0), + new Point(item.x, canvas.height) + ); + const alb = new AbsorbableLine( + new Point(0, item.y), + new Point(canvas.width, item.y) + ); + aps.push(ala); + aps.push(alb); + }); return aps; } diff --git a/src/graphics/tccHandle/TccHandle.ts b/src/graphics/tccHandle/TccHandle.ts index 1f6a238..766cd0d 100644 --- a/src/graphics/tccHandle/TccHandle.ts +++ b/src/graphics/tccHandle/TccHandle.ts @@ -11,6 +11,7 @@ import Tcc_Handle_JSON from './tcc-handle-data.json'; import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js'; export const zeroOffset = 9; +export const tccHandleHeight = 100; interface TccHandleTextures { tccHandle: Texture; handleBackground: Texture; @@ -41,10 +42,12 @@ export class TccHandle extends JlGraphic { this._tccHandle = new Sprite(); this._tccHandle.texture = this.tccHandleTextures.tccHandle; this._tccHandle.anchor.set(0.5); + this._tccHandle.scale.set(0.7); this._tccHandleBackground = new Sprite(); this._tccHandleBackground.texture = this.tccHandleTextures.handleBackground; this._tccHandleBackground.anchor.set(0.5); - this._tccHandleBackground.position.x = -20; + this._tccHandleBackground.scale.set(0.7); + this._tccHandleBackground.position.x = -14; this.addChild(this._tccHandleBackground); this.addChild(this._tccHandle); this.setTextGraphic(this.labelGraphic); @@ -61,7 +64,7 @@ export class TccHandle extends JlGraphic { } doRepaint(): void { if (!this.canDoRepaint) return; - const pos = -(this.state.gear * (144 - zeroOffset)) / 100; + const pos = -(this.state.gear * (tccHandleHeight - zeroOffset)) / 100; if (pos > 0) { this._tccHandle.y = pos + zeroOffset; } else if (pos < 0) { diff --git a/src/graphics/tccKey/TccKey.ts b/src/graphics/tccKey/TccKey.ts index 8a9a7d3..9c97f2a 100644 --- a/src/graphics/tccKey/TccKey.ts +++ b/src/graphics/tccKey/TccKey.ts @@ -40,11 +40,12 @@ export class TccKey extends JlGraphic { this.tccKeyTextures = tccKeyTextures; this._tccKey = new Sprite(); this._tccKey.texture = this.tccKeyTextures.tccKey; - this._tccKey.scale.set(0.125); + this._tccKey.scale.set(0.0875); this._tccKey.anchor.set(0.5); this._tccBackground = new Sprite(); this._tccBackground.texture = this.tccKeyTextures.tccKeyBackground; this._tccBackground.anchor.set(0.5); + this._tccBackground.scale.set(0.7); this.addChild(this._tccBackground); this.addChild(this._tccKey); } diff --git a/src/graphics/tccLight/TccLight.ts b/src/graphics/tccLight/TccLight.ts index 92e764d..2b5402f 100644 --- a/src/graphics/tccLight/TccLight.ts +++ b/src/graphics/tccLight/TccLight.ts @@ -24,9 +24,9 @@ export interface ItccLightData extends GraphicData { set code(v: string); get lightColor(): tccGraphicData.TccElementColor; set lightColor(v: tccGraphicData.TccElementColor); - get activeLevel(): boolean;//有效电平 + get activeLevel(): boolean; //有效电平 set activeLevel(v: boolean); - get initialState(): boolean;//初始状态,与有效电平对比,如何想同,刚开始打开驾驶台的时候就是亮着的 + get initialState(): boolean; //初始状态,与有效电平对比,如何想同,刚开始打开驾驶台的时候就是亮着的 set initialState(v: boolean); } @@ -47,7 +47,7 @@ export class TccLight extends JlGraphic { this.tccLightTextures = tccLightTextures; this._tccLight = new Sprite(); this._tccLight.texture = this.tccLightTextures.greenOff; - this._tccLight.scale.set(0.25); + this._tccLight.scale.set(0.175); this._tccLight.anchor.set(0.5); this.addChild(this._tccLight); } diff --git a/src/layouts/LineLayout.vue b/src/layouts/LineLayout.vue index 4a3fe68..6f93b8d 100644 --- a/src/layouts/LineLayout.vue +++ b/src/layouts/LineLayout.vue @@ -267,8 +267,8 @@ function pslHide() { } //列车驾驶台Tcc const tccStore = useTccStore(); -const tccCanvasWidth = ref(1000); -const tccCanvasHeight = ref(630); +const tccCanvasWidth = ref(1130); +const tccCanvasHeight = ref(450); watch( () => tccStore.isTccDialogOpen, (val: boolean) => {