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