-
Notifications
You must be signed in to change notification settings - Fork 158
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
feat: support dragging when space is being pressed #212
feat: support dragging when space is being pressed #212
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Do you have to set this flag to isMobileOnly will be false on every platform except mobile |
Ah yes, duh. That does make dragging work, but now there are other issues ha. For example:
These seems like controls or aspects of state that would need to come from pixi (??) and I'm not sure how to do them. Might have to leave this one until I can get help on it. |
Yeah, I think this will be a bit tricky.
Probably best to put on the back burner for now.
David
…On Fri, Feb 3, 2023 at 9:36 AM Jim Nielsen ***@***.***> wrote:
Ah yes, duh. That does make dragging work, but now there are other issues
ha. For example:
1. When you hold down spacebar and click to drag, the cell you click
to drag gets selected (which we would want to prevent).
2. Dragging outside the browser window changes from panning to
selecting. I would expect it to continue to be panning.
3. We would want to toggle the cursor when panning, e.g. when spacebar
gets pressed down we would want to change the cursor to grab and then
when we're dragging we would want to change it to grabbing.
These seems like controls or aspects of state that would need to come from
pixi (??) and I'm not sure how to do them. Might have to leave this one
until I can get help on it.
—
Reply to this email directly, view it on GitHub
<#212 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2RO7M33KDKFNXFKG55VW3WVUXZ3ANCNFSM6AAAAAAUPY444Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
src/gridGL/QuadraticGrid.tsx
Outdated
panMode: interactionState.panMode, | ||
interactionState, | ||
setInteractionState, | ||
}); |
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.
I'm not sure if this is the best way to write this?
It feels cleaner, but does it mean that the event handlers (which need access to state in this component) don't get to use a closure for access the values and it causes unnecessary regeneration of the event handlers themselves?
React hooks trip me up here. But it does seem to work. I like the encapsulated logic but unsure if it's not idiomatic react.
@jimniels drag no longer works on mobile |
1 similar comment
@jimniels drag no longer works on mobile |
@davidkircos ah good catch. I needed to conditionally pass in the spacebar key for dragging Should work now. |
When you are typing into a cell, space still activates drag mode. I think we just need to preventDefault on space here? |
@davidkircos good catch on the cell input. Should've caught that. It's fixed now and ready for review once more |
Mimic Figma in how you can pan around the canvas
keyToPress
for drag options Scroll Bars #135 (comment)react-device-detect
package. Device-specific flags for things like saving space (e.g.isMobile
) can be used where necessary. Otherwise, theisMobile
flag (which tests true for mobile and tablet) is used for theIS_READONLY_MODE
constant that controls when the app is in "readonly" mode.How it works:
Todos:
grab
grabbing
and allow panning