diff --git a/editor/src/messages/input_mapper/default_mapping.rs b/editor/src/messages/input_mapper/default_mapping.rs index 8237d45d97..cf4d070e27 100644 --- a/editor/src/messages/input_mapper/default_mapping.rs +++ b/editor/src/messages/input_mapper/default_mapping.rs @@ -39,9 +39,9 @@ pub fn default_mapping() -> Mapping { refresh_keys=[Control], action_dispatch=NavigationMessage::PointerMove { snap_angle: Control, wait_for_snap_angle_release: true, snap_zoom: Control, zoom_from_viewport: None }, ), - entry!(KeyDown(Lmb); action_dispatch=NavigationMessage::TransformFromMenuEnd { commit_key: Key::Lmb }), - entry!(KeyDown(Mmb); action_dispatch=NavigationMessage::TransformFromMenuEnd { commit_key: Key::Mmb }), - entry!(KeyDown(Rmb); action_dispatch=NavigationMessage::TransformFromMenuEnd { commit_key: Key::Rmb }), + entry!(KeyDown(Lmb); action_dispatch=NavigationMessage::TransformFromMenuEnd { commit_key: Key::Lmb }), + entry!(KeyDown(Mmb); action_dispatch=NavigationMessage::TransformFromMenuEnd { commit_key: Key::Mmb }), + entry!(KeyDown(Rmb); action_dispatch=NavigationMessage::TransformFromMenuEnd { commit_key: Key::Rmb }), // NORMAL PRIORITY: // // NodeGraphMessage diff --git a/editor/src/messages/layout/utility_types/widgets/input_widgets.rs b/editor/src/messages/layout/utility_types/widgets/input_widgets.rs index 504bbee261..788fdac627 100644 --- a/editor/src/messages/layout/utility_types/widgets/input_widgets.rs +++ b/editor/src/messages/layout/utility_types/widgets/input_widgets.rs @@ -193,7 +193,7 @@ pub struct NumberInput { // Number presentation #[serde(rename = "displayDecimalPlaces")] - #[derivative(Default(value = "3"))] + #[derivative(Default(value = "2"))] pub display_decimal_places: u32, pub unit: String, diff --git a/frontend/src/components/floating-menus/ColorPicker.svelte b/frontend/src/components/floating-menus/ColorPicker.svelte index 7a311ac220..c58c7a7148 100644 --- a/frontend/src/components/floating-menus/ColorPicker.svelte +++ b/frontend/src/components/floating-menus/ColorPicker.svelte @@ -379,6 +379,7 @@ rangeMax={100} unit="%" mode="Range" + displayDecimalPlaces={1} tooltip={`Scale from transparent (0%) to opaque (100%) for the color's alpha channel`} /> diff --git a/frontend/src/components/widgets/WidgetSpan.svelte b/frontend/src/components/widgets/WidgetSpan.svelte index c7800ed4b4..d5719cb425 100644 --- a/frontend/src/components/widgets/WidgetSpan.svelte +++ b/frontend/src/components/widgets/WidgetSpan.svelte @@ -93,7 +93,7 @@ {/if} {@const curvesInput = narrowWidgetProps(component.props, "CurveInput")} {#if curvesInput} - debouncer((value) => updateLayout(index, value), { debounceTime: 120 }).updateValue(detail)} /> + debouncer((value) => updateLayout(index, value), { debounceTime: 120 }).debounceUpdateValue(detail)} /> {/if} {@const dropdownInput = narrowWidgetProps(component.props, "DropdownInput")} {#if dropdownInput} @@ -127,7 +127,7 @@ {#if numberInput} debouncer((value) => updateLayout(index, value)).updateValue(detail)} + on:value={({ detail }) => debouncer((value) => updateLayout(index, value)).debounceUpdateValue(detail)} incrementCallbackIncrease={() => updateLayout(index, "Increment")} incrementCallbackDecrease={() => updateLayout(index, "Decrement")} sharpRightCorners={nextIsSuffix} diff --git a/frontend/src/components/widgets/inputs/FieldInput.svelte b/frontend/src/components/widgets/inputs/FieldInput.svelte index c48d050e65..aa4cf91358 100644 --- a/frontend/src/components/widgets/inputs/FieldInput.svelte +++ b/frontend/src/components/widgets/inputs/FieldInput.svelte @@ -5,12 +5,12 @@ import LayoutRow from "@graphite/components/layout/LayoutRow.svelte"; - // emits: ["update:value", "textFocused", "textChanged", "cancelTextChange"], + // emits: ["update:value", "textFocused", "textChanged", "textChangeCanceled"], const dispatch = createEventDispatcher<{ value: string; textFocused: undefined; textChanged: undefined; - cancelTextChange: undefined; + textChangeCanceled: undefined; }>(); let className = ""; @@ -27,6 +27,7 @@ export let tooltip: string | undefined = undefined; export let sharpRightCorners = false; export let placeholder: string | undefined = undefined; + export let hideContextMenu = false; let inputOrTextarea: HTMLInputElement | HTMLTextAreaElement | undefined; let id = `${Math.random()}`.substring(2); @@ -78,13 +79,15 @@ {spellcheck} {disabled} {placeholder} - bind:value={inputValue} bind:this={inputOrTextarea} + bind:value={inputValue} on:focus={() => dispatch("textFocused")} on:blur={() => dispatch("textChanged")} on:change={() => dispatch("textChanged")} on:keydown={(e) => e.key === "Enter" && dispatch("textChanged")} - on:keydown={(e) => e.key === "Escape" && dispatch("cancelTextChange")} + on:keydown={(e) => e.key === "Escape" && dispatch("textChangeCanceled")} + on:pointerdown + on:contextmenu={(e) => hideContextMenu && e.preventDefault()} data-input-element /> {:else} @@ -95,17 +98,19 @@ data-scrollable-y {spellcheck} {disabled} - bind:value={inputValue} bind:this={inputOrTextarea} + bind:value={inputValue} on:focus={() => dispatch("textFocused")} on:blur={() => dispatch("textChanged")} on:change={() => dispatch("textChanged")} on:keydown={(e) => (macKeyboardLayout ? e.metaKey : e.ctrlKey) && e.key === "Enter" && dispatch("textChanged")} - on:keydown={(e) => e.key === "Escape" && dispatch("cancelTextChange")} + on:keydown={(e) => e.key === "Escape" && dispatch("textChangeCanceled")} + on:pointerdown + on:contextmenu={(e) => hideContextMenu && e.preventDefault()} /> {/if} {#if label} - + {/if} diff --git a/frontend/src/components/widgets/inputs/NumberInput.svelte b/frontend/src/components/widgets/inputs/NumberInput.svelte index ad5f433c41..2a9990bd56 100644 --- a/frontend/src/components/widgets/inputs/NumberInput.svelte +++ b/frontend/src/components/widgets/inputs/NumberInput.svelte @@ -1,10 +1,15 @@ (text = detail)} on:textFocused={onTextFocused} on:textChanged={onTextChanged} - on:cancelTextChange={onCancelTextChange} + on:textChangeCanceled={onTextChangeCanceled} + on:pointerdown={onDragPointerDown} {label} {disabled} {tooltip} {sharpRightCorners} + {styles} + hideContextMenu={true} spellcheck={false} - styles={{ "min-width": minWidth > 0 ? `${minWidth}px` : undefined, "--progress-factor": (rangeSliderValueAsRendered - rangeMin) / (rangeMax - rangeMin) }} bind:this={self} > - {#if value !== undefined && mode === "Increment" && incrementBehavior !== "None"} -