[web] fix: repaint on pagehide, pageshow and resize
This commit is contained in:
parent
cb6b3bb58f
commit
6b6545958d
4 changed files with 27 additions and 21 deletions
|
@ -207,12 +207,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|||
real.original = state;
|
||||
return real;
|
||||
}
|
||||
function __wbg_adapter_26(arg0, arg1, arg2) {
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h22fd33d9f501a695(arg0, arg1, addHeapObject(arg2));
|
||||
function __wbg_adapter_26(arg0, arg1) {
|
||||
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h84da5f062b972f09(arg0, arg1);
|
||||
}
|
||||
|
||||
function __wbg_adapter_29(arg0, arg1) {
|
||||
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h84da5f062b972f09(arg0, arg1);
|
||||
function __wbg_adapter_29(arg0, arg1, arg2) {
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h22fd33d9f501a695(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
function __wbg_adapter_32(arg0, arg1, arg2) {
|
||||
|
@ -725,28 +725,28 @@ async function init(input) {
|
|||
var ret = wasm.memory;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper387 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 74, __wbg_adapter_26);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper383 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 74, __wbg_adapter_32);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper380 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 74, __wbg_adapter_38);
|
||||
imports.wbg.__wbindgen_closure_wrapper381 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_35);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper385 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 74, __wbg_adapter_29);
|
||||
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_38);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper382 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_41);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper387 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_26);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper389 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 74, __wbg_adapter_41);
|
||||
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_29);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper379 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 74, __wbg_adapter_35);
|
||||
imports.wbg.__wbindgen_closure_wrapper391 = function(arg0, arg1, arg2) {
|
||||
var ret = makeMutClosure(arg0, arg1, 76, __wbg_adapter_32);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
|
||||
|
|
Binary file not shown.
|
@ -293,7 +293,11 @@ impl Context {
|
|||
/// If false, the mouse is outside of any Egui area and so
|
||||
/// you may be interested in what it is doing (e.g. controlling your game).
|
||||
pub fn wants_mouse_input(&self) -> bool {
|
||||
self.is_mouse_over_area() || self.memory().interaction.is_using_mouse()
|
||||
self.is_mouse_over_area() || self.is_using_mouse()
|
||||
}
|
||||
|
||||
pub fn is_using_mouse(&self) -> bool {
|
||||
self.memory().interaction.is_using_mouse()
|
||||
}
|
||||
|
||||
/// If true, Egui is currently listening on text input (e.g. typing text in a `TextEdit`).
|
||||
|
|
|
@ -69,6 +69,7 @@ impl Backend {
|
|||
self.painter.canvas_id()
|
||||
}
|
||||
|
||||
/// Returns a master fullscreen UI, covering the entire screen.
|
||||
pub fn begin_frame(&mut self, raw_input: egui::RawInput) -> egui::Ui {
|
||||
self.frame_start = Some(now_sec());
|
||||
self.ctx.begin_frame(raw_input)
|
||||
|
@ -436,7 +437,8 @@ fn paint_and_schedule(runner_ref: AppRunnerRef) -> Result<(), JsValue> {
|
|||
|
||||
fn install_document_events(runner_ref: &AppRunnerRef) -> Result<(), JsValue> {
|
||||
use wasm_bindgen::JsCast;
|
||||
let document = web_sys::window().unwrap().document().unwrap();
|
||||
let window = web_sys::window().unwrap();
|
||||
let document = window.document().unwrap();
|
||||
|
||||
{
|
||||
// keydown
|
||||
|
@ -481,7 +483,7 @@ fn install_document_events(runner_ref: &AppRunnerRef) -> Result<(), JsValue> {
|
|||
let closure = Closure::wrap(Box::new(move || {
|
||||
runner_ref.0.lock().needs_repaint = true;
|
||||
}) as Box<dyn FnMut()>);
|
||||
document.add_event_listener_with_callback(event_name, closure.as_ref().unchecked_ref())?;
|
||||
window.add_event_listener_with_callback(event_name, closure.as_ref().unchecked_ref())?;
|
||||
closure.forget();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue