This commit is contained in:
Simon Gardling 2022-05-25 11:03:45 -04:00
parent d7b88c0136
commit b025371ff6
5 changed files with 2 additions and 33 deletions

2
Cargo.lock generated
View File

@ -1640,7 +1640,6 @@ name = "parsing"
version = "0.1.0"
dependencies = [
"exmex",
"lazy_static",
"phf",
"phf_codegen",
]
@ -2793,7 +2792,6 @@ dependencies = [
"getrandom",
"instant",
"itertools",
"lazy_static",
"parsing",
"rayon",
"run_script",

View File

@ -48,7 +48,6 @@ emath = { git = "https://github.com/Titaniumtown/egui.git", default-features = f
shadow-rs = { version = "0.11", default-features = false }
const_format = { version = "0.2", default-features = false, features = ["fmt"] }
cfg-if = "1"
lazy_static = "1"
ruzstd = { git = "https://github.com/Titaniumtown/zstd-rs.git", branch = "ringbuffer" }
tracing = "0.1"
itertools = "0.10"

View File

@ -14,7 +14,6 @@ phf = { version = "0.10", no-default-features = true }
exmex = { git = "https://github.com/bertiqwerty/exmex.git", branch = "main", features = [
"partial",
] }
lazy_static = "1.4"
[build-dependencies]
phf_codegen = { version = "0.10", no-default-features = true }

View File

@ -50,25 +50,3 @@ pub const COLORS: [Color32; 13] = [
];
const_assert!(!COLORS.is_empty());
#[cfg(target_arch = "wasm32")]
lazy_static::lazy_static! {
static ref IS_MOBILE: bool = {
// from https://github.com/emilk/egui/blob/fda8189cbab18e0acab8db972400e4a4ca0d915e/egui_web/src/text_agent.rs#L194
fn is_mobile() -> Option<bool> {
const MOBILE_DEVICE: [&str; 6] = ["Android", "iPhone", "iPad", "iPod", "webOS", "BlackBerry"];
let user_agent = web_sys::window()?.navigator().user_agent().ok()?;
Some(MOBILE_DEVICE.iter().any(|&name| user_agent.contains(name)))
}
is_mobile().unwrap_or_default()
};
}
#[inline]
#[cfg(target_arch = "wasm32")]
pub fn is_mobile() -> bool { return *IS_MOBILE; }
#[cfg(not(target_arch = "wasm32"))]
pub const fn is_mobile() -> bool { false }

View File

@ -1,4 +1,3 @@
use crate::consts::is_mobile;
use crate::function_entry::FunctionEntry;
use crate::misc::random_u64;
use crate::widgets::widgets_ontop;
@ -109,7 +108,7 @@ impl FunctionManager {
function.autocomplete.update_string(&new_string);
if function.autocomplete.hint.is_some() {
if !function.autocomplete.hint.is_single() && !is_mobile() {
if !function.autocomplete.hint.is_single() {
if ui.input().key_pressed(Key::ArrowDown) {
movement = Movement::Down;
} else if ui.input().key_pressed(Key::ArrowUp) {
@ -118,11 +117,7 @@ impl FunctionManager {
}
// Put here so these key presses don't interact with other elements
let enter_pressed = match is_mobile() {
true => false,
false => ui.input_mut().consume_key(Modifiers::NONE, Key::Enter),
};
let enter_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Enter);
let tab_pressed = ui.input_mut().consume_key(Modifiers::NONE, Key::Tab);
if enter_pressed | tab_pressed | ui.input().key_pressed(Key::ArrowRight) {
movement = Movement::Complete;