@@ -106,18 +106,14 @@ impl eframe::App for TemplateApp {
106
106
// dunno where this is placed, which coordinate system this uses etc.
107
107
// But when combined with sensing a drag_and_drop this SHOULD provide me with enough info to find
108
108
// the gauss center (if any) that drags correspond to.
109
- let start_loc =
110
- ui. input ( |input_state| input_state. pointer . press_origin ( ) ) ;
111
-
112
- let start_loc2 =
113
- ui. input ( |input_state| input_state. pointer . interact_pos ( ) ) ;
109
+ let ( start_loc, current_loc) =
110
+ ui. input ( |input_state| ( input_state. pointer . press_origin ( ) , input_state. pointer . interact_pos ( ) ) ) ;
114
111
115
112
// this doesnt seem to hold to what the documentation promises.
116
113
// documentation promises this is the delta for each frame, but it behaves as I'd expect if it were the total delta.
117
114
// let frame_delta = ui.input(|input_state| input_state.pointer.delta());
118
115
// cc.egui_ctx.wants_pointer_input()
119
116
120
- let painter = ui. painter ( ) ;
121
117
// let delta = if _response.dragged() {
122
118
// // _response.drag_delta()
123
119
// canvas_coord_to_ndc(frame_delta.to_pos2(), rect).to_vec2()
@@ -131,7 +127,7 @@ impl eframe::App for TemplateApp {
131
127
if _response. dragged ( ) {
132
128
ele. position = canvas_coord_to_ndc (
133
129
Pos2 :: from ( ele. position )
134
- + ( start_loc2 . unwrap ( ) . to_vec2 ( )
130
+ + ( current_loc . unwrap ( ) . to_vec2 ( )
135
131
- start_loc. unwrap ( ) . to_vec2 ( ) ) ,
136
132
rect,
137
133
)
@@ -144,19 +140,6 @@ impl eframe::App for TemplateApp {
144
140
egui:: Color32 :: RED ,
145
141
) ;
146
142
}
147
-
148
- // response.
149
-
150
- // do dragndrop with the centers of the gaussians aka
151
- // (this is ironically from the wgpu render demo, I originally stripped it out):
152
- // let (rect, response) =
153
- // ui.allocate_exact_size(egui::Vec2::splat(300.0), egui::Sense::drag());
154
-
155
- // self.angle += response.drag_motion().x * 0.01;
156
- // ui.painter().add(egui_wgpu::Callback::new_paint_callback(
157
- // rect,
158
- // CustomTriangleCallback { angle: self.angle },
159
- // ));
160
143
}
161
144
} ) ;
162
145
} ) ;
0 commit comments