Pointer hand on hover
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
480bdbbf1d
commit
2fb2cd59a9
1 changed files with 26 additions and 19 deletions
45
src/app.rs
45
src/app.rs
|
@ -638,27 +638,31 @@ impl eframe::App for Portfolio {
|
|||
let mut buffer = buffer.write();
|
||||
let mut editor =
|
||||
Editor::new(BufferRef::Borrowed(buffer.deref_mut()));
|
||||
// if text_response.hovered()
|
||||
// && ui.input(|i| i.raw_scroll_delta == Vec2::ZERO)
|
||||
// {
|
||||
// let mouse_pos = ui
|
||||
// .input(|i| i.pointer.latest_pos().unwrap_or_default())
|
||||
// - text_rect.min.to_vec2();
|
||||
if text_response.hovered()
|
||||
&& ui.input(|i| i.raw_scroll_delta == Vec2::ZERO)
|
||||
{
|
||||
let mouse_pos = ui
|
||||
.input(|i| i.pointer.latest_pos().unwrap_or_default())
|
||||
- text_rect.min.to_vec2();
|
||||
|
||||
// editor.action(
|
||||
// self.font_system.lock().deref_mut(),
|
||||
// glyphon::Action::Click {
|
||||
// x: mouse_pos.x as i32,
|
||||
// y: mouse_pos.y as i32 - 3,
|
||||
// },
|
||||
// );
|
||||
editor.action(
|
||||
self.font_system.lock().deref_mut(),
|
||||
glyphon::Action::Click {
|
||||
x: mouse_pos.x as i32,
|
||||
y: mouse_pos.y as i32 - 3,
|
||||
},
|
||||
);
|
||||
|
||||
// let mut location = editor.cursor();
|
||||
// match location.affinity {
|
||||
// glyphon::Affinity::After => location.index += 1,
|
||||
// glyphon::Affinity::Before => {}
|
||||
// }
|
||||
// }
|
||||
let mut location = editor.cursor();
|
||||
match location.affinity {
|
||||
glyphon::Affinity::After => location.index += 1,
|
||||
glyphon::Affinity::Before => {}
|
||||
}
|
||||
|
||||
if url_map.get(location.index).is_some() {
|
||||
ctx.set_cursor_icon(egui::CursorIcon::PointingHand);
|
||||
}
|
||||
}
|
||||
if text_response.clicked() && !self.image_zoomed {
|
||||
let mouse_click = ui.input(|i| {
|
||||
i.pointer.interact_pos().unwrap_or_default()
|
||||
|
@ -927,6 +931,9 @@ impl eframe::App for Portfolio {
|
|||
scroll_area.state.store(ui.ctx(), scroll_area.id);
|
||||
}
|
||||
self.hover(hovered, ui);
|
||||
if self.hovered {
|
||||
ctx.set_cursor_icon(egui::CursorIcon::PointingHand);
|
||||
}
|
||||
ui.painter().add(egui_wgpu::Callback::new_paint_callback(
|
||||
ui.max_rect(),
|
||||
GlyphonRendererCallback { buffers },
|
||||
|
|
Loading…
Reference in a new issue