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

This commit is contained in:
joylink_fanyuhong 2024-10-09 15:16:21 +08:00
commit a82c1a3400
7 changed files with 35 additions and 15 deletions

View File

@ -3,6 +3,7 @@ import {
ITccHandleData, ITccHandleData,
ITccHandleState, ITccHandleState,
TccHandle, TccHandle,
tccHandleHeight,
zeroOffset, zeroOffset,
} from 'src/graphics/tccHandle/TccHandle'; } from 'src/graphics/tccHandle/TccHandle';
import { tccGraphicData } from 'src/protos/tccGraphics'; import { tccGraphicData } from 'src/protos/tccGraphics';
@ -138,15 +139,15 @@ export class TccHandleInteraction extends GraphicInteractionPlugin<TccHandle> {
if ( if (
this.isMouseDown && this.isMouseDown &&
useTccStore().canvasMouseDown && useTccStore().canvasMouseDown &&
tccHandle._tccHandle.y > -145 && tccHandle._tccHandle.y > -tccHandleHeight - 1 &&
tccHandle._tccHandle.y < 145 tccHandle._tccHandle.y < tccHandleHeight + 1
) { ) {
tccHandle._tccHandle.y = tccHandle._tccHandle.y =
this.mouseDownTccHandleBeginPos + e.clientY - this.mouseDownBeginPos; this.mouseDownTccHandleBeginPos + e.clientY - this.mouseDownBeginPos;
if (tccHandle._tccHandle.y >= 145) { if (tccHandle._tccHandle.y >= tccHandleHeight + 1) {
tccHandle._tccHandle.y = 144; tccHandle._tccHandle.y = tccHandleHeight;
} else if (tccHandle._tccHandle.y <= -145) { } else if (tccHandle._tccHandle.y <= -tccHandleHeight - 1) {
tccHandle._tccHandle.y = -144; tccHandle._tccHandle.y = -tccHandleHeight;
} }
let transFormHandleVal = 0; let transFormHandleVal = 0;
if ( if (
@ -160,7 +161,7 @@ export class TccHandleInteraction extends GraphicInteractionPlugin<TccHandle> {
transFormHandleVal = tccHandle._tccHandle.y - zeroOffset; transFormHandleVal = tccHandle._tccHandle.y - zeroOffset;
} }
tccHandle._stateVal = Number( tccHandle._stateVal = Number(
(-(transFormHandleVal / (144 - zeroOffset)) * 100).toFixed() (-(transFormHandleVal / (tccHandleHeight - zeroOffset)) * 100).toFixed()
); );
tccHandle.labelGraphic.text = Math.abs(tccHandle._stateVal) + '%'; tccHandle.labelGraphic.text = Math.abs(tccHandle._stateVal) + '%';
tccHandle.labelGraphic.y = tccHandle._tccHandle.y; tccHandle.labelGraphic.y = tccHandle._tccHandle.y;

View File

@ -40,6 +40,7 @@ export class TccButton extends JlGraphic {
this._tccButton = new Sprite(); this._tccButton = new Sprite();
this._tccButton.texture = this.tccButtonTextures.redBtn; this._tccButton.texture = this.tccButtonTextures.redBtn;
this._tccButton.anchor.set(0.5); this._tccButton.anchor.set(0.5);
this._tccButton.scale.set(0.7);
this.addChild(this._tccButton); this.addChild(this._tccButton);
} }
get code(): string { get code(): string {

View File

@ -9,6 +9,7 @@ import {
JlGraphic, JlGraphic,
} from 'jl-graphic'; } from 'jl-graphic';
import { ITccButtonData, TccButton, TccButtonTemplate } from './TccButton'; import { ITccButtonData, TccButton, TccButtonTemplate } from './TccButton';
import { TccLight } from '../tccLight/TccLight';
export class TccButtonDraw extends GraphicDrawAssistant< export class TccButtonDraw extends GraphicDrawAssistant<
TccButtonTemplate, TccButtonTemplate,
@ -66,6 +67,7 @@ function buildAbsorbablePositions(tccButton: TccButton): AbsorbablePosition[] {
const tccButtons = tccButton.queryStore.queryByType<TccButton>( const tccButtons = tccButton.queryStore.queryByType<TccButton>(
TccButton.Type TccButton.Type
); );
const tccLights = tccButton.queryStore.queryByType<TccLight>(TccLight.Type);
const canvas = tccButton.getCanvas(); const canvas = tccButton.getCanvas();
tccButtons.forEach((item) => { tccButtons.forEach((item) => {
if (item.id === tccButton.id) { if (item.id === tccButton.id) {
@ -82,6 +84,18 @@ function buildAbsorbablePositions(tccButton: TccButton): AbsorbablePosition[] {
aps.push(ala); aps.push(ala);
aps.push(alb); 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; return aps;
} }

View File

@ -11,6 +11,7 @@ import Tcc_Handle_JSON from './tcc-handle-data.json';
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js'; import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
export const zeroOffset = 9; export const zeroOffset = 9;
export const tccHandleHeight = 100;
interface TccHandleTextures { interface TccHandleTextures {
tccHandle: Texture; tccHandle: Texture;
handleBackground: Texture; handleBackground: Texture;
@ -41,10 +42,12 @@ export class TccHandle extends JlGraphic {
this._tccHandle = new Sprite(); this._tccHandle = new Sprite();
this._tccHandle.texture = this.tccHandleTextures.tccHandle; this._tccHandle.texture = this.tccHandleTextures.tccHandle;
this._tccHandle.anchor.set(0.5); this._tccHandle.anchor.set(0.5);
this._tccHandle.scale.set(0.7);
this._tccHandleBackground = new Sprite(); this._tccHandleBackground = new Sprite();
this._tccHandleBackground.texture = this.tccHandleTextures.handleBackground; this._tccHandleBackground.texture = this.tccHandleTextures.handleBackground;
this._tccHandleBackground.anchor.set(0.5); 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._tccHandleBackground);
this.addChild(this._tccHandle); this.addChild(this._tccHandle);
this.setTextGraphic(this.labelGraphic); this.setTextGraphic(this.labelGraphic);
@ -61,7 +64,7 @@ export class TccHandle extends JlGraphic {
} }
doRepaint(): void { doRepaint(): void {
if (!this.canDoRepaint) return; if (!this.canDoRepaint) return;
const pos = -(this.state.gear * (144 - zeroOffset)) / 100; const pos = -(this.state.gear * (tccHandleHeight - zeroOffset)) / 100;
if (pos > 0) { if (pos > 0) {
this._tccHandle.y = pos + zeroOffset; this._tccHandle.y = pos + zeroOffset;
} else if (pos < 0) { } else if (pos < 0) {

View File

@ -40,11 +40,12 @@ export class TccKey extends JlGraphic {
this.tccKeyTextures = tccKeyTextures; this.tccKeyTextures = tccKeyTextures;
this._tccKey = new Sprite(); this._tccKey = new Sprite();
this._tccKey.texture = this.tccKeyTextures.tccKey; 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._tccKey.anchor.set(0.5);
this._tccBackground = new Sprite(); this._tccBackground = new Sprite();
this._tccBackground.texture = this.tccKeyTextures.tccKeyBackground; this._tccBackground.texture = this.tccKeyTextures.tccKeyBackground;
this._tccBackground.anchor.set(0.5); this._tccBackground.anchor.set(0.5);
this._tccBackground.scale.set(0.7);
this.addChild(this._tccBackground); this.addChild(this._tccBackground);
this.addChild(this._tccKey); this.addChild(this._tccKey);
} }

View File

@ -24,9 +24,9 @@ export interface ItccLightData extends GraphicData {
set code(v: string); set code(v: string);
get lightColor(): tccGraphicData.TccElementColor; get lightColor(): tccGraphicData.TccElementColor;
set lightColor(v: tccGraphicData.TccElementColor); set lightColor(v: tccGraphicData.TccElementColor);
get activeLevel(): boolean;//有效电平 get activeLevel(): boolean; //有效电平
set activeLevel(v: boolean); set activeLevel(v: boolean);
get initialState(): boolean;//初始状态,与有效电平对比,如何想同,刚开始打开驾驶台的时候就是亮着的 get initialState(): boolean; //初始状态,与有效电平对比,如何想同,刚开始打开驾驶台的时候就是亮着的
set initialState(v: boolean); set initialState(v: boolean);
} }
@ -47,7 +47,7 @@ export class TccLight extends JlGraphic {
this.tccLightTextures = tccLightTextures; this.tccLightTextures = tccLightTextures;
this._tccLight = new Sprite(); this._tccLight = new Sprite();
this._tccLight.texture = this.tccLightTextures.greenOff; 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._tccLight.anchor.set(0.5);
this.addChild(this._tccLight); this.addChild(this._tccLight);
} }

View File

@ -267,8 +267,8 @@ function pslHide() {
} }
//Tcc //Tcc
const tccStore = useTccStore(); const tccStore = useTccStore();
const tccCanvasWidth = ref(1000); const tccCanvasWidth = ref(1130);
const tccCanvasHeight = ref(630); const tccCanvasHeight = ref(450);
watch( watch(
() => tccStore.isTccDialogOpen, () => tccStore.isTccDialogOpen,
(val: boolean) => { (val: boolean) => {