MT07379: better automatic group bounds behaviour

This commit is contained in:
Vas Crabb 2019-08-20 01:45:52 +10:00
parent 450a57568e
commit 60c035ea75
2 changed files with 20 additions and 5 deletions

View File

@ -749,6 +749,7 @@ private:
util::xml::data_node const &parentnode, util::xml::data_node const &parentnode,
group_map &groupmap, group_map &groupmap,
std::vector<layout_group const *> &seen, std::vector<layout_group const *> &seen,
bool empty,
bool repeat, bool repeat,
bool init); bool init);

View File

@ -1062,8 +1062,9 @@ void layout_group::resolve_bounds(environment &env, group_map &groupmap, std::ve
seen.push_back(this); seen.push_back(this);
if (!m_bounds_resolved) if (!m_bounds_resolved)
{ {
set_render_bounds_xy(m_bounds, 0.0F, 0.0F, 1.0F, 1.0F);
environment local(env); environment local(env);
resolve_bounds(local, m_groupnode, groupmap, seen, false, true); resolve_bounds(local, m_groupnode, groupmap, seen, true, false, true);
} }
seen.pop_back(); seen.pop_back();
} }
@ -1073,6 +1074,7 @@ void layout_group::resolve_bounds(
util::xml::data_node const &parentnode, util::xml::data_node const &parentnode,
group_map &groupmap, group_map &groupmap,
std::vector<layout_group const *> &seen, std::vector<layout_group const *> &seen,
bool empty,
bool repeat, bool repeat,
bool init) bool init)
{ {
@ -1110,7 +1112,11 @@ void layout_group::resolve_bounds(
{ {
render_bounds itembounds; render_bounds itembounds;
env.parse_bounds(itemnode->get_child("bounds"), itembounds); env.parse_bounds(itemnode->get_child("bounds"), itembounds);
union_render_bounds(m_bounds, itembounds); if (empty)
m_bounds = itembounds;
else
union_render_bounds(m_bounds, itembounds);
empty = false;
} }
else if (!strcmp(itemnode->get_name(), "group")) else if (!strcmp(itemnode->get_name(), "group"))
{ {
@ -1119,7 +1125,11 @@ void layout_group::resolve_bounds(
{ {
render_bounds itembounds; render_bounds itembounds;
env.parse_bounds(itemboundsnode, itembounds); env.parse_bounds(itemboundsnode, itembounds);
union_render_bounds(m_bounds, itembounds); if (empty)
m_bounds = itembounds;
else
union_render_bounds(m_bounds, itembounds);
empty = false;
} }
else else
{ {
@ -1139,7 +1149,11 @@ void layout_group::resolve_bounds(
found->second.m_bounds.y0, found->second.m_bounds.y0,
(orientation & ORIENTATION_SWAP_XY) ? (found->second.m_bounds.x0 + found->second.m_bounds.y1 - found->second.m_bounds.y0) : found->second.m_bounds.x1, (orientation & ORIENTATION_SWAP_XY) ? (found->second.m_bounds.x0 + found->second.m_bounds.y1 - found->second.m_bounds.y0) : found->second.m_bounds.x1,
(orientation & ORIENTATION_SWAP_XY) ? (found->second.m_bounds.y0 + found->second.m_bounds.x1 - found->second.m_bounds.x0) : found->second.m_bounds.y1 }; (orientation & ORIENTATION_SWAP_XY) ? (found->second.m_bounds.y0 + found->second.m_bounds.x1 - found->second.m_bounds.x0) : found->second.m_bounds.y1 };
union_render_bounds(m_bounds, itembounds); if (empty)
m_bounds = itembounds;
else
union_render_bounds(m_bounds, itembounds);
empty = false;
} }
} }
else if (!strcmp(itemnode->get_name(), "repeat")) else if (!strcmp(itemnode->get_name(), "repeat"))
@ -1150,7 +1164,7 @@ void layout_group::resolve_bounds(
environment local(env); environment local(env);
for (int i = 0; !m_bounds_resolved && (count > i); ++i) for (int i = 0; !m_bounds_resolved && (count > i); ++i)
{ {
resolve_bounds(local, *itemnode, groupmap, seen, true, !i); resolve_bounds(local, *itemnode, groupmap, seen, empty, true, !i);
local.increment_parameters(); local.increment_parameters();
} }
} }