[BUG][PLAYER] Zooming In Fails to Preserve Mouse-On-Land [FIXED]

Started by Simon, February 05, 2023, 03:01:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillLem

FWIW, I've found a bug; the cursor area needs to be reset between zooms. The correct code is this:

procedure TGameWindow.ChangeZoom(aNewZoom: Integer; NoRedraw: Boolean = false);
var
  Pivot: TPoint;
begin
  aNewZoom := Max(Min(fMaxZoom, aNewZoom), 1);
  if (aNewZoom = fInternalZoom) and not NoRedraw then
    Exit;

  SkillPanel.Image.BeginUpdate;
  try
    Pivot := Img.ScreenToClient(Mouse.CursorPos);
    Pivot := Img.ControlToBitmap(Pivot);
    Img.Zoom(aNewZoom, Pivot);

    fInternalZoom := aNewZoom;

    ApplyResize(False);

    SetRedraw(rdRedraw);
    CheckResetCursor(True);
  finally
    SkillPanel.Image.EndUpdate;
  end;
end;