1

我有这个代码:

  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 根手指,如果一个手指在另一根手指之前稍稍移开,则平移有时会变得混乱(在平移图像时,图像会跳到执行缩放的“最后一个”手指)

有没有办法解决这个问题?

4

0 回答 0