This commit is contained in:
1 parent
cd007ba431
commit
0d53bdaf9a
2 files changed
+54
-6
No files matched your search
+14
-4
@@ -364,11 +364,12 @@ function defaultProject() {
|
||||
};
|
||||
}
|
||||
|
||||
function compileOptions() {
|
||||
function compileOptions(extra = {}) {
|
||||
return {
|
||||
render_mode: state.renderMode,
|
||||
show_labels: state.showLabels,
|
||||
generic_symbols: true
|
||||
generic_symbols: true,
|
||||
...extra
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1807,12 +1808,21 @@ async function compileModel(model, opts = {}) {
|
||||
const source = opts.source ?? "manual";
|
||||
const fit = opts.fit ?? false;
|
||||
const keepView = opts.keepView ?? false;
|
||||
const preservePlacement = opts.preservePlacement ?? false;
|
||||
|
||||
setStatus(source === "drag" ? "Compiling after drag..." : "Compiling...");
|
||||
try {
|
||||
const result = await apiPost("/compile", {
|
||||
payload: model,
|
||||
options: compileOptions()
|
||||
options: compileOptions(
|
||||
preservePlacement
|
||||
? {
|
||||
preserve_placement: true,
|
||||
auto_rotate: false,
|
||||
respect_locks: true
|
||||
}
|
||||
: {}
|
||||
)
|
||||
});
|
||||
|
||||
state.model = applyCompileLayoutToModel(model, result);
|
||||
@@ -3316,7 +3326,7 @@ function setupEvents() {
|
||||
inst.placement.locked = true;
|
||||
}
|
||||
}
|
||||
await compileModel(state.model, { source: "drag", keepView: true });
|
||||
await compileModel(state.model, { source: "drag", keepView: true, preservePlacement: true });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user