Tune BIM zoom and modal layering
This commit is contained in:
+15
-2
@@ -381,10 +381,23 @@ const CAMERA_CONTROL_SETTINGS = {
|
||||
dollyProximityThreshold: 90,
|
||||
};
|
||||
|
||||
const ZOOM_SPEED_PERCENT_MIN = 5;
|
||||
const ZOOM_SPEED_PERCENT_MAX = 100;
|
||||
const ZOOM_DOLLY_RATE_MIN = 1;
|
||||
const ZOOM_DOLLY_RATE_MAX = 100;
|
||||
const ZOOM_DOLLY_RESPONSE_EXPONENT = 1.45;
|
||||
|
||||
const normalizeZoomSpeed = (value) => {
|
||||
const numeric = Number(value);
|
||||
if (!Number.isFinite(numeric)) return 20;
|
||||
return Math.min(100, Math.max(5, Math.round(numeric)));
|
||||
return Math.min(ZOOM_SPEED_PERCENT_MAX, Math.max(ZOOM_SPEED_PERCENT_MIN, Math.round(numeric)));
|
||||
};
|
||||
|
||||
const getZoomDollyRate = (value) => {
|
||||
const normalized = normalizeZoomSpeed(value);
|
||||
const range = ZOOM_SPEED_PERCENT_MAX - ZOOM_SPEED_PERCENT_MIN;
|
||||
const t = range > 0 ? (normalized - ZOOM_SPEED_PERCENT_MIN) / range : 0;
|
||||
return ZOOM_DOLLY_RATE_MIN + (Math.pow(t, ZOOM_DOLLY_RESPONSE_EXPONENT) * (ZOOM_DOLLY_RATE_MAX - ZOOM_DOLLY_RATE_MIN));
|
||||
};
|
||||
|
||||
const isHexColor = (value) => /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(String(value || "").trim());
|
||||
@@ -453,7 +466,7 @@ const configureCameraControl = () => {
|
||||
control.smartPivot = false;
|
||||
control.zoomOnMouseWheel = true;
|
||||
control.keyboardDollyRate = CAMERA_CONTROL_SETTINGS.keyboardDollyRate;
|
||||
control.mouseWheelDollyRate = activeZoomSpeed;
|
||||
control.mouseWheelDollyRate = getZoomDollyRate(activeZoomSpeed);
|
||||
control.dollyInertia = CAMERA_CONTROL_SETTINGS.dollyInertia;
|
||||
control.dollyMinSpeed = CAMERA_CONTROL_SETTINGS.dollyMinSpeed;
|
||||
control.dollyProximityThreshold = CAMERA_CONTROL_SETTINGS.dollyProximityThreshold;
|
||||
|
||||
Reference in New Issue
Block a user