Delphi iOS同时缩放+平移(两根手指不会同时脱离屏幕)

时间:2013-07-29 09:22:51

标签: ios delphi

我有这段代码:

  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个手指,如果一个手指在另一个手指之前稍微被移除(图像跳转到“最后”手指执行变焦时图像被平移),平移有时会变得混乱。

有什么方法可以解决这个问题吗?

0 个答案:

没有答案