Skip to content

Commit

Permalink
corrects sign of deltaX and deltaY
Browse files Browse the repository at this point in the history
  • Loading branch information
ElyaConrad committed Apr 19, 2024
1 parent cc3e5f0 commit 3adf92a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion zoompinch-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zoompinch",
"private": false,
"version": "0.0.30",
"version": "0.0.31",
"type": "module",
"files": [
"package.json",
Expand Down
6 changes: 3 additions & 3 deletions zoompinch-vue/src/controllers/wheel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function isMultipleOf(n: number, multiples: number[]) {
if (factor) {
return n / factor;
} else {
return n;
return 1;
}
}

Expand Down Expand Up @@ -49,10 +49,10 @@ export function useWheel({
if (Math.abs(deltaX)) {
}
if (isMultipleOf(deltaX, mouseMultiples)) {
deltaX = deltaX / ((100 / mouseFactor) * isMultipleOf(deltaX, mouseMultiples));
deltaX = (deltaX / ((100 / mouseFactor) * isMultipleOf(deltaX, mouseMultiples))) * Math.sign(deltaX);
}
if (isMultipleOf(deltaY, mouseMultiples)) {
deltaY = deltaY / ((100 / mouseFactor) * isMultipleOf(deltaY, mouseMultiples));
deltaY = (deltaY / ((100 / mouseFactor) * isMultipleOf(deltaY, mouseMultiples))) * Math.sign(deltaY);
}
const currScale = scale.value;
if (ctrlKey) {
Expand Down

0 comments on commit 3adf92a

Please sign in to comment.