Refine BIM toolbar dock magnification
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
const toolbarConfig = {
|
||||
minSize: 25,
|
||||
maxSize: 56,
|
||||
lensCount: 7,
|
||||
autoHide: false,
|
||||
size: 25,
|
||||
gap: 10,
|
||||
radius: 7,
|
||||
@@ -7,9 +11,22 @@ const toolbarConfig = {
|
||||
iconSize: 13,
|
||||
};
|
||||
|
||||
const applyToolbarVars = () => {
|
||||
const numericSetting = (settings, key, fallback) => {
|
||||
const value = Number(settings?.[key]);
|
||||
return Number.isFinite(value) ? value : fallback;
|
||||
};
|
||||
|
||||
const applyToolbarVars = (settings = {}) => {
|
||||
const root = document.documentElement;
|
||||
root.style.setProperty("--tb-size", `${toolbarConfig.size}px`);
|
||||
const minSize = numericSetting(settings, "toolbarMinSize", toolbarConfig.minSize);
|
||||
const maxSize = Math.max(minSize, numericSetting(settings, "toolbarMaxSize", toolbarConfig.maxSize));
|
||||
const lensCount = Math.max(1, Math.round(numericSetting(settings, "toolbarLensCount", toolbarConfig.lensCount)));
|
||||
const autoHide = settings?.toolbarAutoHide ?? toolbarConfig.autoHide;
|
||||
root.style.setProperty("--tb-size", `${minSize}px`);
|
||||
root.style.setProperty("--tb-min-size", `${minSize}px`);
|
||||
root.style.setProperty("--tb-max-size", `${maxSize}px`);
|
||||
root.style.setProperty("--tb-lens-count", `${lensCount}`);
|
||||
root.style.setProperty("--tb-autohide", autoHide ? "1" : "0");
|
||||
root.style.setProperty("--tb-gap", `${toolbarConfig.gap}px`);
|
||||
root.style.setProperty("--tb-radius", `${toolbarConfig.radius}px`);
|
||||
root.style.setProperty("--tb-pad-y", `${toolbarConfig.paddingY}px`);
|
||||
|
||||
Reference in New Issue
Block a user