-
Notifications
You must be signed in to change notification settings - Fork 48
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
✨ Add touch device detection for ERD selection behavior #690
Conversation
🦋 Changeset detectedLatest commit: 5f1e83d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
5bd0c26
to
5f1e83d
Compare
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, the experience was so much better!✨ I'm so happy! I checked with MOBILE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that the usability of mobile devices has improved!
User description
Background
Currently, selectionOnDrag is enabled in ReactFlow and a normal drag on the canvas will show a selection box.
This is a deliberate adjustment to provide a Figma-like experience.
ref: https://reactflow.dev/api-reference/react-flow#selection-on-drag
ref: https://reactflow.dev/learn/concepts/the-viewport#figma-like-viewport-controls
However, this does not allow for good panning and zooming on mobile (touch devices).
When opening Figma on a mobile device, when dragging, the canvas moves, so we want to match that.
Testing
Before
trim.354D5FBA-C3D7-4A83-B96B-B738618663EA.MOV
After
trim.600366B1-B6A0-4876-AC76-C651492FC1F7.MOV
Other Information
PR Type
Enhancement
Description
Added touch device detection utility to improve mobile experience.
Disabled
selectionOnDrag
for touch devices inERDContent
.Exported
isTouchDevice
utility for broader usage.Updated changeset to document the enhancement.
Changes walkthrough 📝
ERDContent.tsx
Adjusted `selectionOnDrag` for touch devices
frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/ERDContent.tsx
isTouchDevice
utility to conditionally disableselectionOnDrag
.index.ts
Added export for `isTouchDevice` utility
frontend/packages/erd-core/src/utils/index.ts
isTouchDevice
utility for external usage.isTouchDevice.ts
Added utility to detect touch devices
frontend/packages/erd-core/src/utils/isTouchDevice.ts
isTouchDevice
utility to detect touch devices.ontouchstart
ormaxTouchPoints
.real-hairs-reply.md
Added changeset for touch device enhancement
.changeset/real-hairs-reply.md
selectionOnDrag
for touch devices.