-
Notifications
You must be signed in to change notification settings - Fork 47
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
perf(region): Refactor creator to modify rect directly during draw #490
Conversation
76614cd
to
6350163
Compare
d25df48
to
093a74b
Compare
|
||
expect(instance.getPosition(100, 100)).toEqual([85, 85]); | ||
simulateDrawStart(wrapper); | ||
simulateDrawMove(50, 50); |
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.
Forgot expect
?
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.
Nope.
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.
Whoops, on second look it's just a dead test. I misread the diff even after your comment. Nice catch, will fix.
export function AutoScroller(props: Props, ref: React.Ref<Element>): JSX.Element { | ||
const { as: Element = 'div', children, enabled, intensity = 0.2, onScroll = noop, size = 50, ...rest } = props; | ||
export default function useAutoScroll(options: Options): void { | ||
const { enabled, intensity = 0.2, onScroll = noop, reference, size = 50 } = options; |
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.
Could we destructure them out in the function arguments above?
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 can, but it breaks the function declaration onto multiple lines in an unpleasant way.
regionRect.setAttribute('height', `${height}`); | ||
regionRect.setAttribute('width', `${width}`); | ||
regionRect.setAttribute('x', `${x}`); | ||
regionRect.setAttribute('y', `${y}`); | ||
regionDirtyRef.current = false; |
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.
🔥
Same thing as before, just 2-3x faster.
Todo