/// <summary><c>HexCoords</c> for the hex at the screen point, with the given AutoScroll position.</summary> /// <param name="this"></param> /// <param name="point">Screen point specifying hex to be identified.</param> /// <param name="autoScroll">AutoScrollPosition for game-display Panel.</param> static HexCoords GetHexCoords(this IHexgrid @this, HexPointF point, HexSizeF autoScroll) { // Adjust for origin not as assumed by GetCoordinate(). var grid = new HexSizeF(@this.GridSizeF().Width *2F / 3F, @this.GridSizeF().Height); point -= autoScroll + grid - new HexSizeF(@this.Margin.Width, @this.Margin.Height); return(HexCoords.NewCanonCoords(@this.GetCoordinate(@this.MatrixX(), point), @this.GetCoordinate(@this.MatrixY(), point))); }
/// <inheritdoc/> public virtual HexCoords GetHexCoords(HexPointF point, HexSizeF autoScroll) { // Adjust for origin not as assumed by GetCoordinate(). var grid = new HexSizeF(GridSizeF.Width * 2F / 3F, GridSizeF.Height); point -= autoScroll + grid - new HexSizeF(Margin.Width, Margin.Height); return(HexCoords.NewCanonCoords(GetCoordinate(_matrixX, point), GetCoordinate(_matrixY, point))); }
public static WpfSize ToWpfSize(this HexSizeF @this) { return(new WpfSize(@this.Width, @this.Height)); }
/// <summary>Returns the location and extent in hexes, as a <see cref="CoordsRect"/>, of the current clipping region.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="point"></param> /// <param name="size"></param> /// <returns>A Point structure containing pixel coordinates for the (centre of the) specified hex.</returns> public static CoordsRect GetClipInHexes(this IPanelModel @this, HexPointF point, HexSizeF size) => @this.GetClipInHexes(new RectangleF(point, size), @this.MapSizeHexes);