ui_migration fix(bugfix): found caused eventBus/this., and {x,y,z,absolute} parsing arguments incorrectly, BUG:keys-arrows-wont-move prevents @finished emit status for task
This commit is contained in:
parent
0296cef089
commit
9992ca642c
4 changed files with 77 additions and 49 deletions
|
|
@ -154,10 +154,10 @@ export default {
|
||||||
|
|
||||||
// Focus keys
|
// Focus keys
|
||||||
Mousetrap.bind("pageup", () => {
|
Mousetrap.bind("pageup", () => {
|
||||||
eventBus.emit("globalMoveStepEvent", 0, 0, 1);
|
eventBus.emit("globalMoveStepEvent", {x: 0, y: 0, z: 1});
|
||||||
});
|
});
|
||||||
Mousetrap.bind("pagedown", () => {
|
Mousetrap.bind("pagedown", () => {
|
||||||
eventBus.emit("globalMoveStepEvent", 0, 0, -1);
|
eventBus.emit("globalMoveStepEvent", {x: 0, y: 0, z: -1});
|
||||||
});
|
});
|
||||||
this.keyboardManual.push({
|
this.keyboardManual.push({
|
||||||
shortcut: "pgup / pgdn",
|
shortcut: "pgup / pgdn",
|
||||||
|
|
@ -166,7 +166,7 @@ export default {
|
||||||
|
|
||||||
// Capture
|
// Capture
|
||||||
Mousetrap.bind("c", () => {
|
Mousetrap.bind("c", () => {
|
||||||
eventBus.emit("globalCaptureEvent");
|
eventBus.emit("globalCaptureEvent", {});
|
||||||
});
|
});
|
||||||
this.keyboardManual.push({
|
this.keyboardManual.push({
|
||||||
shortcut: "c",
|
shortcut: "c",
|
||||||
|
|
@ -175,7 +175,7 @@ export default {
|
||||||
|
|
||||||
// Autofocus
|
// Autofocus
|
||||||
Mousetrap.bind("a", () => {
|
Mousetrap.bind("a", () => {
|
||||||
eventBus.emit("globalFastAutofocusEvent");
|
eventBus.emit("globalFastAutofocusEvent", {});
|
||||||
});
|
});
|
||||||
this.keyboardManual.push({
|
this.keyboardManual.push({
|
||||||
shortcut: "a",
|
shortcut: "a",
|
||||||
|
|
@ -184,10 +184,10 @@ export default {
|
||||||
|
|
||||||
// Increment/decrement tab
|
// Increment/decrement tab
|
||||||
Mousetrap.bind("shift+down", () => {
|
Mousetrap.bind("shift+down", () => {
|
||||||
eventBus.emit("globalIncrementTab");
|
eventBus.emit("globalIncrementTab", {});
|
||||||
});
|
});
|
||||||
Mousetrap.bind("shift+up", () => {
|
Mousetrap.bind("shift+up", () => {
|
||||||
eventBus.emit("globalDecrementTab");
|
eventBus.emit("globalDecrementTab", {});
|
||||||
});
|
});
|
||||||
this.keyboardManual.push({
|
this.keyboardManual.push({
|
||||||
shortcut: "shift+↑ / shift+↓",
|
shortcut: "shift+↑ / shift+↓",
|
||||||
|
|
@ -250,7 +250,7 @@ export default {
|
||||||
) {
|
) {
|
||||||
var z_rel = event.deltaY / 100;
|
var 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", 0, 0, z_rel, false);
|
eventBus.emit("globalMoveStepEvent", {x: 0, y: 0, z: z_rel, absolute: false});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -277,7 +277,7 @@ export default {
|
||||||
}
|
}
|
||||||
// Make a position request
|
// Make a position request
|
||||||
// Emit a signal to move, acted on by panelControl.vue
|
// Emit a signal to move, acted on by panelControl.vue
|
||||||
eventBus.emit("globalMoveStepEvent", x_rel, y_rel, z_rel);
|
eventBus.emit("globalMoveStepEvent", {x: x_rel, y: y_rel, z: 0});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -134,22 +134,48 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
progress(newval) {
|
progress: {
|
||||||
eventBus.emit("beforeUpdate:progress", newval);
|
handler(newval) {
|
||||||
|
//this.$emit("update:progress", newval);
|
||||||
|
eventBus.emit("update:progress", newval);
|
||||||
|
//eventBus.emit("beforeUpdate:progress", newval);
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true // Optional: triggers immediately on component load
|
||||||
},
|
},
|
||||||
taskStarted(newval) {
|
taskStarted: {
|
||||||
eventBus.emit("beforeUpdate:taskStarted", newval);
|
handler(newval) {
|
||||||
|
//this.$emit("update:taskStarted", newval);
|
||||||
|
eventBus.emit("update:taskStarted", newval);
|
||||||
|
//eventBus.emit("beforeUpdate:taskStarted", newval);
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
},
|
},
|
||||||
taskRunning(newval) {
|
taskRunning: {
|
||||||
eventBus.emit("beforeUpdate:taskRunning", newval);
|
handler(newval) {
|
||||||
|
//this.$emit("update:taskRunning", newval);
|
||||||
|
eventBus.emit("update:taskRunning", newval);
|
||||||
|
//eventBus.emit("beforeUpdate:taskRunning", newval);
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
},
|
},
|
||||||
log(newval) {
|
log: {
|
||||||
eventBus.emit("beforeUpdate:log", newval);
|
handler(newval) {
|
||||||
|
//this.$emit("update:log", newval);
|
||||||
|
eventBus.emit("update:log", newval);
|
||||||
|
//eventBus.emit("beforeUpdate:log", newval);
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
},
|
},
|
||||||
taskStatus(newval) {
|
taskStatus: {
|
||||||
eventBus.emit("beforeUpdate:taskStatus", newval);
|
handler(newval) {
|
||||||
},
|
//this.$emit("update:taskStatus", newval);
|
||||||
},
|
eventBus.emit("update:taskStatus", newval);
|
||||||
|
//eventBus.emit("beforeUpdate:taskStatus", newval);
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// Check for already running tasks
|
// Check for already running tasks
|
||||||
|
|
@ -168,11 +194,7 @@ export default {
|
||||||
|
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
if (this.submitOnEvent) {
|
if (this.submitOnEvent) {
|
||||||
eventBus.off(this.submitOnEvent, () => {
|
eventBus.off(this.submitOnEvent);
|
||||||
if (this.isDisabled) return;
|
|
||||||
// Bootstrap task if button is not disabled.
|
|
||||||
this.bootstrapTask();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -231,6 +253,7 @@ export default {
|
||||||
|
|
||||||
async startTask() {
|
async startTask() {
|
||||||
// Starts a new Action task
|
// Starts a new Action task
|
||||||
|
console.log("Starting task with data:", this.submitData);
|
||||||
eventBus.emit("submit", this.submitData);
|
eventBus.emit("submit", this.submitData);
|
||||||
// Send a request to start a task
|
// Send a request to start a task
|
||||||
this.taskStarted = true;
|
this.taskStarted = true;
|
||||||
|
|
@ -286,7 +309,7 @@ export default {
|
||||||
this.taskUrl = null;
|
this.taskUrl = null;
|
||||||
this.taskRunning = false;
|
this.taskRunning = false;
|
||||||
this.taskStarted = false;
|
this.taskStarted = false;
|
||||||
eventBus.emit("finished");
|
this.$emit("finished");
|
||||||
},
|
},
|
||||||
|
|
||||||
onPollingResponse(response) {
|
onPollingResponse(response) {
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ and zero position buttons. It also includes the d-pad.
|
||||||
<!-- Text boxes to set and view position -->
|
<!-- Text boxes to set and view position -->
|
||||||
<div class="input-and-buttons-container">
|
<div class="input-and-buttons-container">
|
||||||
<input
|
<input
|
||||||
v-for="(_v, key) in setPosition"
|
|
||||||
:key="`setPosition_${key}`"
|
:key="`setPosition_${key}`"
|
||||||
|
v-for="(_v, key) in setPosition"
|
||||||
v-model="setPosition[key]"
|
v-model="setPosition[key]"
|
||||||
class="uk-form-small numeric-setting-line-input"
|
class="uk-form-small numeric-setting-line-input"
|
||||||
type="number"
|
type="number"
|
||||||
|
|
@ -83,6 +83,7 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
positionStatusUri: function () {
|
positionStatusUri: function () {
|
||||||
|
console.log("Computing position status URI", this.thingActionUrl("stage", "position"));
|
||||||
return this.thingActionUrl("stage", "position");
|
return this.thingActionUrl("stage", "position");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -90,28 +91,11 @@ export default {
|
||||||
async mounted() {
|
async mounted() {
|
||||||
// A global signal listener to perform a move action
|
// A global signal listener to perform a move action
|
||||||
eventBus.on("globalMoveEvent", this.move);
|
eventBus.on("globalMoveEvent", this.move);
|
||||||
|
// A global signal listener to update position text boxes
|
||||||
eventBus.on("globalUpdatePositionEvent", this.updatePosition);
|
eventBus.on("globalUpdatePositionEvent", this.updatePosition);
|
||||||
// A global signal listener to perform a move action in pixels
|
// A global signal listener to perform a move action in pixels
|
||||||
|
|
||||||
this.onMoveImage = (payload) => {
|
|
||||||
const { x, y, absolute } = payload;
|
|
||||||
this.moveInImageCoordinatesRequest(payload.x, payload.y, payload.absolute);
|
|
||||||
};
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
this.onMoveStep = (payload) => {
|
|
||||||
const { x_steps, y_steps, z_steps } = payload;
|
|
||||||
const navigationStepSize = this.$store.state.navigationStepSize;
|
|
||||||
const navigationInvert = this.$store.state.navigationInvert;
|
|
||||||
const x = x_steps * navigationStepSize.x * (navigationInvert.x ? -1 : 1);
|
|
||||||
const y = y_steps * navigationStepSize.y * (navigationInvert.y ? -1 : 1);
|
|
||||||
const z = z_steps * navigationStepSize.z * (navigationInvert.z ? -1 : 1);
|
|
||||||
eventBus.emit("globalMoveEvent", {x, y, z, absolute: false});
|
|
||||||
};
|
|
||||||
|
|
||||||
eventBus.on("globalMoveStepEvent", this.onMoveStep);
|
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();
|
||||||
|
|
@ -120,15 +104,34 @@ export default {
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
// Remove global signal listener to perform a move action
|
// Remove global signal listener to perform a move action
|
||||||
eventBus.off("globalMoveEvent", this.move);
|
eventBus.off("globalMoveEvent", this.move);
|
||||||
|
eventBus.off("globalUpdatePositionEvent", this.updatePosition);
|
||||||
eventBus.off("globalMoveInImageCoordinatesEvent", this.onMoveImage);
|
eventBus.off("globalMoveInImageCoordinatesEvent", this.onMoveImage);
|
||||||
eventBus.off("globalMoveStepEvent", this.onMoveStep);
|
eventBus.off("globalMoveStepEvent", this.onMoveStep);
|
||||||
eventBus.off("globalUpdatePositionEvent", this.updatePosition);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
timeout(ms) {
|
timeout(ms) {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onMoveImage(payload) {
|
||||||
|
console.log("Received move in image coordinates:", payload);
|
||||||
|
this.moveInImageCoordinatesRequest(payload.x, payload.y, payload.absolute);
|
||||||
|
},
|
||||||
|
|
||||||
|
onMoveStep(payload) {
|
||||||
|
console.log("Received key move step event:", payload);
|
||||||
|
const { x: x_steps, y: y_steps, z: z_steps } = payload;
|
||||||
|
const navigationStepSize = this.$store.state.navigationStepSize;
|
||||||
|
const navigationInvert = this.$store.state.navigationInvert;
|
||||||
|
const x = x_steps * navigationStepSize.x * (navigationInvert.x ? -1 : 1);
|
||||||
|
const y = y_steps * navigationStepSize.y * (navigationInvert.y ? -1 : 1);
|
||||||
|
const z = z_steps * navigationStepSize.z * (navigationInvert.z ? -1 : 1);
|
||||||
|
const movePayload = { x, y, z, absolute: false };
|
||||||
|
eventBus.emit("globalMoveEvent", movePayload);
|
||||||
|
console.log("Emitted global move event with:", movePayload);
|
||||||
|
},
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -146,15 +149,17 @@ export default {
|
||||||
y: this.setPosition.y + y,
|
y: this.setPosition.y + y,
|
||||||
z: this.setPosition.z + z,
|
z: this.setPosition.z + z,
|
||||||
};
|
};
|
||||||
|
console.log("Updated setPosition for relative move:", this.setPosition);
|
||||||
}
|
}
|
||||||
await this.timeout(1); // Wait for Vue to update the position
|
await this.$nextTick(); // Wait for Vue to update the position
|
||||||
await this.startMoveTask();
|
await this.startMoveTask();
|
||||||
},
|
},
|
||||||
async startMoveTask() {
|
async startMoveTask() {
|
||||||
this.moveLock = true;
|
//this.moveLock = true;
|
||||||
await this.$refs.moveButton.startTask();
|
await this.$refs.moveButton.startTask();
|
||||||
},
|
},
|
||||||
moveComplete() {
|
moveComplete() {
|
||||||
|
console.log("Move completed.");
|
||||||
this.updatePosition();
|
this.updatePosition();
|
||||||
this.moveLock = false;
|
this.moveLock = false;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export default {
|
||||||
name: "StageControlButtons",
|
name: "StageControlButtons",
|
||||||
methods: {
|
methods: {
|
||||||
move(x, y, z) {
|
move(x, y, z) {
|
||||||
eventBus.emit("globalMoveStepEvent", x, y, z);
|
eventBus.emit("globalMoveStepEvent", {x, y, z, absolute: false});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue