You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like ngon and xgon are transformed with UnitBox differently to other shapes like circle and rectangle. Here is a script that tries to put these shapes at the center of sub-contexts:
As you can see, circle, rectangle, xgon and ngon in the first (blue) sub-grid are perfectly centered (i.e., at the correct location). However, if I use UnitBox (to add padding) as in the second (red) sub-grid, xgon and ngon are not centered while circle and rectangle are centered.
Is the behavior I'm seeing a bug? Or is it expected?
The issue that occurs above is because Compose needs a new unit that describes "size relative to context units".
Size wrt Context: sx, sy
Design example:
module t
using Compose
import Compose: Length, AbsoluteBox, Transform, width, resolve
importBase.(*)
size_x_measure(a::Measure) = a
size_x_measure(a::T) where T =Length{:sx, T}(a)
cmpgrid2(args...) = (context(),
line([[(x, 0), (x, 1)] for x in0:0.1:1]), line([[(0, y), (1, y)] for y in0:0.1:1]), args..., linewidth(0.1mm))
resolve(box::AbsoluteBox, units::UnitBox, t::Transform, a::Length{:sx}) =
a.value /width(units) * box.a[1]
end
Here I use a different red grid to better illustrate the current issues (green polygon). The new (blue) polygon is correct:
It looks like
ngon
andxgon
are transformed withUnitBox
differently to other shapes likecircle
andrectangle
. Here is a script that tries to put these shapes at the center of sub-contexts:It generates:
As you can see,
circle
,rectangle
,xgon
andngon
in the first (blue) sub-grid are perfectly centered (i.e., at the correct location). However, if I useUnitBox
(to add padding) as in the second (red) sub-grid,xgon
andngon
are not centered whilecircle
andrectangle
are centered.Is the behavior I'm seeing a bug? Or is it expected?
Version of the packages I'm using:
The text was updated successfully, but these errors were encountered: