Revert "Add `OutputCommand::SetPointerPosition` to set mouse position" (#5867)
Reverts emilk/egui#5776 I noticed that this is already a `ViewportCommand`. Sorry for not seeing that earlier.
This commit is contained in:
parent
cd318f0e55
commit
61e883be25
|
|
@ -336,9 +336,6 @@ impl AppRunner {
|
|||
egui::OutputCommand::OpenUrl(open_url) => {
|
||||
super::open_url(&open_url.url, open_url.new_tab);
|
||||
}
|
||||
egui::OutputCommand::SetPointerPosition(_) => {
|
||||
// Not supported on the web.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -856,9 +856,6 @@ impl State {
|
|||
egui::OutputCommand::OpenUrl(open_url) => {
|
||||
open_url_in_browser(&open_url.url);
|
||||
}
|
||||
egui::OutputCommand::SetPointerPosition(egui::Pos2 { x, y }) => {
|
||||
let _ = window.set_cursor_position(winit::dpi::LogicalPosition { x, y });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1494,11 +1494,6 @@ impl Context {
|
|||
self.send_cmd(crate::OutputCommand::CopyImage(image));
|
||||
}
|
||||
|
||||
/// Set the mouse cursor position (if the platform supports it).
|
||||
pub fn set_pointer_position(&self, position: Pos2) {
|
||||
self.send_cmd(crate::OutputCommand::SetPointerPosition(position));
|
||||
}
|
||||
|
||||
/// Format the given shortcut in a human-readable way (e.g. `Ctrl+Shift+X`).
|
||||
///
|
||||
/// Can be used to get the text for [`crate::Button::shortcut_text`].
|
||||
|
|
|
|||
|
|
@ -95,9 +95,6 @@ pub enum OutputCommand {
|
|||
|
||||
/// Open this url in a browser.
|
||||
OpenUrl(OpenUrl),
|
||||
|
||||
/// Set the mouse cursor position (if the platform supports it).
|
||||
SetPointerPosition(emath::Pos2),
|
||||
}
|
||||
|
||||
/// The non-rendering part of what egui emits each frame.
|
||||
|
|
|
|||
|
|
@ -16,14 +16,6 @@ impl crate::Demo for CursorTest {
|
|||
|
||||
impl crate::View for CursorTest {
|
||||
fn ui(&mut self, ui: &mut egui::Ui) {
|
||||
if ui
|
||||
.button("Center pointer in window")
|
||||
.on_hover_text("The platform may not support this.")
|
||||
.clicked()
|
||||
{
|
||||
let position = ui.ctx().available_rect().center();
|
||||
ui.ctx().set_pointer_position(position);
|
||||
}
|
||||
ui.vertical_centered_justified(|ui| {
|
||||
ui.heading("Hover to switch cursor icon:");
|
||||
for &cursor_icon in &egui::CursorIcon::ALL {
|
||||
|
|
|
|||
Loading…
Reference in New Issue