Skip to content

Commit

Permalink
Make sure to use Float64 points everywhere (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz authored Aug 26, 2024
1 parent fb56c70 commit 76d6404
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/geometry_canvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function GeometryCanvas{T}(obj=Observable(_geomtype(T)[]);
points_obs = if length(geoms[]) > 0
Observable(geoms_to_points(geoms[]))
else
ps = Vector{Point2f}[]
ps = Vector{Point2{Float64}}[]
if length(ps) > 0
geoms[] = T1.(ps)
end
Expand Down Expand Up @@ -345,11 +345,11 @@ function draw!(fig, ax::Axis, c::GeometryCanvas{<:LineString};
elseif length(ps) > 0
[first(ps)]
else
Point2f[]
Point2{Float64}[]
end
end |> Iterators.flatten |> collect
else
Point2f[]
Point2{Float64}[]
end
end
e = scatter!(ax, end_points; color=:black, scatter_kw...)
Expand Down Expand Up @@ -406,7 +406,7 @@ function draw_current_point!(fig, ax::Axis, c::GeometryCanvas;
# Current point
current_point_pos = lift(c.points) do points
cp = c.current_point[]
length(points) > 0 || return Point2(0.0f0, 0.0f0)
length(points) > 0 || return Point2{Float64}(0.0, 0.0)
if cp isa Tuple
points[cp[1]][cp[2]]
else
Expand Down Expand Up @@ -722,7 +722,7 @@ function _accuracy(ax::Axis, accuracy_scale)
end

geoms_to_points(geoms) =
[[Point2(GI.x(p), GI.y(p)) for p in GI.getpoint(g)] for g in geoms]
[[Point2{Float64}(GI.x(p), GI.y(p)) for p in GI.getpoint(g)] for g in geoms]

_isvalid_current_point(cp::Observable) = _isvalid_current_point(cp[])
_isvalid_current_point(cp::Tuple) = cp[1] > 0 && cp[2] > 0
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ figure = Figure()
axis = Axis(figure[1, 1])

paint_canvas = PaintCanvas(falses(100, 100); figure, axis)
paint_canvas.active[] = true
paint_canvas.active[] = false

line_canvas = GeometryCanvas{LineString}(; figure, axis)
line_canvas.active[] = false
Expand Down

0 comments on commit 76d6404

Please sign in to comment.