From b49ac99a07535d1eb0bd60d56cdbcba4a0b0c3be Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Thu, 25 Nov 2021 10:17:16 +0100 Subject: [PATCH] add Measure conversion --- src/Plots.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Plots.jl b/src/Plots.jl index 911b99fc..4aff05a2 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -166,6 +166,8 @@ const BBox = Measures.Absolute2DBox const px = AbsoluteLength(0.254) const pct = Length{:pct,Float64}(1.0) +Base.convert(::Type{<:Measure}, x::Float64) = x * pct + Base.:*(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value * m2.value) Base.:*(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value * m1.value) Base.:/(m1::AbsoluteLength, m2::Length{:pct}) = AbsoluteLength(m1.value / m2.value)