From f955f58bc4a225a4796960e6eca1e6b45c4669db Mon Sep 17 00:00:00 2001 From: Bakhtiiar Muzakparov Date: Mon, 3 Feb 2020 01:48:41 +0000 Subject: [PATCH] Allow changing opacity with scroll wheel (#662) --- src/actions/actionProperties.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/actions/actionProperties.tsx b/src/actions/actionProperties.tsx index 69af2cd2..5b92e90f 100644 --- a/src/actions/actionProperties.tsx +++ b/src/actions/actionProperties.tsx @@ -220,6 +220,20 @@ export const actionChangeOpacity: Action = { max="100" step="10" onChange={e => updateData(+e.target.value)} + onWheel={e => { + e.stopPropagation(); + const target = e.target as HTMLInputElement; + const STEP = 10; + const MAX = 100; + const MIN = 0; + const value = +target.value; + + if (e.deltaY < 0 && value < MAX) { + updateData(value + STEP); + } else if (e.deltaY > 0 && value > MIN) { + updateData(value - STEP); + } + }} value={ getFormValue( appState.editingElement,