Stabilize compile by preserving placements unless relayout requested
Some checks are pending
CI / test (push) Waiting to run
@ -133,7 +133,7 @@ export function App() {
|
|||||||
switch (action.id) {
|
switch (action.id) {
|
||||||
case "compile":
|
case "compile":
|
||||||
{
|
{
|
||||||
const result = await compile(payload);
|
const result = await compile(payload, { preserve_placement: true });
|
||||||
actionsApi.setCompileResult(result);
|
actionsApi.setCompileResult(result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -2404,9 +2404,9 @@ function layoutAndRouteNative(model, options = {}) {
|
|||||||
const renderMode = options.render_mode === "explicit" ? "explicit" : DEFAULT_RENDER_MODE;
|
const renderMode = options.render_mode === "explicit" ? "explicit" : DEFAULT_RENDER_MODE;
|
||||||
const respectLocks = options.respect_locks ?? true;
|
const respectLocks = options.respect_locks ?? true;
|
||||||
const autoRotate = options.auto_rotate ?? true;
|
const autoRotate = options.auto_rotate ?? true;
|
||||||
const preservePlacement = options.preserve_placement === true;
|
const preservePlacement = options.preserve_placement !== false;
|
||||||
const placed = preservePlacement
|
const placed = preservePlacement
|
||||||
? preservePlacedInstances(model, { respectLocks, autoRotate: false })
|
? preservePlacedInstances(model, { respectLocks, autoRotate })
|
||||||
: placeInstances(model, { respectLocks, autoRotate }).placed;
|
: placeInstances(model, { respectLocks, autoRotate }).placed;
|
||||||
const placedMap = new Map(placed.map((inst) => [inst.ref, inst]));
|
const placedMap = new Map(placed.map((inst) => [inst.ref, inst]));
|
||||||
const bounds = buildBounds(model, placed);
|
const bounds = buildBounds(model, placed);
|
||||||
|
|||||||
@ -339,7 +339,12 @@ export function createRequestHandler() {
|
|||||||
api_version: API_VERSION,
|
api_version: API_VERSION,
|
||||||
schema_version: SCHEMA_VERSION,
|
schema_version: SCHEMA_VERSION,
|
||||||
model: laidOut,
|
model: laidOut,
|
||||||
compile: withEnvelopeMeta(compile(laidOut, parsed.options))
|
compile: withEnvelopeMeta(
|
||||||
|
compile(laidOut, {
|
||||||
|
...(parsed.options ?? {}),
|
||||||
|
preserve_placement: true
|
||||||
|
})
|
||||||
|
)
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err?.code === "PAYLOAD_TOO_LARGE") {
|
if (err?.code === "PAYLOAD_TOO_LARGE") {
|
||||||
@ -372,7 +377,12 @@ export function createRequestHandler() {
|
|||||||
api_version: API_VERSION,
|
api_version: API_VERSION,
|
||||||
schema_version: SCHEMA_VERSION,
|
schema_version: SCHEMA_VERSION,
|
||||||
model: laidOut,
|
model: laidOut,
|
||||||
compile: withEnvelopeMeta(compile(laidOut, parsed.options))
|
compile: withEnvelopeMeta(
|
||||||
|
compile(laidOut, {
|
||||||
|
...(parsed.options ?? {}),
|
||||||
|
preserve_placement: true
|
||||||
|
})
|
||||||
|
)
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err?.code === "PAYLOAD_TOO_LARGE") {
|
if (err?.code === "PAYLOAD_TOO_LARGE") {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 278 KiB |
|
Before Width: | Height: | Size: 198 KiB After Width: | Height: | Size: 191 KiB |