Skip to content

Commit

Permalink
pass response to Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
podusowski committed Nov 21, 2023
1 parent 7b47238 commit f72071f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions demo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use egui::{Color32, Context, Painter};
use egui::{Color32, Context, Painter, Response};
use walkers::{
extras::{Image, Images, Place, Places, Style, Texture},
Map, MapMemory, Plugin, Projector, Tiles,
Expand Down Expand Up @@ -143,7 +143,7 @@ mod places {
struct CustomShapes {}

impl Plugin for CustomShapes {
fn draw(&self, painter: Painter, projector: &Projector) {
fn draw(&self, _response: &Response, painter: Painter, projector: &Projector) {
// Position of the point we want to put our shapes.
let position = places::capitol();

Expand Down
4 changes: 2 additions & 2 deletions walkers/src/extras/images.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::tiles::Texture;
use crate::{Plugin, Position};
use egui::epaint::emath::Rot2;
use egui::{Rect, Vec2};
use egui::{Painter, Rect, Response, Vec2};

/// An image to be drawn on the map.
pub struct Image {
Expand Down Expand Up @@ -47,7 +47,7 @@ impl Images {
}

impl Plugin for Images {
fn draw(&self, painter: egui::Painter, projector: &crate::Projector) {
fn draw(&self, _response: &Response, painter: Painter, projector: &crate::Projector) {
for image in &self.images {
let rect = Rect::from_center_size(
projector.project(image.position).to_pos2(),
Expand Down
4 changes: 2 additions & 2 deletions walkers/src/extras/places.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use egui::{vec2, Align2, Color32, FontId, Stroke};
use egui::{vec2, Align2, Color32, FontId, Painter, Response, Stroke};

use crate::{Plugin, Position};

Expand Down Expand Up @@ -56,7 +56,7 @@ impl Places {
}

impl Plugin for Places {
fn draw(&self, painter: egui::Painter, projector: &crate::Projector) {
fn draw(&self, _response: &Response, painter: Painter, projector: &crate::Projector) {
for place in &self.places {
let screen_position = projector.project(place.position);

Expand Down
4 changes: 2 additions & 2 deletions walkers/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
/// you can add it to the map with [`Map::with_plugin`]
pub trait Plugin {
/// Function called at each frame.
fn draw(&self, painter: Painter, projector: &Projector);
fn draw(&self, response: &Response, painter: Painter, projector: &Projector);
}

/// The actual map widget. Instances are to be created on each frame, as all necessary state is
Expand Down Expand Up @@ -171,7 +171,7 @@ impl Widget for Map<'_, '_> {
my_position: self.my_position,
};

plugin.draw(painter.to_owned(), &projector);
plugin.draw(&response, painter.to_owned(), &projector);
}

response
Expand Down

0 comments on commit f72071f

Please sign in to comment.