diff --git a/docs/example_wasm_bg.wasm b/docs/example_wasm_bg.wasm index 6e75f2f5..dee00d47 100644 Binary files a/docs/example_wasm_bg.wasm and b/docs/example_wasm_bg.wasm differ diff --git a/docs/index.html b/docs/index.html index c42ceb74..9a4070ad 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16,12 +16,15 @@ } body { - background: #000000; + background: #101010; } + /* Allow canvas to fill entire web page: */ html, body { overflow: hidden; + margin: 0 !important; + padding: 0 !important; } @@ -80,12 +83,11 @@ // ---------------------------------------------------------------------------- var g_mouse_pos = null; var g_mouse_down = false; - var g_is_touch = false; + var g_is_touch = false; // we don't know yet var g_scroll_delta_x = 0; var g_scroll_delta_y = 0; function pixels_per_point() { - // return 1.0; return window.devicePixelRatio || 1.0; } @@ -218,7 +220,7 @@ paint_and_schedule(); } - + diff --git a/emigui/src/types.rs b/emigui/src/types.rs index 841d7ea1..ccd44d24 100644 --- a/emigui/src/types.rs +++ b/emigui/src/types.rs @@ -46,6 +46,7 @@ pub struct GuiInput { pub mouse_released: bool, /// Current position of the mouse in points. + /// None for touch screens when finger is not down. pub mouse_pos: Option, /// How much the mouse moved compared to last frame, in points. @@ -71,7 +72,7 @@ impl GuiInput { .and_then(|new| last.mouse_pos.map(|last| new - last)) .unwrap_or_default(); GuiInput { - mouse_down: new.mouse_down, + mouse_down: new.mouse_down && new.mouse_pos.is_some(), mouse_pressed: !last.mouse_down && new.mouse_down, mouse_released: last.mouse_down && !new.mouse_down, mouse_pos: new.mouse_pos, diff --git a/example_wasm/src/lib.rs b/example_wasm/src/lib.rs index ce5a1dc9..31a9a69b 100644 --- a/example_wasm/src/lib.rs +++ b/example_wasm/src/lib.rs @@ -91,7 +91,7 @@ impl State { self.emigui.ui(region); }); - let bg_color = srgba(16, 16, 16, 255); + let bg_color = srgba(0, 0, 0, 0); // Use background css color. let (output, batches) = self.emigui.end_frame(); self.webgl_painter.paint_batches( bg_color,