-
Notifications
You must be signed in to change notification settings - Fork 5
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
ui-spacetimechart: picking layer downscaling #938
base: dev
Are you sure you want to change the base?
Conversation
This commit fixes #915, and also improves picking performances, by downscaling the picking layer. Details: - Cleans unused and poorly named "number" argument from drawAliasedLine - Adds new get getPickingScalingRatio helper, that returns the picking downscaling ratio depending on the current devicePixelRatio value - Fixes picking layers resize handling - Adds a new optional "scalingRatio" argument to each canvas aliased drawing function - Adds new scalingRatio argument to PickingDrawingFunction, and updates useCanvas accordingly - Gives the scaling ratio from PickingDrawingFunction to aliased functions in every places where usePicking is called Signed-off-by: Alexis Jacomy <[email protected]>
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.
LGTM!
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.
LGTM ✅
Only left 1 small comment
// When devicePixelRatio is over 1 (like for Retina displays), we downscale based on the "HTML | ||
// pixels": | ||
if (dpr > 1) return PICKING_DOWNSCALING_RATIO; | ||
|
||
// When devicePixelRatio is under 1 (like when the user zooms out for instance), we downscale | ||
// based on the actual "screen pixels" (to avoid having a too large scene to fill): | ||
if (dpr < 1) return PICKING_DOWNSCALING_RATIO * dpr; | ||
|
||
return PICKING_DOWNSCALING_RATIO; |
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.
// When devicePixelRatio is over 1 (like for Retina displays), we downscale based on the "HTML | |
// pixels": | |
if (dpr > 1) return PICKING_DOWNSCALING_RATIO; | |
// When devicePixelRatio is under 1 (like when the user zooms out for instance), we downscale | |
// based on the actual "screen pixels" (to avoid having a too large scene to fill): | |
if (dpr < 1) return PICKING_DOWNSCALING_RATIO * dpr; | |
return PICKING_DOWNSCALING_RATIO; | |
// When devicePixelRatio is over 1 (like for Retina displays), we downscale based on the "HTML | |
// pixels": | |
if (dpr >= 1) return PICKING_DOWNSCALING_RATIO; | |
// When devicePixelRatio is under or equal to 1 (like when the user zooms out for instance), we downscale | |
// based on the actual "screen pixels" (to avoid having a too large scene to fill): | |
return PICKING_DOWNSCALING_RATIO * dpr; |
This commit fixes #915, and also improves picking performances, by downscaling the picking layer.
Details: