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 diff --git a/src/layouts.jl b/src/layouts.jl index db1f3d20..57c9c663 100644 --- a/src/layouts.jl +++ b/src/layouts.jl @@ -4,12 +4,6 @@ to_pixels(m::AbsoluteLength) = m.value / 0.254 const _cbar_width = 5mm - -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) - const defaultbox = BoundingBox(0mm, 0mm, 0mm, 0mm) left(bbox::BoundingBox) = bbox.x0[1]