Changeset 234 for trunk/UClientGUI.pas


Ignore:
Timestamp:
Sep 19, 2018, 5:28:58 PM (6 years ago)
Author:
chronos
Message:
  • Added: Unfinished implementation of cyclic map drawing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UClientGUI.pas

    r233 r234  
    347347function TView.CanvasToCellPos(Pos: TPoint): TPoint;
    348348begin
    349   Result := TPoint.Create(Trunc(Pos.X / Zoom + SourceRect.P1.X),
    350     Trunc(Pos.Y / Zoom + SourceRect.P1.Y));
     349  Result := TPoint.Create(Trunc((Pos.X - DestRect.P1.X) / Zoom + SourceRect.P1.X),
     350    Trunc((Pos.Y - DestRect.P1.Y) / Zoom + SourceRect.P1.Y));
    351351end;
    352352
    353353function TView.CellToCanvasPos(Pos: TPoint): TPoint;
    354354begin
    355   Result := TPoint.Create(Trunc((Pos.X - SourceRect.P1.X) * Zoom),
    356     Trunc((Pos.Y - SourceRect.P1.Y) * Zoom));
     355  Result := TPoint.Create(Trunc((Pos.X - SourceRect.P1.X) * Zoom) + DestRect.P1.X,
     356    Trunc((Pos.Y - SourceRect.P1.Y) * Zoom) + DestRect.P1.Y);
    357357end;
    358358
     
    449449    (RectPolygon.P2.Y > RectView.P1.Y)
    450450  );
     451  Result := True;
    451452end;
    452453
Note: See TracChangeset for help on using the changeset viewer.