列车驾驶台方向按钮操作失败会回到之前的位置
This commit is contained in:
parent
bdefc71cef
commit
89012e6290
@ -107,7 +107,6 @@ export abstract class KeyInteraction<
|
||||
mouseDownBeginRotation = 0;
|
||||
changeRotation = 0;
|
||||
keyInteractionConfig: IKeyInteractionConfig;
|
||||
lastTimenRotation = 0;
|
||||
constructor(
|
||||
name: string,
|
||||
app: IGraphicScene,
|
||||
@ -155,7 +154,7 @@ export abstract class KeyInteraction<
|
||||
this.mouseDownBeginPos = this.app.toCanvasCoordinates(e.global);
|
||||
this.mouseDownBeginRotation = this.ratatingSprite.rotation;
|
||||
this.changeRotation = this.mouseDownBeginRotation;
|
||||
this.lastTimenRotation = this.ratatingSprite.rotation;
|
||||
useTccStore().tccKeyLastRotation = this.ratatingSprite.rotation;
|
||||
}
|
||||
onMousemove(e: FederatedMouseEvent) {
|
||||
const target = e.target as DisplayObject;
|
||||
@ -204,8 +203,7 @@ export abstract class KeyInteraction<
|
||||
this.changeRotation = this.mouseDownBeginRotation - Math.PI / 2;
|
||||
}
|
||||
}
|
||||
if (this.lastTimenRotation !== this.changeRotation) {
|
||||
this.lastTimenRotation = this.changeRotation;
|
||||
if (this.ratatingSprite.rotation !== this.changeRotation) {
|
||||
this.ratatingSprite.rotation = this.changeRotation;
|
||||
useTccStore().onMouseUpFromTccKeyDir();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ export const useTccStore = defineStore('tcc', {
|
||||
tccHandleId: 0,
|
||||
mouseDownOnTccKeyDir: false,
|
||||
tccKeyDirId: 0,
|
||||
tccKeyLastRotation: 0,
|
||||
}),
|
||||
actions: {
|
||||
getTccScene() {
|
||||
@ -84,9 +85,14 @@ export const useTccStore = defineStore('tcc', {
|
||||
dirKey: {
|
||||
val: position,
|
||||
},
|
||||
}).catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
this.tccKeyLastRotation = tccKeyDir._tccKey.rotation;
|
||||
})
|
||||
.catch((err) => {
|
||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||
tccKeyDir._tccKey.rotation = this.tccKeyLastRotation;
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user