svg_loader: symbol preserveAspectRatio attribute fixed

The symbol node was properly scaled only for 'preserveAspectRatio=none'.
Now it works also for the default value of this attribute (xMidYMid).
This commit is contained in:
mgrudzinska 2022-02-23 21:34:15 +01:00 committed by JunsuChoi
parent d1e7d60fc9
commit b16d60d509

View file

@ -589,8 +589,8 @@ static unique_ptr<Scene> _useBuildHelper(const SvgNode* node, const Box& vBox, c
auto tvy = symbol.vy * sy;
auto tvw = symbol.vw * sx;
auto tvh = symbol.vh * sy;
if (tvw > tvh) tvy -= (symbol.h - tvh) * 0.5f;
else tvx -= (symbol.w - tvw) * 0.5f;
tvy -= (symbol.h - tvh) * 0.5f;
tvx -= (symbol.w - tvw) * 0.5f;
mViewBox = {sx, 0, -tvx, 0, sy, -tvy, 0, 0, 1};
} else if (!mathZero(symbol.vx) || !mathZero(symbol.vy)) {
mViewBox = {1, 0, -symbol.vx, 0, 1, -symbol.vy, 0, 0, 1};