Skip to content

Commit

Permalink
Fix NumberField stepping
Browse files Browse the repository at this point in the history
  • Loading branch information
triwav committed Sep 5, 2023
1 parent beef781 commit bd1e921
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions webviews/src/shared/NumberField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
function onInputChange() {
value = self.control.value;
// Triggers update to be sent to parent's on:input
dispatch('input', {test: self.control});
dispatch('input');
}
export let value = '';
Expand All @@ -26,11 +26,10 @@
}
export let title = '';
export let step = 10;
export let step = '1';
$: {
// TODO needs to be looked into fixing
if (self) {
self.control.step = step.toString();
self.control.step = step;
}
}
Expand Down
10 changes: 5 additions & 5 deletions webviews/src/views/SceneGraphInspectorView/NodeDetailPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
inspectNodeBaseKeyPath = null;
}
let numberInputsStep = 1;
let numberInputsStep = '1';
let fields = {} as {
[key: string]: {
Expand Down Expand Up @@ -217,7 +217,7 @@
close();
break;
case 'Shift':
numberInputsStep = 15;
numberInputsStep = '15';
break;
}
}
Expand All @@ -226,7 +226,7 @@
const key = event.key;
switch (key) {
case 'Shift':
numberInputsStep = 1;
numberInputsStep = '1';
break;
}
}
Expand Down Expand Up @@ -479,15 +479,15 @@
{id}
class="xValue fieldValue"
title="Hold down shift to increment faster"
step={id === 'scale' ? 0.1 : numberInputsStep}
step={id === 'scale' ? '0.1' : numberInputsStep}
value={field.value[0]}
on:input={onVector2dFieldChange} />
<NumberField
{id}
class="yValue fieldValue"
value={field.value[1]}
title="Hold down shift to increment faster"
step={id === 'scale' ? 0.1 : numberInputsStep}
step={id === 'scale' ? '0.1' : numberInputsStep}
on:input={onVector2dFieldChange} />
{#if id !== 'scale'}
<vscode-button
Expand Down

0 comments on commit bd1e921

Please sign in to comment.