@@ -339,6 +339,10 @@ class CanvasViewport : public Component
339339 viewport->mouseMagnify (e.withNewPosition (position), pinchScaleDelta);
340340 }
341341 if (gestureType & GestureType::Pan) {
342+ auto d = (multiTouchLastOffset - offset);
343+ std::cout << " pan: " << d.x << " " << d.y << std::endl;
344+ if (d.getDistanceFromOrigin () > 100 )
345+ jassertfalse;
342346 viewport->setViewPosition (viewport->getViewPosition () + (multiTouchLastOffset - offset));
343347 lastTouchCentre = position;
344348 multiTouchLastOffset = offset;
@@ -348,9 +352,16 @@ class CanvasViewport : public Component
348352
349353 void mouseUp (MouseEvent const & e) override
350354 {
351- multiTouchLastOffset = { };
352- lastPinchScale = 1 .0f ;
353- smoothedPinchScale = 1 .0f ;
355+ SmallArray<MouseInputSource> touches;
356+ for (auto const & source : Desktop::getInstance ().getMouseSources ())
357+ if (source.isTouch () && source.isDragging ())
358+ touches.add (source);
359+
360+ if (touches.size () == 0 ) {
361+ multiTouchLastOffset = { };
362+ lastPinchScale = 1 .0f ;
363+ smoothedPinchScale = 1 .0f ;
364+ }
354365
355366 if (SettingsFile::getInstance ()->isUsingTouchMode () && e.source .isTouch () && e.source .getIndex () == 0 ) {
356367 viewport->applyScale (viewport->getViewScale (), lastTouchCentre, true , true );
@@ -392,12 +403,14 @@ class CanvasViewport : public Component
392403 scrollbarCol = nvgColour (scrollbarColour);
393404 activeScrollbarCol = nvgColour (scrollbarColour.interpolatedWith (PlugDataColours::canvasBackgroundColour.contrasting (0 .6f ), 0 .7f ));
394405 scrollbarBgCol = nvgColour (scrollbarColour.interpolatedWith (PlugDataColours::canvasBackgroundColour, 0 .7f ));
395- ;
406+
396407 repaint ();
397408 }
398409
399410 bool hitTest (int const x, int const y) override
400411 {
412+ if (viewport->isPerformingGesture ()) return false ;
413+
401414 if (isVertical)
402415 return thumbBounds.withY (2 ).withHeight (getHeight () - 4 ).contains (x, y);
403416 else
0 commit comments