示例#1
0
 /// <summary>Returns the scroll position to center a specified hex in viewport.</summary>
 /// <param name="this"></param>
 /// <param name="coordsNewCenterHex"><c>HexCoords</c> for the hex to be centered in viewport.</param>
 /// <param name="visibleRectangle"></param>
 /// <returns>Pixel coordinates in Client reference frame.</returns>
 public static HexPoint ScrollPositionToCenterOnHex(this IHexgrid @this,
                                                    HexCoords coordsNewCenterHex, CoordsRectangle visibleRectangle)
 => @this.HexCenterPoint(HexCoords.NewUserCoords(coordsNewCenterHex.User - (visibleRectangle.Size.User / 2)));
 /// <inheritdoc/>
 public virtual HexPoint  ScrollPositionToCenterOnHex(HexCoords coordsNewCenterHex, CoordsRectangle visibleRectangle)
 {
     return(HexCenterPoint(HexCoords.NewUserCoords(
                               coordsNewCenterHex.User - (new IntVector2D(visibleRectangle.Size.User) / 2)
                               )));
 }