mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-30 02:50:05 +00:00
Avoided some judder when dragging windows using a global scale factor.
This commit is contained in:
parent
ca902e0122
commit
fa82952520
1 changed files with 18 additions and 0 deletions
|
|
@ -230,6 +230,24 @@ struct Component::ComponentHelpers
|
|||
return scale != 1.0f ? pos * scale : pos;
|
||||
}
|
||||
|
||||
// For these, we need to avoid getSmallestIntegerContainer being used, which causes
|
||||
// judder when moving windows
|
||||
static Rectangle<int> unscaledScreenPosToScaled (float scale, const Rectangle<int>& pos) noexcept
|
||||
{
|
||||
return scale != 1.0f ? Rectangle<int> (roundToInt (pos.getX() / scale),
|
||||
roundToInt (pos.getY() / scale),
|
||||
roundToInt (pos.getWidth() / scale),
|
||||
roundToInt (pos.getHeight() / scale)) : pos;
|
||||
}
|
||||
|
||||
static Rectangle<int> scaledScreenPosToUnscaled (float scale, Rectangle<int>& pos) noexcept
|
||||
{
|
||||
return scale != 1.0f ? Rectangle<int> (roundToInt (pos.getX() * scale),
|
||||
roundToInt (pos.getY() * scale),
|
||||
roundToInt (pos.getWidth() * scale),
|
||||
roundToInt (pos.getHeight() * scale)) : pos;
|
||||
}
|
||||
|
||||
template <typename PointOrRect>
|
||||
static PointOrRect unscaledScreenPosToScaled (PointOrRect pos) noexcept
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue