Skip to content

Commit 95798fe

Browse files
committed
iOS scrolling fix
1 parent 742a277 commit 95798fe

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

Source/Components/BouncingViewport.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ class BouncingViewportAttachment final : public MouseListener
2020
~BouncingViewportAttachment() override = default;
2121

2222
#if JUCE_IOS
23-
void mouseDrag(MouseEvent const& e) override
23+
void mouseDown(MouseEvent const& e) override
2424
{
25-
if(e.getDistanceFromDragStart() > 8) {
26-
OSUtils::ScrollTracker::setAllowOneFingerScroll(true);
25+
OSUtils::ScrollTracker::setAllowOneFingerScroll(true);
26+
}
27+
28+
void mouseUp(MouseEvent const& e) override
29+
{
30+
if(!OSUtils::ScrollTracker::isScrolling())
31+
{
32+
OSUtils::ScrollTracker::setAllowOneFingerScroll(false);
2733
}
2834
}
2935
#endif

Source/Utility/OSUtils.mm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ - (void)scrollEventOccurred:(UIPanGestureRecognizer*)gesture {
407407
[gesture setCancelsTouchesInView: false];
408408
return;
409409
}
410-
410+
411411
juce::MouseWheelDetails details;
412412
details.deltaX = scale * (float) (offset.x - lastPosition.x);
413413
details.deltaY = scale * (float) (offset.y - lastPosition.y);
@@ -453,9 +453,8 @@ - (void)updateInertia
453453

454454
const auto time = (juce::Time::currentTimeMillis() - juce::Time::getMillisecondCounter())
455455
+ (juce::int64) ([[NSProcessInfo processInfo] systemUptime] * 1000.0);
456-
456+
457457
peer->handleMouseWheel(juce::MouseInputSource::InputSourceType::touch, lastMousePosition, time, details);
458-
*allowOneFingerScroll = false;
459458
}
460459
@end
461460

@@ -805,7 +804,7 @@ BOOL openURLImplementation(id self, SEL _cmd, UIApplication* app, NSURL* url, NS
805804
juce::String juceFilePath = juce::String::fromUTF8([filePath UTF8String]);
806805
[url startAccessingSecurityScopedResource];
807806

808-
if (auto* juceApp = juce::JUCEApplicationBase::getInstance())
807+
if (juce::JUCEApplicationBase::getInstance())
809808
{
810809
juce::MessageManager::callAsync([juceFilePath]()
811810
{

0 commit comments

Comments
 (0)