Skip to content

Commit

Permalink
default no pointer evenst on matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ElyaConrad committed Apr 23, 2024
1 parent e4866a4 commit dab54d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 33 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.34",
"version": "0.0.35",
"type": "module",
"files": [
"package.json",
Expand Down
1 change: 1 addition & 0 deletions zoompinch-vue/src/components/Zoompinch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ defineExpose({
top: 0px;
position: absolute;
width: 100%;
pointer-events: none;
height: 100%;
> ::v-deep(*) {
width: 100%;
Expand Down
16 changes: 14 additions & 2 deletions zoompinch-vue/src/controllers/touch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,25 @@ export function useTouch({
};

const handleTouchstart = (event: TouchEvent) => {
const isWithinMatrix = (event.target as HTMLElement).closest('.matrix') !== null;
if (isWithinMatrix) {
return;
}

event.preventDefault();
touchStarts = freezeTouches(event.touches);
touchStartScale = scale.value;
touchStartTranslate = [translate.value[0], translate.value[1]];
touchStartRotate = rotate.value;

console.log('touchStarts', touchStarts);
//console.log('touchStarts', touchStarts);
};

const handleTouchmove = (event: TouchEvent) => {
const isWithinMatrix = (event.target as HTMLElement).closest('.matrix') !== null;
if (isWithinMatrix) {
return;
}
event.preventDefault(); // Prevent default touch behavior

if (touchStarts) {
Expand Down Expand Up @@ -187,7 +196,10 @@ export function useTouch({
}
};
const handleTouchend = (event: TouchEvent) => {
//event.preventDefault();
const isWithinMatrix = (event.target as HTMLElement).closest('.matrix') !== null;
if (isWithinMatrix) {
return;
}

if (event.touches.length === 0) {
touchStarts = null;
Expand Down
30 changes: 0 additions & 30 deletions zoompinch-vue/vite.config.ts.timestamp-1713099900691.mjs

This file was deleted.

0 comments on commit dab54d1

Please sign in to comment.