Skip to content

Commit 7b0f2e9

Browse files
committed
feat: add forceCenter parameter to scrollIntoView and bump version to 5.11.2
1 parent d10436f commit 7b0f2e9

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mind-elixir",
3-
"version": "5.11.1-beta.4",
3+
"version": "5.11.2",
44
"type": "module",
55
"description": "Mind elixir is a free open source mind map core.",
66
"keywords": [
@@ -103,4 +103,4 @@
103103
"vite": "^7.1.7",
104104
"vite-plugin-istanbul": "^7.2.0"
105105
}
106-
}
106+
}

src/interact.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ function collectData(instance: MindElixirInstance) {
1313
}
1414
}
1515

16-
export const scrollIntoView = function (this: MindElixirInstance, el: HTMLElement) {
16+
export const scrollIntoView = function (this: MindElixirInstance, el: HTMLElement, forceCenter = false) {
1717
// scrollIntoView needs to be implemented manually because native scrollIntoView behaves incorrectly after transform
1818
const container = this.container
1919
const rect = el.getBoundingClientRect()
2020
const containerRect = container.getBoundingClientRect()
2121
const isOutOfView =
22+
forceCenter ||
2223
rect.top > containerRect.bottom - 50 ||
2324
rect.bottom < containerRect.top + 50 ||
2425
rect.left > containerRect.right - 50 ||

0 commit comments

Comments
 (0)