mouseover make the plot to zoom in improperly

未关闭
#143 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

  • #144 来自 @bombless —— 已关闭,未合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust

调研方向

先运行链接的 egui_plot-mousover-test 复现程序或 Rust 代码示例。然后,围绕 plot 文本示例跟踪 egui_plot 的鼠标交互和缩放处理;完成的标准是,将鼠标移到 plot 上不再改变其视觉边界或缩放级别。

由索引模型根据 Issue 内容生成。

描述

bug

Describe the bug
A simple egui_plot app will zoom in improperly when you move your mouse

To Reproduce
Steps to reproduce the behavior:
git-checkout the repo
or just use the code below

use eframe::egui;
use egui_plot::{Plot, PlotPoint, Text as PlotText};

fn main() {
    let app = App;

    let native_options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default()
            .with_inner_size([1280.0, 800.0])
            .with_title("mouseover test"),
        ..Default::default()
    };

    eframe::run_native("test", native_options, Box::new(|_cc| Ok(Box::new(app)))).unwrap();
}

struct App;

impl eframe::App for App {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        egui::CentralPanel::default().show(ctx, |ui| {
            let plot = Plot::new("test")
                .allow_scroll(true)
                .allow_zoom(true)
                .allow_boxed_zoom(true)
                .allow_drag(true)
                .include_x(0.0)
                .include_x(0.1);

            plot.show(ui, |plot_ui| {
                let bounds = plot_ui.plot_bounds();
                let val = bounds.min()[0];
                plot_ui.text(PlotText::new(
                    "",
                    PlotPoint { x: val, y: 0.0 },
                    val.to_string(),
                ));
            });
        });
    }
}

Expected behavior
Moving your mouse won't make the plot zoom in, it should remain the same visual appearance without changing.

Screenshots

https://github.com/user-attachments/assets/9862035e-feb4-4e1d-81ee-f56cac4dc22e

Additional context
None.

主要语言
Rust
星标
494
派生
110
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

emilk/egui_plot 的其他 Issue

查看 emilk/egui_plot 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。