From 721b4b13122bf58652323105d2a6a466c9c9fe5a Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 27 Sep 2020 22:46:37 +0200 Subject: [PATCH] move operation definitions for pct to PlotMeasures module --- src/Plots.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Plots.jl b/src/Plots.jl index b67abe3f..a7c114b7 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -154,6 +154,12 @@ const BBox = Measures.Absolute2DBox # allow pixels and percentages const px = AbsoluteLength(0.254) const pct = Length{:pct, Float64}(1.0) + +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) +Base.:/(m1::Length{:pct}, m2::AbsoluteLength) = AbsoluteLength(m2.value / m1.value) + export BBox, BoundingBox, mm, cm, inch, px, pct, pt, w, h end