(widget: &'a PlotWidget, id: ShapeId)
| 927 | self.camera.half_extents.x *= zoom_factor; |
| 928 | } |
| 929 | if zoom_y { |
| 930 | self.camera.half_extents.y *= zoom_factor; |
| 931 | } |
| 932 | |
| 933 | let cursor_render_after = self.camera.screen_to_render( |
| 934 | DVec2::new(self.cursor_position.x as f64, self.cursor_position.y as f64), |
| 935 | viewport, |
| 936 | ); |
| 937 | |
| 938 | // Only adjust the axes that were zoomed so the cursor stays anchored. |
| 939 | let render_delta = cursor_render_before - cursor_render_after; |
| 940 | if zoom_x { |
| 941 | self.camera.position.x += render_delta.x; |
| 942 | } |
| 943 | if zoom_y { |
no test coverage detected