Delphi iOS同时放大缩小+平移(两根手指不能同时离开屏幕)
我有这个代码:
case EventInfo.GestureID of igiZoom: begin if (not(TInteractiveGestureFlag.gfEnd in EventInfo.Flags)) then begin if (not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) then begin W := LImage.Width + 2 * ((EventInfo.Distance - FMapsLastDistanceZoom) / 3); H := LImage.Height + 2 * ((EventInfo.Distance - FMapsLastDistanceZoom) / 3); if (W < layoutMapsContent.Width) or (H < layoutMapsContent.Height) then begin W := layoutMapsContent.Width; H := layoutMapsContent.Height; end ; LImage.Width := W; LImage.Height := H; end ; FMapsLastDistanceZoom := EventInfo.Distance; end ; end ; igiPan: begin if (not(TInteractiveGestureFlag.gfEnd in EventInfo.Flags)) then begin if (not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) then begin LImage.Position.X := LImage.Position.X + (EventInfo.Location.X - FMapsLastPositionPan.X); LImage.Position.Y := LImage.Position.Y + (EventInfo.Location.Y - FMapsLastPositionPan.Y); end ; FMapsLastPositionPan.X := EventInfo.Location.X; FMapsLastPositionPan.Y := EventInfo.Location.Y; end ; end ; igiDoubleTap: begin UpdateMapsPosition; end ; end;
但是,因为缩放使用了2个手指,所以如果一个手指略微在另一个手指之前被移除,则平移有时会变得混乱(图像在图像被平移时跳到“最后”手指执行缩放)
有没有办法解决这个问题?