Browse Source

Fix steppy scrolling if the content component of a viewport was transformed

tags/2021-05-28
hogliux 9 years ago
parent
commit
035f865099
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      modules/juce_gui_basics/layout/juce_Viewport.cpp

+ 7
- 2
modules/juce_gui_basics/layout/juce_Viewport.cpp View File

@@ -110,8 +110,13 @@ int Viewport::getMaximumVisibleHeight() const { return contentHolder.getHeight
Point<int> Viewport::viewportPosToCompPos (Point<int> pos) const
{
jassert (contentComp != nullptr);
return Point<int> (jmax (jmin (0, contentHolder.getWidth() - contentComp->getWidth()), jmin (0, -(pos.x))),
jmax (jmin (0, contentHolder.getHeight() - contentComp->getHeight()), jmin (0, -(pos.y))));
Rectangle<int> contentBounds = contentHolder.getLocalArea (contentComp, contentComp->getLocalBounds());
Point<int> p (jmax (jmin (0, contentHolder.getWidth() - contentBounds.getWidth()), jmin (0, -(pos.x))),
jmax (jmin (0, contentHolder.getHeight() - contentBounds.getHeight()), jmin (0, -(pos.y))));
return p.transformedBy (contentComp->getTransform().inverted());
}
void Viewport::setViewPosition (const int xPixelsOffset, const int yPixelsOffset)


Loading…
Cancel
Save