centering in bbox
This commit is contained in:
parent
6e3de26477
commit
03a228fbe7
@ -113,9 +113,11 @@ function bbox(x, y, w, h, oarg1::Symbol, originargs::Symbol...)
|
||||
orighor = :left
|
||||
origver = :top
|
||||
for oarg in oargs
|
||||
if oarg in (:left, :right)
|
||||
if oarg == :center
|
||||
orighor = origver = oarg
|
||||
elseif oarg in (:left, :right, :hcenter)
|
||||
orighor = oarg
|
||||
elseif oarg in (:top, :bottom)
|
||||
elseif oarg in (:top, :bottom, :vcenter)
|
||||
origver = oarg
|
||||
else
|
||||
warn("Unused origin arg in bbox construction: $oarg")
|
||||
@ -132,11 +134,15 @@ function bbox(x, y, width, height; h_anchor = :left, v_anchor = :top)
|
||||
height = make_measure_vert(height)
|
||||
left = if h_anchor == :left
|
||||
x
|
||||
elseif h_anchor in (:center, :hcenter)
|
||||
0.5w - 0.5width + x
|
||||
else
|
||||
1w - x - width
|
||||
end
|
||||
top = if v_anchor == :top
|
||||
y
|
||||
elseif v_anchor in (:center, :vcenter)
|
||||
0.5h - 0.5height + y
|
||||
else
|
||||
1h - y - height
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user