Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added touch events support #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
}

.tree-container {
touch-action: none;
position: relative;
overflow: hidden;

Expand Down
6 changes: 3 additions & 3 deletions packages/tree-chart-core/src/tree-chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,13 @@ export default class TreeChartCore {
let isDrag = false;
// 保存鼠标点下时的位移
let mouseDownTransform = "";
this.treeContainer.onmousedown = (event) => {
this.treeContainer.onpointerdown = (event) => {
mouseDownTransform = this.svgElement.style.transform;
startX = event.clientX;
startY = event.clientY;
isDrag = true;
};
this.treeContainer.onmousemove = (event) => {
this.treeContainer.onpointermove = (event) => {
if (!isDrag) return;
const originTransform = mouseDownTransform;
let originOffsetX = 0;
Expand Down Expand Up @@ -344,7 +344,7 @@ export default class TreeChartCore {
this.domElement.style.transform = transformStr;
};

this.treeContainer.onmouseup = () => {
this.treeContainer.onpointerup = () => {
startX = 0;
startY = 0;
isDrag = false;
Expand Down
1 change: 1 addition & 0 deletions packages/vue-tree-chart/src/vue-tree/VueTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export default {
}

.tree-container {
touch-action: none;
position: relative;
overflow: hidden;

Expand Down
1 change: 1 addition & 0 deletions packages/vue3-tree-chart/src/vue-tree/VueTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export default {
}

.tree-container {
touch-action: none;
position: relative;
overflow: hidden;

Expand Down