private bool gotoMap(string mapId) { if (NgMaps == null) { curMap = null; curMapImage = null; curPoint = null; return false; } var map2b = NgMaps.FirstOrDefault(x => x.id == mapId); if (map2b == null) return false; curMap = map2b; var imgPath = Path.Combine(ImageFolderRelativePath, curMap.img); curMapImage = Image.FromFile(imgPath); return true; }
private void MapImmitator_MouseLeave(object sender, EventArgs e) { curPoint = null; }
private bool IntersectsMouse(NgMapObjPoint point, MouseEventArgs e) { var x = (float)(Width * point.x / 100); var y = (float)(Height * point.y / 100); return (e.X >= x - DotRadius && e.X <= x + DotRadius && e.Y >= y - DotRadius && e.Y <= y + DotRadius); }
private void MapImmitator_MouseUp(object sender, MouseEventArgs e) { string idMapChange = null; if (isUpHover) idMapChange = curMap.backLink; else if (curPoint != null) idMapChange = curPoint.href; if (idMapChange == null) return; var mapGoOk = gotoMap(idMapChange); if (!mapGoOk) idMapChange = String.Format("FINISH-POINT:{0},{1},{2}", curPoint.x, curPoint.y, curPoint.label); // ... fire map changed event for all subsequent clicks if (MapChanged != null) MapChanged(idMapChange); curPoint = null; }
private void MapImmitator_MouseMove(object sender, MouseEventArgs e) { if (curMap == null) return; curPoint = curMap.points.LastOrDefault(p => IntersectsMouse(p, e)); isUpHover = (e.X < 90 && e.Y < 60); Invalidate(); }