diff --git a/playground/package-lock.json b/playground/package-lock.json
index bc269b5..fe7c871 100644
--- a/playground/package-lock.json
+++ b/playground/package-lock.json
@@ -11,7 +11,7 @@
"@vicons/ionicons5": "^0.12.0",
"naive-ui": "^2.38.1",
"vue": "^3.2.37",
- "zoompinch": "^0.0.5"
+ "zoompinch": "^0.0.7"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.1.0",
@@ -1407,9 +1407,9 @@
"dev": true
},
"node_modules/zoompinch": {
- "version": "0.0.5",
- "resolved": "https://registry.npmjs.org/zoompinch/-/zoompinch-0.0.5.tgz",
- "integrity": "sha512-1MHcGtWB3tBqRuY3iPFaF+FwXbXsreCXbT40kFhGev+G9YO8pmmpicZ4ls7vx7s+7S+N9s7cIoG4ssL1IE3dRg==",
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/zoompinch/-/zoompinch-0.0.7.tgz",
+ "integrity": "sha512-Ch9Hy1ePGfg1GqS8vZDbFj9mFXkyOlixqM6a5y5XWe8vMFTGXsK5d1Zvc5ZpUUnLelE0jr8eyvkMcl8s7czPvQ==",
"dependencies": {
"@vueuse/core": "^10.9.0"
},
@@ -2314,9 +2314,9 @@
"dev": true
},
"zoompinch": {
- "version": "0.0.5",
- "resolved": "https://registry.npmjs.org/zoompinch/-/zoompinch-0.0.5.tgz",
- "integrity": "sha512-1MHcGtWB3tBqRuY3iPFaF+FwXbXsreCXbT40kFhGev+G9YO8pmmpicZ4ls7vx7s+7S+N9s7cIoG4ssL1IE3dRg==",
+ "version": "0.0.7",
+ "resolved": "https://registry.npmjs.org/zoompinch/-/zoompinch-0.0.7.tgz",
+ "integrity": "sha512-Ch9Hy1ePGfg1GqS8vZDbFj9mFXkyOlixqM6a5y5XWe8vMFTGXsK5d1Zvc5ZpUUnLelE0jr8eyvkMcl8s7czPvQ==",
"requires": {
"@vueuse/core": "^10.9.0"
}
diff --git a/playground/package.json b/playground/package.json
index 8af67ec..9b6ca6c 100644
--- a/playground/package.json
+++ b/playground/package.json
@@ -12,7 +12,7 @@
"@vicons/ionicons5": "^0.12.0",
"naive-ui": "^2.38.1",
"vue": "^3.2.37",
- "zoompinch": "^0.0.5"
+ "zoompinch": "^0.0.7"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.1.0",
diff --git a/playground/src/components/Playground.vue b/playground/src/components/Playground.vue
index 5ccbeb0..ec323b7 100644
--- a/playground/src/components/Playground.vue
+++ b/playground/src/components/Playground.vue
@@ -132,7 +132,7 @@
:mouse="mouseEvents"
:touch="touchEvents"
:wheel="wheelEvents"
- :gesture="false"
+ :gesture="gestureEvents"
>
-
@@ -156,6 +156,8 @@ import 'zoompinch/style.css';
import { reactive, ref, watch, watchEffect } from 'vue';
import { NInputNumber, NSwitch, NButton } from 'naive-ui';
+// Flicker bug reproducable: 100,0,0.1,180
+
const rotation = ref(true);
const bounds = ref(false);
watch(bounds, (newValue) => {
@@ -173,7 +175,8 @@ const zoompinchRef = ref>();
const offset = reactive({ top: 10, right: 10, bottom: 10, left: 10 });
(window as any).offset = offset;
-const transform = ref({ x: 0, y: 0, scale: 1, rotate: 0 });
+//const transform = ref({ x: 0, y: 0, scale: 1, rotate: 0 });
+const transform = ref({ x: 100, y: 0, scale: 0.1, rotate: 180 }); // Flicker bug reproducable: 100,0,0.1,180
(window as any).transform = transform;
const updateTransform = (newTransform: Partial) => {
transform.value = { ...transform.value, ...newTransform };
@@ -238,9 +241,9 @@ function handleClickOnLayer(event: MouseEvent) {
gap: 10px;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
- // @media screen and (max-width: 700px) {
- // grid-template-columns: repeat(auto-fill, minmax(1fr, ));
- // }
+ @media screen and (max-width: 700px) {
+ grid-template-columns: repeat(4, 1fr);
+ }
&.small {
grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
@@ -250,6 +253,15 @@ function handleClickOnLayer(event: MouseEvent) {
font-size: 0.9em;
opacity: 0.7;
}
+ .n-input-number {
+ ::v-deep(.n-input__suffix) {
+ .n-button {
+ @media screen and (max-width: 700px) {
+ display: none;
+ }
+ }
+ }
+ }
}
}
.zoompinch {
diff --git a/zoompinch-lit/package.json b/zoompinch-lit/package.json
index 4ea76eb..478deaf 100644
--- a/zoompinch-lit/package.json
+++ b/zoompinch-lit/package.json
@@ -17,7 +17,8 @@
"build": "tsc && vite build"
},
"dependencies": {
- "lit": "^2.3.1"
+ "lit": "^2.3.1",
+ "zoompinch": "^0.0.12"
},
"devDependencies": {
"rollup-plugin-scss-lit": "^1.1.6",
diff --git a/zoompinch-lit/src/components/PanCake.ts b/zoompinch-lit/src/components/PanCake.ts
index 6d158fb..b54d63d 100644
--- a/zoompinch-lit/src/components/PanCake.ts
+++ b/zoompinch-lit/src/components/PanCake.ts
@@ -334,7 +334,7 @@ export class PanCake extends LitElement {
const innerCanvasRel = this.touchStarts[0].canvasRel;
// Project the scale
- const [scaleDeltaX, scaleDeltaY] = this.calcProjectionTranslate(futureScale, innerWrapperRelPos, innerCanvasRel);
+ const [scaleDeltaX, scaleDeltaY] = this.calcProjectionTranslate(futureScale, innerWrapperRelPos, innerCanvasRel, 0);
let rotationDeltaX = 0;
let rotationDeltaY = 0;
diff --git a/zoompinch-vue/package.json b/zoompinch-vue/package.json
index f359fc1..dfcf769 100644
--- a/zoompinch-vue/package.json
+++ b/zoompinch-vue/package.json
@@ -1,7 +1,7 @@
{
"name": "zoompinch",
"private": false,
- "version": "0.0.12",
+ "version": "0.0.13",
"type": "module",
"files": [
"package.json",
diff --git a/zoompinch-vue/src/components/Zoompinch.vue b/zoompinch-vue/src/components/Zoompinch.vue
index 7429900..2ffcc08 100644
--- a/zoompinch-vue/src/components/Zoompinch.vue
+++ b/zoompinch-vue/src/components/Zoompinch.vue
@@ -209,19 +209,25 @@ const mouseupProxy = (event: MouseEvent) => {
handleMouseup(event);
}
};
+function isTouchDevice() {
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
+}
+const gestureEnabled = computed(() => {
+ return !isTouchDevice() && props.gesture;
+});
const gesturestartProxy = (event: any) => {
- if (props.gesture) {
+ if (gestureEnabled.value) {
handleGesturestart(event);
}
};
const gesturechangeProxy = (event: any) => {
- if (props.gesture) {
+ if (gestureEnabled.value) {
handleGesturechange(event);
}
};
const gestureendProxy = (event: any) => {
- if (props.gesture) {
+ if (gestureEnabled.value) {
handleGestureend(event);
}
};
diff --git a/zoompinch-vue/src/controllers/touch.ts b/zoompinch-vue/src/controllers/touch.ts
index 2bce27e..50b58d8 100644
--- a/zoompinch-vue/src/controllers/touch.ts
+++ b/zoompinch-vue/src/controllers/touch.ts
@@ -179,7 +179,7 @@ export function useTouch({
}
};
const handleTouchend = (event: TouchEvent) => {
- event.preventDefault();
+ //event.preventDefault();
if (event.touches.length === 0) {
touchStarts = null;