Skip to content

Commit f67a9a6

Browse files
committed
feat: improve pinch gesture ux
1 parent a71481a commit f67a9a6

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 5.9.1 - 2026-02-24
4+
5+
### Features
6+
7+
- Improve pinch gesture ux
8+
9+
### Refactors
10+
11+
- Remove top-level scope document to avoid immediate errors in SSR applications
12+
313
## 5.9.0 - 2026-02-21
414

515
### Features

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mind-elixir",
3-
"version": "5.9.0",
3+
"version": "5.9.1",
44
"type": "module",
55
"description": "Mind elixir is a free open source mind map core.",
66
"keywords": [

src/mouse.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -267,24 +267,14 @@ export default function (mind: MindElixirInstance) {
267267
if (lastDistance == null) {
268268
lastDistance = newDistance
269269
} else {
270-
const delta = newDistance - lastDistance
271-
const THRESHOLD = 8
272-
273-
if (Math.abs(delta) > THRESHOLD) {
274-
if (delta > 0) {
275-
handleZoom(mind, 'in', {
276-
x: (p1.x + p2.x) / 2,
277-
y: (p1.y + p2.y) / 2,
278-
})
279-
} else {
280-
handleZoom(mind, 'out', {
281-
x: (p1.x + p2.x) / 2,
282-
y: (p1.y + p2.y) / 2,
283-
})
284-
}
285-
286-
lastDistance = newDistance
270+
if (lastDistance > 0) {
271+
const scaleRatio = newDistance / lastDistance
272+
mind.scale(mind.scaleVal * scaleRatio, {
273+
x: (p1.x + p2.x) / 2,
274+
y: (p1.y + p2.y) / 2,
275+
})
287276
}
277+
lastDistance = newDistance
288278
}
289279
return
290280
}

0 commit comments

Comments
 (0)