@womp/mesh-editor 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@ await open_edit_session({
|
|
|
23
23
|
});
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
Return `false` from `on_commit` when the host cancels its import dialog. The session
|
|
27
|
+
stays open with its edits and undo history. Rejected promises display an error
|
|
28
|
+
and also keep the session open for retry.
|
|
29
|
+
|
|
26
30
|
`root_class` scopes the semantic `--womp-mesh-editor-*` theme tokens documented
|
|
27
31
|
in `docs/ui-theming.md`. Omit it to retain the default appearance.
|
|
28
32
|
|
|
@@ -10,7 +10,7 @@ export interface OpenEditSessionOptions {
|
|
|
10
10
|
symmetry_enabled?: boolean;
|
|
11
11
|
symmetry_vertical?: boolean;
|
|
12
12
|
symmetry_horizontal?: boolean;
|
|
13
|
-
on_commit?: (result: EditSessionCommitResult) => void | Promise<void>;
|
|
13
|
+
on_commit?: (result: EditSessionCommitResult) => void | boolean | Promise<void | boolean>;
|
|
14
14
|
}
|
|
15
15
|
export type EditSessionCommitResult = {
|
|
16
16
|
action: "commit";
|
|
@@ -1440,7 +1440,13 @@ export async function open_edit_session(options) {
|
|
|
1440
1440
|
mode: "edit",
|
|
1441
1441
|
mesh: await editor.prepare_commit_async(),
|
|
1442
1442
|
};
|
|
1443
|
-
await options.on_commit?.(result);
|
|
1443
|
+
const accepted = await options.on_commit?.(result);
|
|
1444
|
+
if (accepted === false) {
|
|
1445
|
+
set_status("Mesh editing", "Mesh tools are ready.", "idle");
|
|
1446
|
+
set_busy(false);
|
|
1447
|
+
commitButton.focus();
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1444
1450
|
editor.accept_commit();
|
|
1445
1451
|
close(result);
|
|
1446
1452
|
}
|