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
@@ -1,7 +1,7 @@
{ {
"name": "wow-best-places", "name": "wow-best-places",
"description": "This app is supposed to make you feel nostalgic", "description": "This app is supposed to make you feel nostalgic",
"version": "1.3.0", "version": "1.3.1",
"author": { "author": {
"name": "obergodmar", "name": "obergodmar",
"email": "obergodmar@gmail.com", "email": "obergodmar@gmail.com",
+1 -1
View File
@@ -148,7 +148,7 @@ export default function App() {
<MainMenuComponent> <MainMenuComponent>
<div className='author'> <div className='author'>
<a href="https://github.com/obergodmar">obergodmar</a> <a href="https://github.com/obergodmar">obergodmar</a>
<span>v1.3.0</span> <span>v1.3.1</span>
</div> </div>
<MenuItemComponent <MenuItemComponent
isActive={isSettingsShown} isActive={isSettingsShown}
@@ -96,7 +96,7 @@ export const PanelComponent = ({
} }
}, [isShown, resetPanel]) }, [isShown, resetPanel])
const handleDragScroll = (e: MouseEvent) => { const handleMouseMove = (e: MouseEvent) => {
if (!isDrag) { if (!isDrag) {
return return
} }
@@ -194,7 +194,7 @@ export const PanelComponent = ({
onTouchMove={handleTouchMove} onTouchMove={handleTouchMove}
onTouchEnd={handleFree} onTouchEnd={handleFree}
onMouseUp={handleFree} onMouseUp={handleFree}
onMouseMove={handleDragScroll} onMouseMove={handleMouseMove}
onMouseLeave={handleFree} onMouseLeave={handleFree}
onWheel={handleScroll} onWheel={handleScroll}
onBlur={handleFree} onBlur={handleFree}
@@ -82,8 +82,8 @@ export const ViewComponent = ({src}: Props) => {
const limiter = (value: Position, width: number, height: number) => { const limiter = (value: Position, width: number, height: number) => {
const {x: xValue, y: yValue} = value const {x: xValue, y: yValue} = value
let x = trackPosition.x - xValue + lastPosition.x let x = lastPosition.x - trackPosition.x + xValue
let y = trackPosition.y - yValue + lastPosition.y let y = lastPosition.y - trackPosition.y + yValue
if (x > 0) { if (x > 0) {
x = 0 x = 0
@@ -121,7 +121,7 @@ export const ViewComponent = ({src}: Props) => {
setLastPosition(position) setLastPosition(position)
} }
const handleDragScroll = (e: MouseEvent) => { const handleMouseMove = (e: MouseEvent) => {
if (!isDrag) { if (!isDrag) {
return return
} }
@@ -142,7 +142,7 @@ export const ViewComponent = ({src}: Props) => {
backgroundPosition: `${position.x}px ${position.y}px` backgroundPosition: `${position.x}px ${position.y}px`
}} }}
onMouseDown={handleMouseDown} onMouseDown={handleMouseDown}
onMouseMove={handleDragScroll} onMouseMove={handleMouseMove}
onMouseUp={handleFree} onMouseUp={handleFree}
onTouchMove={handleTouchMove} onTouchMove={handleTouchMove}
onTouchStart={handleTouchstart} onTouchStart={handleTouchstart}