Say why Duplicate did nothing.
It aborted on unresolved geometry, a failed 10-bar shift, or HTTP error with only a console.error.
This commit is contained in:
parent
a1567fe82a
commit
3626795e03
1 changed files with 9 additions and 3 deletions
|
|
@ -1104,11 +1104,17 @@ createApp({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function duplicateLine(line) {
|
async function duplicateLine(line) {
|
||||||
if (line.geometry_resolved === false) return;
|
if (line.geometry_resolved === false) {
|
||||||
|
addEvent(`DUPLICATE #${line.number} FAILED · no source geometry`, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const anchorT = shiftTimeByBars(line, line.anchor_t);
|
const anchorT = shiftTimeByBars(line, line.anchor_t);
|
||||||
const endT = shiftTimeByBars(line, line.last_t);
|
const endT = shiftTimeByBars(line, line.last_t);
|
||||||
const cutoffT = line.cutoff_t == null ? null : shiftTimeByBars(line, line.cutoff_t);
|
const cutoffT = line.cutoff_t == null ? null : shiftTimeByBars(line, line.cutoff_t);
|
||||||
if (anchorT == null || endT == null || (line.cutoff_t != null && cutoffT == null)) return;
|
if (anchorT == null || endT == null || (line.cutoff_t != null && cutoffT == null)) {
|
||||||
|
addEvent(`DUPLICATE #${line.number} FAILED · cannot shift 10 bars`, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const endP = line.anchor_p + line.slope * (line.last_t - line.anchor_t);
|
const endP = line.anchor_p + line.slope * (line.last_t - line.anchor_t);
|
||||||
const response = await apiFetch('/api/lines', {
|
const response = await apiFetch('/api/lines', {
|
||||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||||
|
|
@ -1123,7 +1129,7 @@ createApp({
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error(`Unable to duplicate line: HTTP ${response.status}`);
|
addEvent(`DUPLICATE #${line.number} FAILED · HTTP ${response.status}`, 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const saved = await response.json();
|
const saved = await response.json();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue