mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Add some explanations for the safari copy/cut fix
This commit is contained in:
@@ -177,7 +177,9 @@ pub(crate) fn install_document_events(runner_ref: &WebRunner) -> Result<(), JsVa
|
|||||||
"cut",
|
"cut",
|
||||||
|event: web_sys::ClipboardEvent, runner| {
|
|event: web_sys::ClipboardEvent, runner| {
|
||||||
runner.input.raw.events.push(egui::Event::Cut);
|
runner.input.raw.events.push(egui::Event::Cut);
|
||||||
runner.logic();
|
// In Safari we are only allowed to write to the clipboard during the
|
||||||
|
// event callback, which is why we run the app logic here and now:
|
||||||
|
runner.logic(); // we ignore the returned triangles, but schedule a repaint right after
|
||||||
runner.needs_repaint.repaint_asap();
|
runner.needs_repaint.repaint_asap();
|
||||||
event.stop_propagation();
|
event.stop_propagation();
|
||||||
event.prevent_default();
|
event.prevent_default();
|
||||||
@@ -190,7 +192,9 @@ pub(crate) fn install_document_events(runner_ref: &WebRunner) -> Result<(), JsVa
|
|||||||
"copy",
|
"copy",
|
||||||
|event: web_sys::ClipboardEvent, runner| {
|
|event: web_sys::ClipboardEvent, runner| {
|
||||||
runner.input.raw.events.push(egui::Event::Copy);
|
runner.input.raw.events.push(egui::Event::Copy);
|
||||||
runner.logic();
|
// In Safari we are only allowed to write to the clipboard during the
|
||||||
|
// event callback, which is why we run the app logic here and now:
|
||||||
|
runner.logic(); // we ignore the returned triangles, but schedule a repaint right after
|
||||||
runner.needs_repaint.repaint_asap();
|
runner.needs_repaint.repaint_asap();
|
||||||
event.stop_propagation();
|
event.stop_propagation();
|
||||||
event.prevent_default();
|
event.prevent_default();
|
||||||
|
|||||||
Reference in New Issue
Block a user