Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
fail: true
# When given a directory, lychee checks only markdown, html and text files, everything else we have to glob in manually.
args: |
--base . --cache --max-cache-age 1d . "**/*.rs" "**/*.toml" "**/*.hpp" "**/*.cpp" "**/CMakeLists.txt" "**/*.py" "**/*.yml"
--cache --max-cache-age 1d . "**/*.rs" "**/*.toml" "**/*.hpp" "**/*.cpp" "**/CMakeLists.txt" "**/*.py" "**/*.yml"
3 changes: 0 additions & 3 deletions egui_plot/src/bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ impl Interval {
let start_inf = self.start.is_infinite();
let end_inf = self.end.is_infinite();


if start_inf && end_inf {
// (-∞, +∞)
if self.start.is_sign_negative() && self.end.is_sign_positive() {
Expand All @@ -26,12 +25,10 @@ impl Interval {
return 0.0;
}


if start_inf || end_inf {
return f64::INFINITY;
}


(self.end - self.start).max(0.0)
}

Expand Down
46 changes: 28 additions & 18 deletions egui_plot/src/items/tooltip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
//! - Series highlighting currently matches by **series name**. Prefer unique names.

use egui::{
self, Align2, Area, Color32, Frame, Grid, Id, Key, Order, Pos2, Rect, RichText, Stroke,
TextStyle,
self, Align2, Area, Color32, Frame, Grid, Id, Order, Pos2, Rect, RichText, Stroke, TextStyle,
};

use crate::{PlotPoint, PlotUi, items::PlotGeometry};
Expand Down Expand Up @@ -193,6 +192,7 @@ impl PlotUi<'_> {
let transform = self.transform().clone();
let frame = transform.frame();

let nav = *self.navigation_config();
// Draw existing pins (rails + markers) on a foreground layer:
let mut pins = load_pins(&ctx, self.response.id);
draw_pins_overlay(
Expand Down Expand Up @@ -391,13 +391,17 @@ impl PlotUi<'_> {
}

if hits.is_empty() {
if self.response.hovered() {
if self.response.hovered() && nav.pinning_enabled {
ctx.input(|i| {
if i.key_pressed(Key::U) {
pins.pop();
if let Some(k) = nav.pin_remove_key {
if i.key_pressed(k) {
pins.pop();
}
}
if i.key_pressed(Key::Delete) {
pins.clear();
if let Some(k) = nav.pins_clear_key {
if i.key_pressed(k) {
pins.clear();
}
}
});
save_pins(&ctx, self.response.id, pins);
Expand All @@ -422,20 +426,26 @@ impl PlotUi<'_> {
}
}

if self.response.hovered() {
if self.response.hovered() && nav.pinning_enabled {
ctx.input(|i| {
if i.key_pressed(Key::P) {
let pointer_plot = transform.value_from_position(pointer_screen);
pins.push(PinnedPoints {
hits: hits.clone(),
plot_x: pointer_plot.x,
});
if let Some(k) = nav.pin_add_key {
if i.key_pressed(k) {
let pointer_plot = transform.value_from_position(pointer_screen);
pins.push(PinnedPoints {
hits: hits.clone(),
plot_x: pointer_plot.x,
});
}
}
if i.key_pressed(Key::U) {
pins.pop();
if let Some(k) = nav.pin_remove_key {
if i.key_pressed(k) {
pins.pop();
}
}
if i.key_pressed(Key::Delete) {
pins.clear();
if let Some(k) = nav.pins_clear_key {
if i.key_pressed(k) {
pins.clear();
}
}
});
save_pins(&ctx, self.response.id, pins.clone());
Expand Down
Loading
Loading