Convert visual layers to scene nodes.

This commit is contained in:
James Grogan 2022-11-16 15:06:08 +00:00
parent 798cb365d7
commit 3e53bd9e00
64 changed files with 863 additions and 551 deletions

View file

@ -27,7 +27,7 @@ void HorizontalSpacer::addWidgetWithScale(WidgetUPtr widget, double scale)
mScales.push_back(scale);
}
void HorizontalSpacer::addChildLayers(const PaintEvent* event)
void HorizontalSpacer::updateChildLocations()
{
double scaleSum = std::accumulate(mScales.begin(), mScales.end(), 0.0);
double offset = 0;
@ -49,20 +49,6 @@ void HorizontalSpacer::addChildLayers(const PaintEvent* event)
}
child->setBounds(mSize.mWidth, unsigned(delta));
child->setLocation(DiscretePoint(mLocation.GetX(), mLocation.GetY() + unsigned(offset)));
child->onPaintEvent(event);
auto layers = child->getLayers();
mLayers.insert(mLayers.end(), layers.begin(), layers.end());
offset += delta;
}
}
void HorizontalSpacer::onPaintEvent(const PaintEvent* event)
{
if (!needsUpdate())
{
return;
}
mLayers.clear();
addChildLayers(event);
}