-
Notifications
You must be signed in to change notification settings - Fork 31
feature(design): add scrolling while dragging #244
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
base: feature/design-layer-integration-final
Are you sure you want to change the base?
feature(design): add scrolling while dragging #244
Conversation
| () => ({ | ||
| isDesignMode: isDesignModeActive(), | ||
| isPreviewMode: isPreviewModeActive(), | ||
| isDesignMode: mode === 'design' || isDesignModeActive(), |
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.
This allows for us to set a mode programmatically when consumed. Useful if we want an alternative to the url parameter, for example, in storybook we can't control the url parameters. In Odyssey we won't provide a mode so this will default to the behavior it had before.
| ComponentPropertiesChanged: Domain.ComponentPropertiesChangedEvent; | ||
| MediaChangedEvent: Domain.MediaChangedEvent; | ||
| ClientWindowBoundsHoverOver: Domain.ClientWindowBoundsHoverOverEvent; | ||
| ClientWindowBoundsHoverOut: Domain.ClientWindowBoundsHoverOutEvent; |
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.
Did we find that we just don't need these?
| }): (query: { | ||
| x: number; | ||
| y: number; | ||
| filter?: (entry: NodeToTargetMapEntry) => boolean; |
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.
What does filter do? It's an optional parameter that users can pass into the function that gets returned by useComponentDiscovery? Where do we expect to use this?
| const node = nodeStack[i]; | ||
| const entry = nodeToTargetMap.get(node); | ||
|
|
||
| // We need a region id and direction for this to be a target. |
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.
Are we actually filtering on region id and direction here? Would they have to pass in a filter function that does that?
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.
Are we able to add any unit tests for this type of functionality or is this more of an integration test thing?
| const SCROLL_INTERVAL_IN_MS = 1000 / 60; // 60fps | ||
| // The multiplier applied to the scroll factor. | ||
| // The scroll factor is a value between 0 and 1 that determines how much to scroll. | ||
| // This value will be the maximum amount of pixels that will be scrolled in a singal frame. |
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.
| // This value will be the maximum amount of pixels that will be scrolled in a singal frame. | |
| // This value will be the maximum amount of pixels that will be scrolled in a single frame. |
| for (let i = 0; i < stack.length; i += 1) { | ||
| const entry = stack[i]; | ||
|
|
||
| // We need a region id and direction for this to be a target. |
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.
Should we just pass a filter function into discoverComponents instead of having this outer if check here?
| isDragging: true, | ||
| currentDropTarget: null, | ||
| pendingTargetCommit: false, | ||
| scrollDirection: computeScrollDirection(scrollFactorRef.current), |
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.
Would this just be 0 all the time?
| scrollDirection: computeScrollDirection(scrollFactorRef.current), | |
| scrollDirection: 0, |
Uh oh!
There was an error while loading. Please reload this page.