Merge branch 'develop' of http://120.46.212.6:3000/joylink/rts-sim-testing-client into develop
This commit is contained in:
commit
94607edcfe
@ -9,6 +9,7 @@ import Tcc_Handle_JSON from './tcc-handle-data.json';
|
||||
|
||||
import { Assets, Sprite, Spritesheet, Texture } from 'pixi.js';
|
||||
|
||||
export const zeroOffset = 9;
|
||||
interface TccHandleTextures {
|
||||
tccHandle: Texture;
|
||||
handleBackground: Texture;
|
||||
@ -54,7 +55,14 @@ export class TccHandle extends JlGraphic {
|
||||
return this.getStates<ITccHandleState>();
|
||||
}
|
||||
doRepaint(): void {
|
||||
this._tccHandle.y = -(this.state.gear * 144) / 100;
|
||||
const pos = -(this.state.gear * (144 - zeroOffset)) / 100;
|
||||
if (pos > 0) {
|
||||
this._tccHandle.y = pos + zeroOffset;
|
||||
} else if (pos < 0) {
|
||||
this._tccHandle.y = pos - zeroOffset;
|
||||
} else {
|
||||
this._tccHandle.y = 0;
|
||||
}
|
||||
this._tccHandle.texture = this.tccHandleTextures.tccHandle;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { useLineStore } from './line-store';
|
||||
import { tccOperation } from 'src/api/Simulation';
|
||||
import { errorNotify } from 'src/utils/CommonNotify';
|
||||
import { request } from 'src/protos/request';
|
||||
import { TccHandle } from 'src/graphics/tccHandle/TccHandle';
|
||||
import { TccHandle, zeroOffset } from 'src/graphics/tccHandle/TccHandle';
|
||||
import { TccKey } from 'src/graphics/tccKey/TccKey';
|
||||
import { IGraphicApp } from 'jl-graphic';
|
||||
|
||||
@ -47,8 +47,19 @@ export const useTccStore = defineStore('tcc', {
|
||||
.getScene(`tcc${this.tccId}`)
|
||||
.queryStore.queryById<TccHandle>(this.tccHandleId);
|
||||
if (!simulationId) return;
|
||||
let transFormHandleVal = 0;
|
||||
if (
|
||||
tccHandle._tccHandle.y >= -zeroOffset &&
|
||||
tccHandle._tccHandle.y <= zeroOffset
|
||||
) {
|
||||
tccHandle._tccHandle.y = 0;
|
||||
} else if (tccHandle._tccHandle.y < -zeroOffset) {
|
||||
transFormHandleVal = tccHandle._tccHandle.y + zeroOffset;
|
||||
} else {
|
||||
transFormHandleVal = tccHandle._tccHandle.y - zeroOffset;
|
||||
}
|
||||
const handleVal = Number(
|
||||
(-(tccHandle._tccHandle.y / 144) * 100).toFixed()
|
||||
(-(transFormHandleVal / (144 - zeroOffset)) * 100).toFixed()
|
||||
);
|
||||
tccOperation({
|
||||
simulationId,
|
||||
|
Loading…
Reference in New Issue
Block a user