fixed dropdown speed selection

This commit is contained in:
znetsixe
2025-11-20 11:09:44 +01:00
parent fb75fb8a11
commit 6ca6e536a5
2 changed files with 19 additions and 1 deletions

View File

@@ -24,6 +24,7 @@
warmup: { value: 0 }, warmup: { value: 0 },
shutdown: { value: 0 }, shutdown: { value: 0 },
cooldown: { value: 0 }, cooldown: { value: 0 },
movementMode : { value: "staticspeed" }, // static or dynamic
machineCurve : { value: {}}, machineCurve : { value: {}},
//define asset properties //define asset properties
@@ -74,6 +75,10 @@
document.getElementById("node-input-warmup"); document.getElementById("node-input-warmup");
document.getElementById("node-input-shutdown"); document.getElementById("node-input-shutdown");
document.getElementById("node-input-cooldown"); document.getElementById("node-input-cooldown");
const movementMode = document.getElementById("node-input-movementMode");
if (movementMode) {
movementMode.value = this.movementMode || "staticspeed";
}
}, },
oneditsave: function() { oneditsave: function() {
@@ -99,6 +104,9 @@
node[field] = value; node[field] = value;
}); });
node.movementMode = document.getElementById("node-input-movementMode").value;
console.log(`----------------> Saving movementMode: ${node.movementMode}`);
} }
}); });
</script> </script>
@@ -127,6 +135,13 @@
<label for="node-input-cooldown"><i class="fa fa-clock-o"></i> Cooldown Time</label> <label for="node-input-cooldown"><i class="fa fa-clock-o"></i> Cooldown Time</label>
<input type="number" id="node-input-cooldown" style="width:60%;" /> <input type="number" id="node-input-cooldown" style="width:60%;" />
</div> </div>
<div class="form-row">
<label for="node-input-movementMode"><i class="fa fa-exchange"></i> Movement Mode</label>
<select id="node-input-movementMode" style="width:60%;">
<option value="staticspeed">Static</option>
<option value="dynspeed">Dynamic</option>
</select>
</div>
<!-- Asset fields injected here --> <!-- Asset fields injected here -->
<div id="asset-fields-placeholder"></div> <div id="asset-fields-placeholder"></div>

View File

@@ -76,6 +76,8 @@ class nodeClass {
_setupSpecificClass(uiConfig) { _setupSpecificClass(uiConfig) {
const machineConfig = this.config; const machineConfig = this.config;
console.log(`----------------> Loaded movementMode in nodeClass: ${uiConfig.movementMode}`);
// need extra state for this // need extra state for this
const stateConfig = { const stateConfig = {
general: { general: {
@@ -85,7 +87,8 @@ class nodeClass {
} }
}, },
movement: { movement: {
speed: Number(uiConfig.speed) speed: Number(uiConfig.speed),
mode: uiConfig.movementMode
}, },
time: { time: {
starting: Number(uiConfig.startup), starting: Number(uiConfig.startup),