({deltaX, deltaY, pointerType, shiftKey})
| 172 | state.setDragging(true); |
| 173 | }, |
| 174 | onMove({deltaX, deltaY, pointerType, shiftKey}) { |
| 175 | let { |
| 176 | incrementX, |
| 177 | decrementX, |
| 178 | incrementY, |
| 179 | decrementY, |
| 180 | xChannelPageStep, |
| 181 | xChannelStep, |
| 182 | yChannelPageStep, |
| 183 | yChannelStep, |
| 184 | getThumbPosition, |
| 185 | setColorFromPoint |
| 186 | } = state; |
| 187 | if (currentPosition.current == null) { |
| 188 | currentPosition.current = getThumbPosition(); |
| 189 | } |
| 190 | let {width, height} = containerRef.current?.getBoundingClientRect() || {width: 0, height: 0}; |
| 191 | let valueChanged = deltaX !== 0 || deltaY !== 0; |
| 192 | if (pointerType === 'keyboard') { |
| 193 | let deltaXValue = |
| 194 | shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep; |
| 195 | let deltaYValue = |
| 196 | shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep; |
| 197 | if ((deltaX > 0 && direction === 'ltr') || (deltaX < 0 && direction === 'rtl')) { |
| 198 | incrementX(deltaXValue); |
| 199 | } else if ((deltaX < 0 && direction === 'ltr') || (deltaX > 0 && direction === 'rtl')) { |
| 200 | decrementX(deltaXValue); |
| 201 | } else if (deltaY > 0) { |
| 202 | decrementY(deltaYValue); |
| 203 | } else if (deltaY < 0) { |
| 204 | incrementY(deltaYValue); |
| 205 | } |
| 206 | setValueChangedViaKeyboard(valueChanged); |
| 207 | // set the focused input based on which axis has the greater delta |
| 208 | // oxlint-disable-next-line react/react-compiler |
| 209 | focusedInput = valueChanged && Math.abs(deltaY) > Math.abs(deltaX) ? 'y' : 'x'; |
| 210 | setFocusedInput(focusedInput); |
| 211 | } else { |
| 212 | currentPosition.current.x += ((direction === 'rtl' ? -1 : 1) * deltaX) / width; |
| 213 | currentPosition.current.y += deltaY / height; |
| 214 | setColorFromPoint(currentPosition.current.x, currentPosition.current.y); |
| 215 | } |
| 216 | }, |
| 217 | onMoveEnd() { |
| 218 | isOnColorArea.current = false; |
| 219 | state.setDragging(false); |
nothing calls this directly
no test coverage detected