Fixed slider value not matching display value

This commit is contained in:
Lucas Dower 2022-05-15 15:44:48 +01:00
parent 4a62cd5e4c
commit 4d89696f5c
3 changed files with 6 additions and 2 deletions

View File

@ -154,7 +154,7 @@ export class AppContext {
const uiElements = this._ui.layout.build.elements; const uiElements = this._ui.layout.build.elements;
const voxelMeshParams: VoxelMeshParams = { const voxelMeshParams: VoxelMeshParams = {
desiredHeight: uiElements.height.getCachedValue() as number, desiredHeight: uiElements.height.getDisplayValue(),
useMultisampleColouring: uiElements.multisampleColouring.getCachedValue() === 'on', useMultisampleColouring: uiElements.multisampleColouring.getCachedValue() === 'on',
textureFiltering: uiElements.textureFiltering.getCachedValue() === 'linear' ? TextureFiltering.Linear : TextureFiltering.Nearest, textureFiltering: uiElements.textureFiltering.getCachedValue() === 'linear' ? TextureFiltering.Linear : TextureFiltering.Nearest,
enableAmbientOcclusion: uiElements.ambientOcclusion.getCachedValue() === 'on', enableAmbientOcclusion: uiElements.ambientOcclusion.getCachedValue() === 'on',

View File

@ -1,5 +1,5 @@
import { HashMap } from './hash_map'; import { HashMap } from './hash_map';
import { UV, RGB, ASSERT, fileExists, ColourSpace, ATLASES_DIR, PALETTES_DIR, AppError, LOG_WARN, LOG } from './util'; import { UV, RGB, ASSERT, fileExists, ColourSpace, ATLASES_DIR, PALETTES_DIR, AppError, LOG_WARN } from './util';
import { Vector3 } from './vector'; import { Vector3 } from './vector';
import fs from 'fs'; import fs from 'fs';

View File

@ -126,6 +126,10 @@ export class SliderElement extends LabelledElement<number> {
elementValue.innerHTML = this.getValue().toFixed(this._decimals); elementValue.innerHTML = this.getValue().toFixed(this._decimals);
} }
public getDisplayValue() {
return parseFloat(this.getValue().toFixed(this._decimals));
}
protected _onEnabledChanged() { protected _onEnabledChanged() {
super._onEnabledChanged(); super._onEnabledChanged();