Skip to content

Commit

Permalink
feat(board): disabled use-select for foreign-object-
Browse files Browse the repository at this point in the history
add touchmove listener for board
  • Loading branch information
pubuzhixing8 committed Jun 16, 2024
1 parent c1eac0c commit a505547
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/react-app/src/styles/core/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,9 @@
cursor: crosshair;
}

foreignObject[class^='foreign-object-'] {
user-select: none;
}

@include mixins.board-background-color();
}
11 changes: 11 additions & 0 deletions packages/react-board/src/hooks/use-board-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
initializeViewBox,
initializeViewportContainer,
isFromViewportChange,
isPreventTouchMove,
setIsFromViewportChange,
updateViewportByScrolling,
updateViewportOffset
Expand All @@ -29,6 +30,16 @@ const useBoardEvent = (
{ target: PlaitBoard.getViewportContainer(board) }
);

useEventListener(
'touchmove',
(event) => {
if (isPreventTouchMove(board)) {
event.preventDefault();
}
},
{ target: PlaitBoard.getViewportContainer(board), passive: false }
);

useEventListener(
'wheel',
(event) => {
Expand Down

0 comments on commit a505547

Please sign in to comment.