Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarthur committed Oct 9, 2024
1 parent 51deb6b commit 0994040
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/basic_recipes/tooltip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ function plot!(p::Tooltip{<:Tuple{<:VecTypes}})
elseif placement in (:above, :up, :top)
translate!(mp, Vec3f(o[1] + align * w[1], o[2], o[3]))
rotate!(mp, Quaternionf(0,0,0,1)) # 0
elseif placement === :center
else
placement === :center || @error "Tooltip placement $placement invalid. Assuming :above"
@error "Tooltip placement $placement invalid. Assuming :above"
translate!(mp, Vec3f(o[1] + align * w[1], o[2], o[3]))
rotate!(mp, Quaternionf(0,0,0,1))
end
Expand Down
6 changes: 4 additions & 2 deletions src/makielayout/blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,11 @@ function tooltip!(b::Block, str::AbstractString; placement=:above, kwargs...)
bbox.origin + Point2f((0, bbox.widths[2]/2))

Check warning on line 653 in src/makielayout/blocks.jl

View check run for this annotation

Codecov / codecov/patch

src/makielayout/blocks.jl#L653

Added line #L653 was not covered by tests
elseif placement == :right
bbox.origin + Point2f((bbox.widths[1], bbox.widths[2]/2))

Check warning on line 655 in src/makielayout/blocks.jl

View check run for this annotation

Codecov / codecov/patch

src/makielayout/blocks.jl#L655

Added line #L655 was not covered by tests
else
placement == :center || warn("invalid value for tooltip_placement, using :center")
elseif placement == :center
bbox.origin + Point2f((bbox.widths[1]/2, bbox.widths[2]/2))
else
@error("invalid value for tooltip_placement, using :above")
bbox.origin + Point2f((bbox.widths[1]/2, bbox.widths[2]))
end
end
tt = tooltip!(b.blockscene, position, str; placement, kwargs...)
Expand Down
2 changes: 2 additions & 0 deletions test/makielayout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -548,4 +548,6 @@ end
tooltip!(t, "I'm a Toggle")
a, s = scatter(f[1,2], [1,2,3])
tooltip!(a, "I'm an Axis", placement = :center)
b = Button(f[1,3])
tooltip!(b, "I'm a Button", placement = :qwerty)
end

0 comments on commit 0994040

Please sign in to comment.