Polish BIM shared viewer controls

This commit is contained in:
CODEX
2026-06-22 23:05:15 +03:00
parent fcfa59ec98
commit f680d6bad2
12 changed files with 367 additions and 77 deletions
+15 -3
View File
@@ -2,7 +2,7 @@ import { createSliderControl } from "./controls/slider.js";
import { createColorControl } from "./controls/color.js";
const defaultSettings = {
themeVersion: "v6-comments-targets",
themeVersion: "v7-toolbar-hub-icon",
bgOuter: "#0f0f0f",
canvasTop: "#1c1c1c",
canvasBottom: "#1c1c1c",
@@ -25,8 +25,8 @@ const defaultSettings = {
toolbarBorder: "#292929",
toolbarOutline: "#292929",
toolbarMinSize: 25,
toolbarMaxSize: 56,
toolbarLensCount: 7,
toolbarMaxSize: 87,
toolbarLensCount: 5,
toolbarAutoHide: false,
modalBg: "#1c1c1c",
modalBgAlpha: 1,
@@ -72,6 +72,14 @@ const defaultSettings = {
const STORAGE_KEY = "bimdc-settings-v3";
const LEGACY_KEYS = ["bimdc-settings", "bimdc-settings-v2"];
const isSharedViewerPath = () => (
typeof window !== "undefined" &&
/^\/share\/[^/]+\/?$/.test(window.location.pathname || "")
);
const isReadonlySettingsContext = () => (
isSharedViewerPath() ||
(typeof document !== "undefined" && document.body?.dataset?.viewerMode === "guest")
);
const projectSettings = typeof window !== "undefined" && window.__BIMDC_THEME__
? { ...defaultSettings, ...window.__BIMDC_THEME__ }
: { ...defaultSettings };
@@ -278,6 +286,7 @@ const applySettings = (s) => {
};
const saveSettings = (s) => {
if (isReadonlySettingsContext()) return;
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(s));
} catch (e) {
@@ -286,6 +295,9 @@ const saveSettings = (s) => {
};
const loadSettings = () => {
if (isReadonlySettingsContext()) {
return { ...projectSettings };
}
try {
// purge legacy keys so старые палитры не мешали
LEGACY_KEYS.forEach((k) => localStorage.removeItem(k));
+2 -2
View File
@@ -1,7 +1,7 @@
const toolbarConfig = {
minSize: 25,
maxSize: 56,
lensCount: 7,
maxSize: 87,
lensCount: 5,
autoHide: false,
size: 25,
gap: 10,