diff --git a/CHANGELOG.md b/CHANGELOG.md index 6433b0d463a..d0ce95d49eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] + +- Fix stack overflows when using `markerspace = :data` with `scatter` [#3960](https://github.com/MakieOrg/Makie.jl/issues/3960). - CairoMakie: Fix broken SVGs when using non-interpolated image primitives, for example Colorbars, with recent Cairo versions [#3967](https://github.com/MakieOrg/Makie.jl/pull/3967). - CairoMakie: Add argument `pdf_version` to restrict the PDF version when saving a figure as a PDF [#3845](https://github.com/MakieOrg/Makie.jl/pull/3845). - CairoMakie: Fix incorrect scaling factor for SVGs with Cairo_jll 1.18 [#3964](https://github.com/MakieOrg/Makie.jl/pull/3964). diff --git a/src/utilities/texture_atlas.jl b/src/utilities/texture_atlas.jl index 4a671d1e6a3..ef497fc7cdf 100644 --- a/src/utilities/texture_atlas.jl +++ b/src/utilities/texture_atlas.jl @@ -458,7 +458,7 @@ function primitive_uv_offset_width(atlas::TextureAtlas, marker::Observable, font return lift((m, f)-> primitive_uv_offset_width(atlas, m, f), marker, font; ignore_equal_values=true) end -_bcast(x::Vec) = (x,) +_bcast(x::Vec) = Ref(x) _bcast(x) = x # Calculates the scaling factor from unpadded size -> padded size @@ -534,7 +534,7 @@ function offset_bezierpath(atlas::TextureAtlas, bp::BezierPath, markersize::Vec2 end function offset_bezierpath(atlas::TextureAtlas, bp, scale, offset) - return offset_bezierpath.(Ref(atlas), bp, _bcast(scale), _bcast(offset)) + return offset_bezierpath.(Ref(atlas), bp, Vec2d.(_bcast(scale)), Vec2d.(_bcast(offset))) end function offset_marker(atlas::TextureAtlas, marker::Union{T, AbstractVector{T}}, font, markersize, markeroffset) where T <: BezierPath diff --git a/test/boundingboxes.jl b/test/boundingboxes.jl index 95c874bf5fd..66897c8444f 100644 --- a/test/boundingboxes.jl +++ b/test/boundingboxes.jl @@ -145,3 +145,16 @@ end @test data_limits(p) ≈ bb1 @test boundingbox(p) ≈ bb3 end + +@testset "issue 3960" begin + fig = Figure() + ax = Axis(fig[1, 1]) + triangle = BezierPath([ + MoveTo(Point(0, 0)), + LineTo(Point(1, 0)), + LineTo(Point(0, 1)), + ClosePath() + ]) + sc = scatter!(ax, Point(0, 0), marker=triangle, markerspace=:data) + data_limits(sc) # doesn't stackoverflow +end