Incorrect translation in canvas component
bug 😔
The canvas component does a translation of `visible_area().min()` to place the drawn elements relative to the component position, however it does this after the canvas has been scaled with the scale factor, which means for scale factors != 1.0 the translation is incorrect. The translation amount should also take into account the scale factor, or happen before the scaling does.
https://github.com/marc2332/freya/blob/cde94c1c2fac10e3da206f930c30c5a9d10ca079/crates/freya-components/src/canvas.rs#L151-L154
Also it might be helpful if `examples/feature_canvas.rs` made it clear that the drawing being done will be scaled after being drawn, for example by doing something such as:
`let area = context.layout_node.visible_area() / ctx.scale_factor as f32;`
in place of:
https://github.com/marc2332/freya/blob/cde94c1c2fac10e3da206f930c30c5a9d10ca079/examples/feature_canvas.rs#L16-L18
0 条评论