Skip to content

Commit

Permalink
Always allow direction input within ValueSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaltby committed Apr 10, 2024
1 parent 9485de3 commit 7679a9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
35 changes: 14 additions & 21 deletions src/components/forms/ValueSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ interface ValueSelectProps {
onChange: (newValue: ScriptValue | undefined) => void;
innerValue?: boolean;
fixedType?: boolean;
includeDirection?: boolean;
placeholder?: string;
min?: number;
max?: number;
Expand All @@ -228,7 +227,6 @@ const ValueSelect = ({
onChange,
innerValue,
fixedType,
includeDirection,
placeholder,
min,
max,
Expand Down Expand Up @@ -374,24 +372,6 @@ const ValueSelect = ({

const menu = useMemo(
() => [
...(includeDirection && !isValueFn
? [
<MenuItem
key="direction"
onClick={() => {
onChange({
type: "direction",
value: "left",
});
}}
>
<MenuItemIcon>
{value.type === "direction" ? <CheckIcon /> : <BlankIcon />}
</MenuItemIcon>
{l10n("FIELD_DIRECTION")}
</MenuItem>,
]
: []),
...(!isValueFn
? [
<MenuItem key="number" onClick={setNumber}>
Expand Down Expand Up @@ -440,6 +420,20 @@ const ValueSelect = ({
</MenuItemIcon>
{l10n("FIELD_EXPRESSION")}
</MenuItem>,
<MenuItem
key="direction"
onClick={() => {
onChange({
type: "direction",
value: "left",
});
}}
>
<MenuItemIcon>
{value.type === "direction" ? <CheckIcon /> : <BlankIcon />}
</MenuItemIcon>
{l10n("FIELD_DIRECTION")}
</MenuItem>,
<MenuDivider key="divider" />,
]
: []),
Expand Down Expand Up @@ -495,7 +489,6 @@ const ValueSelect = ({
[
context.type,
editorType,
includeDirection,
isValueFn,
onChange,
setNumber,
Expand Down
3 changes: 0 additions & 3 deletions src/components/script/ScriptEventFormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,6 @@ const ScriptEventFormInput = ({
isValueScript ? value : isDefaultScript ? defaultValue : undefined
}
onChange={onChangeField}
includeDirection={
isDefaultScript ? defaultValue.type === "direction" : false
}
min={field.min}
max={field.max}
step={field.step}
Expand Down

0 comments on commit 7679a9b

Please sign in to comment.