summaryrefslogtreecommitdiff
path: root/crates/gipfel-web/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/gipfel-web/src')
-rw-r--r--crates/gipfel-web/src/app.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/gipfel-web/src/app.rs b/crates/gipfel-web/src/app.rs
index 23126e9..e4fd435 100644
--- a/crates/gipfel-web/src/app.rs
+++ b/crates/gipfel-web/src/app.rs
@@ -558,7 +558,12 @@ pub fn app() -> Html {
Callback::from(move |(ix, iy): (f64, f64)| {
let scale = view.scale;
// unambiguous click right on a peak: mark directly
- if let Some(idx) = markers::nearest_hill(&pan.borrow(), ix, iy, 10.0 / scale) {
+ // (borrow must be released before mark -> do_refit!)
+ let near = {
+ let p = pan.borrow();
+ markers::nearest_hill(&p, ix, iy, 10.0 / scale)
+ };
+ if let Some(idx) = near {
find_peak.set(None);
mark.emit((idx, ix, iy));
return;