/// <summary> /// This will save the button item /// </summary> /// <param name="label">The button we want to save</param> /// <param name="dateOfButton">The date we're looking for</param> internal static void AddButton(GenericLabelForWorldMap label, LocalDate dateOfButton) { if (_client == null) { _client = new HistoryMapWebClient("defaultUser", "ry3kGKijkF12Abwxczm1"); } _client.CreateRecord(label).GetAwaiter(); }
/// <summary> /// this should calculate its location based on current zoom level, returning -1,-1 means that it's /// not viewable at the stated view level /// </summary> private Point?ButtonLocation(DrawClass localDrawClass, GenericLabelForWorldMap local) { //this is to offset it to get it to the correct location var ratios = localDrawClass.GetUiToMapRatio(); var xOffset = (local.Width / 2) * ratios.Item1; var yOffset = local.Height * ratios.Item2; var localPoint = local.ButtonCenterPoint; var renderRect = localDrawClass.RenderRectangle; //Check the point is in the render rectangle if (!renderRect.Contains(localPoint)) { return(null); } //The point is in the render rectangle of map - so lets translate back. //The Mouse point should be zoomed in to - so we want to center it [0,0 is min coords] return(localDrawClass.CalculateMapToUi((int)(localPoint.X - xOffset), (int)(localPoint.Y - yOffset))); }