Re-implement stage button inversion and update position during move.
This commit is contained in:
parent
586d45aed3
commit
84488b579b
3 changed files with 23 additions and 22 deletions
|
|
@ -250,14 +250,14 @@ export default {
|
|||
event.target.parentNode.classList.contains("scrollTarget") ||
|
||||
event.target.classList.contains("scrollTarget")
|
||||
) {
|
||||
const z_steps = event.deltaY / 100;
|
||||
const z_rel = event.deltaY / 100;
|
||||
// Emit a signal to move, acted on by panelControl.vue
|
||||
eventBus.emit("globalMoveStepEvent", {
|
||||
x_steps: 0,
|
||||
y_steps: 0,
|
||||
z_steps: z_steps,
|
||||
absolute: false,
|
||||
});
|
||||
const navigationStepSize = this.$store.state.navigationStepSize;
|
||||
const z = z_rel * navigationStepSize.z;
|
||||
// Don't use `jog() due to variable size of jogs here and the rate limiting in
|
||||
// `jog()`. No need to invert on z, as navigationInvert.z isn't exposed.
|
||||
this.invokeAction("stage", "jog", { x: 0, y: 0, z: z });
|
||||
eventBus.emit("globalUpdatePositionEvent");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -265,20 +265,26 @@ export default {
|
|||
// Manually debounce extra requests from keyboard repeat rate.
|
||||
// This is used rather than and interval in case of missing a repeat.
|
||||
const now = Date.now();
|
||||
const navigationInvert = this.$store.state.navigationInvert;
|
||||
if (now - this.lastJogTime < this.jogTime) {
|
||||
return;
|
||||
}
|
||||
this.lastJogTime = now;
|
||||
|
||||
this.invokeAction("stage", "jog", {
|
||||
x: x * this.jogDistance,
|
||||
y: y * this.jogDistance,
|
||||
x: x * this.jogDistance * (navigationInvert.x ? -1 : 1),
|
||||
y: y * this.jogDistance * (navigationInvert.y ? -1 : 1),
|
||||
z: z * this.jogDistance,
|
||||
});
|
||||
eventBus.emit("globalUpdatePositionEvent");
|
||||
},
|
||||
|
||||
jogStop() {
|
||||
this.invokeAction("stage", "jog", { stop: true });
|
||||
this.lastJogTime = 0;
|
||||
setTimeout(() => {
|
||||
eventBus.emit("globalUpdatePositionEvent");
|
||||
}, 100);
|
||||
},
|
||||
|
||||
updateJogFromKeys() {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ export default {
|
|||
// A global signal listener to perform a move action in pixels
|
||||
eventBus.on("globalMoveInImageCoordinatesEvent", this.onMoveImage);
|
||||
// A global signal listener to perform a move in multiples of a step size
|
||||
eventBus.on("globalMoveStepEvent", this.onMoveStep);
|
||||
|
||||
// Update the current position in text boxes
|
||||
await this.updatePosition();
|
||||
|
|
@ -105,7 +104,6 @@ export default {
|
|||
eventBus.off("globalMoveEvent", this.move);
|
||||
eventBus.off("globalUpdatePositionEvent", this.updatePosition);
|
||||
eventBus.off("globalMoveInImageCoordinatesEvent", this.onMoveImage);
|
||||
eventBus.off("globalMoveStepEvent", this.onMoveStep);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
@ -117,15 +115,6 @@ export default {
|
|||
this.moveInImageCoordinatesRequest(payload.x, payload.y, payload.absolute);
|
||||
},
|
||||
|
||||
onMoveStep(payload) {
|
||||
const navigationStepSize = this.$store.state.navigationStepSize;
|
||||
const navigationInvert = this.$store.state.navigationInvert;
|
||||
const x = payload.x_steps * navigationStepSize.x * (navigationInvert.x ? -1 : 1);
|
||||
const y = payload.y_steps * navigationStepSize.y * (navigationInvert.y ? -1 : 1);
|
||||
const z = payload.z_steps * navigationStepSize.z * (navigationInvert.z ? -1 : 1);
|
||||
this.invokeAction("stage", "jog", { x: x, y: y, z: z });
|
||||
},
|
||||
|
||||
async move(payload) {
|
||||
const { x, y, z, absolute } = payload;
|
||||
// Move the stage, by updating the controls and starting a move task
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { eventBus } from "@/eventBus.js";
|
||||
|
||||
export default {
|
||||
name: "StageControlButtons",
|
||||
data: () => ({
|
||||
|
|
@ -77,10 +79,11 @@ export default {
|
|||
if (this.jogIntervalId) {
|
||||
clearInterval(this.jogIntervalId);
|
||||
}
|
||||
const navigationInvert = this.$store.state.navigationInvert;
|
||||
let invokeJog = () =>
|
||||
this.invokeAction("stage", "jog", {
|
||||
x: x * this.jogDistance,
|
||||
y: y * this.jogDistance,
|
||||
x: x * this.jogDistance * (navigationInvert.x ? -1 : 1),
|
||||
y: y * this.jogDistance * (navigationInvert.y ? -1 : 1),
|
||||
z: z * this.jogDistance,
|
||||
});
|
||||
invokeJog();
|
||||
|
|
@ -91,6 +94,9 @@ export default {
|
|||
clearInterval(this.jogIntervalId);
|
||||
}
|
||||
this.invokeAction("stage", "jog", { stop: true });
|
||||
setTimeout(() => {
|
||||
eventBus.emit("globalUpdatePositionEvent");
|
||||
}, 100);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue