Fix extendd menu expanding on Retina screens.

This commit is contained in:
John Preston 2022-09-22 12:31:11 +04:00
parent 06f3c837f6
commit d57bf79ce0

View file

@ -373,25 +373,20 @@ auto PanelAnimation::computeState(float64 dt, float64 opacity) const
const auto heightProgress = (_startHeight < 0 || dt >= _heightDuration) const auto heightProgress = (_startHeight < 0 || dt >= _heightDuration)
? 1. ? 1.
: transition(1., dt / _heightDuration); : transition(1., dt / _heightDuration);
auto frameWidth = (widthProgress < 1.) const auto frameWidth = (widthProgress < 1.)
? anim::interpolate(_startWidth, _finalInnerWidth, widthProgress) ? anim::interpolate(_startWidth, _finalInnerWidth, widthProgress)
: _finalInnerWidth; : _finalInnerWidth;
auto frameHeight = (heightProgress < 1.) const auto frameHeight = (heightProgress < 1.)
? anim::interpolate(_startHeight, _finalInnerHeight, heightProgress) ? anim::interpolate(_startHeight, _finalInnerHeight, heightProgress)
: _finalInnerHeight; : _finalInnerHeight;
if (auto decrease = (frameWidth % style::DevicePixelRatio())) { const auto ratio = style::DevicePixelRatio();
frameWidth -= decrease;
}
if (auto decrease = (frameHeight % style::DevicePixelRatio())) {
frameHeight -= decrease;
}
return { return {
.opacity = opacity, .opacity = opacity,
.widthProgress = widthProgress, .widthProgress = widthProgress,
.heightProgress = heightProgress, .heightProgress = heightProgress,
.fade = transition(1., dt), .fade = transition(1., dt),
.width = frameWidth, .width = frameWidth / ratio,
.height = frameHeight, .height = frameHeight / ratio,
}; };
} }
@ -411,8 +406,8 @@ auto PanelAnimation::paintFrame(
const auto state = computeState(dt, opacity); const auto state = computeState(dt, opacity);
opacity = state.opacity; opacity = state.opacity;
_frameAlpha = anim::interpolate(1, 256, opacity); _frameAlpha = anim::interpolate(1, 256, opacity);
const auto frameWidth = state.width; const auto frameWidth = state.width * pixelRatio;
const auto frameHeight = state.height; const auto frameHeight = state.height * pixelRatio;
auto frameLeft = (_origin == Origin::TopLeft || _origin == Origin::BottomLeft) ? _finalInnerLeft : (_finalInnerRight - frameWidth); auto frameLeft = (_origin == Origin::TopLeft || _origin == Origin::BottomLeft) ? _finalInnerLeft : (_finalInnerRight - frameWidth);
auto frameTop = (_origin == Origin::TopLeft || _origin == Origin::TopRight) ? _finalInnerTop : (_finalInnerBottom - frameHeight); auto frameTop = (_origin == Origin::TopLeft || _origin == Origin::TopRight) ? _finalInnerTop : (_finalInnerBottom - frameHeight);
auto frameRight = frameLeft + frameWidth; auto frameRight = frameLeft + frameWidth;