Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: with touch pad guesters & zooming #200

Open
LiamPClancy opened this issue Aug 11, 2023 · 0 comments
Open

Question: with touch pad guesters & zooming #200

LiamPClancy opened this issue Aug 11, 2023 · 0 comments

Comments

@LiamPClancy
Copy link

Hi and thank you so much for the crate,
just starting to get my head around it, i've been learning egui and have a few things working but would like to use the bevy ecs - so thought this crate might allow me to rework what I have in that context.

The issue i'm having is

  1. can't really zoom on the egui Plot in the wasm build.
    the native build on mac allows for zoom using the cmd and touchpad, but when I try this on the web build the zoom is not restricted to the plot, the whole interface zooms.
    is there any way to prevent the zoom event from propagating to the rest of the interface on the web build?

  2. panning to the left and right on the web is triggering browser gestures, so triggering back and forward navigation - I think it's the same question about stopping touch events propagating above the plot.

also understand that propagation is probably not the correct work given bevy_egui is translating the bevy input to egui input, but hopefully the question is clear.

  1. any chance of getting pinch to zoom working, I notice that the bevy code have magnification and rotation from the touch-pad - but says it's restricted to mac, can live without it but thought i'd ask if it's even possible.

an example of the code that's i'm seeing the issues about in looks like

`impl Plugin for ExamplePlugin {
fn build(&self, app: &mut App) {
app
.add_systems(Update, show_legacy_pattern);
}
}

pub (crate) fn show_legacy_pattern(
mut egui_ctx: EguiContexts,
){

bevy_egui::egui::CentralPanel::default().show(egui_ctx.ctx_mut(), |ui| {
    ui.label("stuff to show zoom");
    ui.button("some button");
    let plot = Plot::new("pattern maker plot drawing")
        //.legend(Legend::default().position(Corner::RightBottom))
        .show_x(true) //shows the marker lines from the cursor
        .show_y(true) //shows the marker lines from the cursor
        .data_aspect(1.0)
        .allow_zoom(true) //(self.drawing_tool_toolbar.drawing_tool == pm_models::DrawingToolKind::Select)
        .allow_drag(true)
        .allow_scroll(true)
        .show_axes([true, true]);
        //.x_axis_formatter(my_x_axis_formatter)
        //.y_axis_formatter(my_y_axis_formatter);
        //.clamp_grid(clamp_grid)
        //.include_x(0.0);
        
        //let response : Response;
        let res = plot.show(ui, |plot_ui| {
            //build out the instructions from the pattern, adding the points and lines as required. 
            //adjust ponit poisitions based on current drag details. 
        });
        //response
});

}`

have an example app to demonstrate the functionality https://github.com/learnplaycreate/bevy_egui_touch_examples

appreciate the help,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant