1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! # egui-map
//!
//! An [`egui`](https://docs.rs/egui) widget that renders an interactive 2D map
//! on screen.
//!
//! The [`map::Map`] widget displays a set of nodes connected by lines, with
//! support for:
//!
//! - Panning (click and drag) and zooming (mouse wheel; hold `Ctrl` — or `Cmd`
//! on macOS — to zoom faster).
//! - Spatial indexing of nodes through a kd-tree, so only the nodes inside the
//! current viewport are painted each frame.
//! - Node names and free-floating text labels with configurable visibility
//! rules (see [`map::objects::VisibilitySetting`]).
//! - Pulsing notifications and blinking markers attached to nodes.
//! - Custom node rendering and right-click context menus through the
//! [`map::objects::NodeTemplate`] and [`map::objects::ContextMenuManager`]
//! traits.
//! - Independent light and dark themes (see [`map::objects::MapSettings`]).
//!
//! ## Quick start
//!
//! ```no_run
//! use egui_map::map::Map;
//! use egui_map::map::objects::MapPoint;
//! use std::collections::HashMap;
//!
//! // Build the node set, keyed by node id.
//! let mut points: HashMap<usize, MapPoint> = HashMap::new();
//! points.insert(1, MapPoint::new(1, [0.0, 0.0]));
//! points.insert(2, MapPoint::new(2, [100.0, 50.0]));
//!
//! let mut map = Map::new();
//! map.add_hashmap_points(points);
//!
//! // Then, on every frame of your egui update loop:
//! // ui.add(&mut map);
//! ```
//!
//! ## Profiling
//!
//! The widget's hot paths (rendering, viewport culling, point/line loading)
//! are instrumented with [`profiling`](https://docs.rs/profiling) scopes.
//! These are no-ops unless the final binary enables one of `profiling`'s
//! backend features (e.g. `profile-with-tracy`); this crate never needs a
//! feature of its own for that — enabling the backend feature anywhere in
//! the dependency graph activates it here too, because `profiling` is a
//! normal, unconditional dependency.