From e2f601fbfd628400673d115a617d3996e0e7ba1b Mon Sep 17 00:00:00 2001 From: Lucas Dower Date: Mon, 4 Sep 2023 01:41:18 +0100 Subject: [PATCH] Added option to override maximum height constraint, closes #135, closes #114 --- loc/en_GB.ts | 1 + src/camera.ts | 2 +- src/config.ts | 3 ++- src/ui/layout.ts | 12 +++++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/loc/en_GB.ts b/loc/en_GB.ts index c11c8ac..01e68ca 100644 --- a/loc/en_GB.ts +++ b/loc/en_GB.ts @@ -15,6 +15,7 @@ export const en_GB = { heading: 'SETTINGS', components: { language: 'Language', + overrideHeight: 'Max height override', }, changing_language: 'Changing languages...', changed_language: 'Changed language', diff --git a/src/camera.ts b/src/camera.ts index cfd1315..1ed782d 100644 --- a/src/camera.ts +++ b/src/camera.ts @@ -51,7 +51,7 @@ export class ArcballCamera { this._target = new SmoothVectorVariable(new Vector3(0, 0, 0), AppConfig.Get.CAMERA_SMOOTHING); this._elevation.setClamp(0.001, Math.PI - 0.001); - this._distance.setClamp(1.0, 100.0); + this._distance.setClamp(AppConfig.Get.CAMERA_MINIMUM_DISTANCE, 100.0); } public init() { diff --git a/src/config.ts b/src/config.ts index 86879f6..8d0cbad 100644 --- a/src/config.ts +++ b/src/config.ts @@ -25,13 +25,14 @@ export class AppConfig { public readonly RENDER_TRIANGLE_THRESHOLD = 1_000_000; public readonly MAXIMUM_IMAGE_MEM_ALLOC = 2048; public readonly CAMERA_FOV_DEGREES = 30.0; + public readonly CAMERA_MINIMUM_DISTANCE = 0.125; public readonly CAMERA_DEFAULT_DISTANCE_UNITS = 4.0; public readonly CAMERA_DEFAULT_AZIMUTH_RADIANS = -1.0; public readonly CAMERA_DEFAULT_ELEVATION_RADIANS = 1.3; public readonly CAMERA_SENSITIVITY_ROTATION = 0.005; public readonly CAMERA_SENSITIVITY_ZOOM = 0.0025; public readonly CONSTRAINT_MINIMUM_HEIGHT = 3; - public readonly CONSTRAINT_MAXIMUM_HEIGHT = 380; + public CONSTRAINT_MAXIMUM_HEIGHT = 380; public readonly SMOOTHNESS_MAX = 3.0; public readonly CAMERA_SMOOTHING = 1.0; public readonly VIEWPORT_BACKGROUND_COLOUR: RGBA = { diff --git a/src/ui/layout.ts b/src/ui/layout.ts index cb0e93f..afbd8c5 100644 --- a/src/ui/layout.ts +++ b/src/ui/layout.ts @@ -90,8 +90,18 @@ export class UI { label: LOC('settings.heading'), components: { 'language': new ComboboxComponent(), // Handled in constructor + 'overrideHeight': new SliderComponent() + .setMin(16) + .setMax(10000) + .setDefaultValue(380) + .setDecimals(0) + .setStep(1) + .setLabel('settings.components.overrideHeight') + .addValueChangedListener((newValue) => { + AppConfig.Get.CONSTRAINT_MAXIMUM_HEIGHT = newValue; + }) }, - componentOrder: ['language'], + componentOrder: ['language', 'overrideHeight'], }, 'import': { id: 'import',