From 09f7a0dff234b0421ca8fe66d0aaf39e0ec73510 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Tue, 7 Dec 2021 16:43:04 -0500 Subject: [PATCH] Support getindex for compatibility with PolygonOps --- src/graphics_interaction.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/graphics_interaction.jl b/src/graphics_interaction.jl index c8b92b7..6dab845 100644 --- a/src/graphics_interaction.jl +++ b/src/graphics_interaction.jl @@ -107,6 +107,8 @@ Base.convert(::Type{XY{T}}, xy::XY) where {T} = XY(T(xy.x), T(xy.y)) Base.:+(xy1::XY{T}, xy2::XY{T}) where {T} = XY{T}(xy1.x+xy2.x,xy1.y+xy2.y) Base.:-(xy1::XY{T}, xy2::XY{T}) where {T} = XY{T}(xy1.x-xy2.x,xy1.y-xy2.y) +Base.getindex(p::XY, i::Int) = i == 1 ? p.x : i == 2 ? p.y : throw(ArgumentError("must be 1 or 2, got $i")) + """ MouseButton(position, button, clicktype, modifiers)