From 12edbd1296a06ae13410e376f272a04101ad7f5c Mon Sep 17 00:00:00 2001 From: Eddie Groshev Date: Sun, 12 Feb 2023 18:28:26 -0800 Subject: [PATCH 1/3] fix RectangleZoom selection vertices --- src/makielayout/interactions.jl | 9 +++++---- src/makielayout/types.jl | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/makielayout/interactions.jl b/src/makielayout/interactions.jl index 537f114a552..fb6b6bae973 100644 --- a/src/makielayout/interactions.jl +++ b/src/makielayout/interactions.jl @@ -122,11 +122,12 @@ function _chosen_limits(rz, ax) return r end -function _selection_vertices(ax_scene, outer, inner) +function _selection_vertices(ax, outer, inner) _clamp(p, plow, phigh) = Point2f(clamp(p[1], plow[1], phigh[1]), clamp(p[2], plow[2], phigh[2])) - proj(point) = project(ax_scene, point) .+ minimum(ax_scene.px_area[]) - outer = positivize(outer) - inner = positivize(inner) + proj(point) = project(ax.scene, point) .+ minimum(ax.scene.px_area[]) + transf = Makie.transform_func(ax) + outer = positivize(Makie.apply_transform(transf, outer)) + inner = positivize(Makie.apply_transform(transf, inner)) obl = bottomleft(outer) obr = bottomright(outer) diff --git a/src/makielayout/types.jl b/src/makielayout/types.jl index c1ad22fd175..c1e829efb5a 100644 --- a/src/makielayout/types.jl +++ b/src/makielayout/types.jl @@ -468,7 +468,7 @@ end function RectangleZoom(f::Function, ax::Axis; kw...) r = RectangleZoom(f; kw...) - selection_vertices = lift(_selection_vertices, Observable(ax.scene), ax.finallimits, r.rectnode) + selection_vertices = lift(_selection_vertices, Observable(ax), ax.finallimits, r.rectnode) # manually specify correct faces for a rectangle with a rectangle hole inside faces = [1 2 5; 5 2 6; 2 3 6; 6 3 7; 3 4 7; 7 4 8; 4 1 8; 8 1 5] # plot to blockscene, so ax.scene stays exclusive for user plots From 19b0853671a7248d24868d5ddf5045775dd8cbab Mon Sep 17 00:00:00 2001 From: Eddie Groshev Date: Sun, 12 Feb 2023 22:19:58 -0800 Subject: [PATCH 2/3] address PR comments --- src/makielayout/interactions.jl | 6 +++--- src/makielayout/types.jl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/makielayout/interactions.jl b/src/makielayout/interactions.jl index fb6b6bae973..a9b79c8181a 100644 --- a/src/makielayout/interactions.jl +++ b/src/makielayout/interactions.jl @@ -122,10 +122,10 @@ function _chosen_limits(rz, ax) return r end -function _selection_vertices(ax, outer, inner) +function _selection_vertices(ax_scene, outer, inner) _clamp(p, plow, phigh) = Point2f(clamp(p[1], plow[1], phigh[1]), clamp(p[2], plow[2], phigh[2])) - proj(point) = project(ax.scene, point) .+ minimum(ax.scene.px_area[]) - transf = Makie.transform_func(ax) + proj(point) = project(ax_scene, point) .+ minimum(ax_scene.px_area[]) + transf = Makie.transform_func(ax_scene) outer = positivize(Makie.apply_transform(transf, outer)) inner = positivize(Makie.apply_transform(transf, inner)) diff --git a/src/makielayout/types.jl b/src/makielayout/types.jl index c1e829efb5a..c1ad22fd175 100644 --- a/src/makielayout/types.jl +++ b/src/makielayout/types.jl @@ -468,7 +468,7 @@ end function RectangleZoom(f::Function, ax::Axis; kw...) r = RectangleZoom(f; kw...) - selection_vertices = lift(_selection_vertices, Observable(ax), ax.finallimits, r.rectnode) + selection_vertices = lift(_selection_vertices, Observable(ax.scene), ax.finallimits, r.rectnode) # manually specify correct faces for a rectangle with a rectangle hole inside faces = [1 2 5; 5 2 6; 2 3 6; 6 3 7; 3 4 7; 7 4 8; 4 1 8; 8 1 5] # plot to blockscene, so ax.scene stays exclusive for user plots From 01fbcdc2ffa7222c577d933179da94088b12471d Mon Sep 17 00:00:00 2001 From: Frederic Freyer Date: Mon, 13 Feb 2023 16:36:55 +0100 Subject: [PATCH 3/3] Update NEWS.md --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 9a942b3f662..1f29c947ae5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,11 @@ # News ## master -- Added the `stephist` plotting function [#2408](https://github.com/JuliaPlots/Makie.jl/pull/2408). +- Added the `stephist` plotting function [#2408](https://github.com/JuliaPlots/Makie.jl/pull/2408). - Fixed an issue where `poly` plots with `Vector{<: MultiPolygon}` inputs with per-polygon color were mistakenly rendered as meshes using CairoMakie. [#2590](https://github.com/MakieOrg/Makie.jl/pulls/2478) - Fixed a small typo which caused an error in the `Stepper` constructor. [#2600](https://github.com/MakieOrg/Makie.jl/pulls/2478) +- Fixed rectangle zoom for nonlinear axes [#2674](https://github.com/MakieOrg/Makie.jl/pull/2674) ## v0.19.1