Skip to content

Commit

Permalink
Fix indicator default steps
Browse files Browse the repository at this point in the history
  • Loading branch information
miku448 committed Jan 7, 2025
1 parent a28fcc3 commit 32c9054
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ export default function IndicatorEditor({ indicator, onUpdate, onSave, onCancel,
const min = Number(indicator.min);
const max = Number(indicator.max);
const step = Number(indicator.step);
console.log('values');
console.log(min, max, step, indicator.step);
console.log('!isNan', !isNaN(min) && !isNaN(max) && !isNaN(step));
console.log('min < max', min < max);
console.log('step > 0', step > 0);
return !isNaN(min) && !isNaN(max) && (!indicator.inferred ? !isNaN(step) && step > 0 : true) && max > min;
}
case 4:
Expand Down Expand Up @@ -394,7 +399,7 @@ export default function IndicatorEditor({ indicator, onUpdate, onSave, onCancel,
</div>
<div className="IndicatorEditor__actions">
<Button theme="transparent" onClick={() => onCancel()}>
{i18n('discard_changes')}
{i18n('cancel')}
</Button>
<Button
theme="secondary"
Expand Down
3 changes: 2 additions & 1 deletion apps/interactor/src/state/slices/creationSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ export const getEmptyIndicator = (): NovelIndicator => {
description: '',
type: 'percentage',
color: '#4caf50',
initialValue: '',
initialValue: '1',
inferred: false,
editable: true,
hidden: false,
persistent: false,
min: 0,
max: 100,
step: 1,
};
};

Expand Down
2 changes: 1 addition & 1 deletion apps/novel-builder/src/modals/scene/SceneEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function SceneEditModal() {
values: [],
initialValue: '',
inferred: false,
step: 0,
step: 1,
min: 0,
max: 100,
hidden: false,
Expand Down

0 comments on commit 32c9054

Please sign in to comment.