tweaked curve point dragging thresholds
parent
21ffc99bbb
commit
a6d901d3f0
|
|
@ -774,7 +774,7 @@ for (let curve of this.curves) {
|
||||||
const curves = this.curveSets[motorID];
|
const curves = this.curveSets[motorID];
|
||||||
if (!curves) return;
|
if (!curves) return;
|
||||||
|
|
||||||
const tolerance = 2; // pixels/frames tolerance for matching existing points
|
const tolerance = 4; // pixels/frames tolerance for matching existing points
|
||||||
|
|
||||||
for (let i = 0; i < curves.length; i++) {
|
for (let i = 0; i < curves.length; i++) {
|
||||||
const curve = curves[i];
|
const curve = curves[i];
|
||||||
|
|
@ -787,7 +787,7 @@ for (let curve of this.curves) {
|
||||||
curve.startPoint.y = yEditor;
|
curve.startPoint.y = yEditor;
|
||||||
if (curve.startPointHandle) curve.startPointHandle.y = yEditor;
|
if (curve.startPointHandle) curve.startPointHandle.y = yEditor;
|
||||||
} else {
|
} else {
|
||||||
// remove point by merging with previous
|
// 🚫 don't allow deleting the very first control point
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
const prev = curves[i - 1];
|
const prev = curves[i - 1];
|
||||||
const merged = {
|
const merged = {
|
||||||
|
|
@ -797,8 +797,6 @@ for (let curve of this.curves) {
|
||||||
endPoint: curve.endPoint
|
endPoint: curve.endPoint
|
||||||
};
|
};
|
||||||
curves.splice(i - 1, 2, merged);
|
curves.splice(i - 1, 2, merged);
|
||||||
} else {
|
|
||||||
curves.splice(i, 1); // drop if it's the very first
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.curveSets[motorID] = curves;
|
this.curveSets[motorID] = curves;
|
||||||
|
|
@ -814,7 +812,7 @@ for (let curve of this.curves) {
|
||||||
curve.endPoint.y = yEditor;
|
curve.endPoint.y = yEditor;
|
||||||
if (curve.endPointHandle) curve.endPointHandle.y = yEditor;
|
if (curve.endPointHandle) curve.endPointHandle.y = yEditor;
|
||||||
} else {
|
} else {
|
||||||
// remove point by merging with next
|
// 🚫 don't allow deleting the very last control point
|
||||||
if (i < curves.length - 1) {
|
if (i < curves.length - 1) {
|
||||||
const next = curves[i + 1];
|
const next = curves[i + 1];
|
||||||
const merged = {
|
const merged = {
|
||||||
|
|
@ -824,8 +822,6 @@ for (let curve of this.curves) {
|
||||||
endPoint: next.endPoint
|
endPoint: next.endPoint
|
||||||
};
|
};
|
||||||
curves.splice(i, 2, merged);
|
curves.splice(i, 2, merged);
|
||||||
} else {
|
|
||||||
curves.splice(i, 1); // drop if it's the very last
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.curveSets[motorID] = curves;
|
this.curveSets[motorID] = curves;
|
||||||
|
|
@ -872,6 +868,7 @@ for (let curve of this.curves) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
adjustAllCurvesToDuration(newTime) {
|
adjustAllCurvesToDuration(newTime) {
|
||||||
for (const [motorID, curves] of Object.entries(this.curveSets)) {
|
for (const [motorID, curves] of Object.entries(this.curveSets)) {
|
||||||
if (!curves || curves.length === 0) continue;
|
if (!curves || curves.length === 0) continue;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export class SerialManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = [HEADER1, HEADER2, commandCode, lengthHigh, lengthLow, ...payload, checksum];
|
const message = [HEADER1, HEADER2, commandCode, lengthHigh, lengthLow, ...payload, checksum];
|
||||||
//console.log(new Uint8Array(message));
|
console.log(new Uint8Array(message));
|
||||||
await this.writer.write(new Uint8Array(message));
|
await this.writer.write(new Uint8Array(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue