Invert scroll direction by X and Y

This commit is contained in:
obergodmar
2020-07-13 11:20:39 +03:00
parent d3cc79fac5
commit 926d39ef97
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -148,7 +148,7 @@ export default function App() {
<MainMenuComponent>
<div className='author'>
<a href="https://github.com/obergodmar">obergodmar</a>
<span>v1.3.0</span>
<span>v1.3.1</span>
</div>
<MenuItemComponent
isActive={isSettingsShown}
@@ -96,7 +96,7 @@ export const PanelComponent = ({
}
}, [isShown, resetPanel])
const handleDragScroll = (e: MouseEvent) => {
const handleMouseMove = (e: MouseEvent) => {
if (!isDrag) {
return
}
@@ -194,7 +194,7 @@ export const PanelComponent = ({
onTouchMove={handleTouchMove}
onTouchEnd={handleFree}
onMouseUp={handleFree}
onMouseMove={handleDragScroll}
onMouseMove={handleMouseMove}
onMouseLeave={handleFree}
onWheel={handleScroll}
onBlur={handleFree}
@@ -82,8 +82,8 @@ export const ViewComponent = ({src}: Props) => {
const limiter = (value: Position, width: number, height: number) => {
const {x: xValue, y: yValue} = value
let x = trackPosition.x - xValue + lastPosition.x
let y = trackPosition.y - yValue + lastPosition.y
let x = lastPosition.x - trackPosition.x + xValue
let y = lastPosition.y - trackPosition.y + yValue
if (x > 0) {
x = 0
@@ -121,7 +121,7 @@ export const ViewComponent = ({src}: Props) => {
setLastPosition(position)
}
const handleDragScroll = (e: MouseEvent) => {
const handleMouseMove = (e: MouseEvent) => {
if (!isDrag) {
return
}
@@ -142,7 +142,7 @@ export const ViewComponent = ({src}: Props) => {
backgroundPosition: `${position.x}px ${position.y}px`
}}
onMouseDown={handleMouseDown}
onMouseMove={handleDragScroll}
onMouseMove={handleMouseMove}
onMouseUp={handleFree}
onTouchMove={handleTouchMove}
onTouchStart={handleTouchstart}