Fix: move validation error to validateLayer, make only a warning

This commit is contained in:
Pieter Vander Vennet 2025-05-02 23:46:49 +02:00
parent 79d43aef40
commit 75e8f40645
2 changed files with 7 additions and 3 deletions

View file

@ -878,6 +878,13 @@ export class ValidateLayer extends Conversion<
)
}
if (typeof json.allowMove === "object") {
if (!(json.allowMove.enableRelocation || json.allowMove.enableImproveAccuracy)) {
context.warn("MoveConfig: At least one default move reason should be allowed (at " + context + "); both 'enableImproveAccuracy and enableRelocation are falsy. If you don't want to allow moving points, set `allowMove: false` instead. Full config is: " + JSON.stringify(json.allowMove))
}
}
return { raw: json, parsed: layerConfig }
}
}

View file

@ -7,8 +7,5 @@ export default class MoveConfig {
constructor(json: MoveConfigJson, context: string) {
this.enableImproveAccuracy = json.enableImproveAccuracy ?? true
this.enableRelocation = json.enableRelocation ?? true
if (!(this.enableRelocation || this.enableImproveAccuracy)) {
throw "At least one default move reason should be allowed (at " + context + ")"
}
}
}