Compare commits
2 Commits
all-fonts
...
a91cafa74a
| Author | SHA1 | Date | |
|---|---|---|---|
|
a91cafa74a
|
|||
|
64642b404d
|
@ -1,2 +0,0 @@
|
|||||||
[target.wasm32-unknown-unknown]
|
|
||||||
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']
|
|
||||||
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -953,11 +953,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
|
checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"js-sys",
|
|
||||||
"libc",
|
"libc",
|
||||||
"r-efi",
|
"r-efi",
|
||||||
"wasi 0.14.2+wasi-0.2.4",
|
"wasi 0.14.2+wasi-0.2.4",
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1352,7 +1350,6 @@ dependencies = [
|
|||||||
"egui_glow 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"egui_glow 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"eyre",
|
"eyre",
|
||||||
"getrandom 0.3.2",
|
|
||||||
"half",
|
"half",
|
||||||
"insta",
|
"insta",
|
||||||
"log",
|
"log",
|
||||||
@ -1360,7 +1357,6 @@ dependencies = [
|
|||||||
"rfd",
|
"rfd",
|
||||||
"serde",
|
"serde",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"web-sys",
|
|
||||||
"zerocopy 0.8.25",
|
"zerocopy 0.8.25",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -30,12 +30,9 @@ base64 = "0.22.1"
|
|||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
env_logger = "0.11.8"
|
env_logger = "0.11.8"
|
||||||
rand = "0.9.1"
|
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
getrandom = { version = "0.3", features = ["wasm_js"] }
|
|
||||||
wasm-bindgen-futures = "0.4.50"
|
wasm-bindgen-futures = "0.4.50"
|
||||||
web-sys = "0.3.77"
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
egui = { git = "https://github.com/emilk/egui", rev = "f2ce6424f3a32f47308fb9871d540c01377b2cd9" }
|
egui = { git = "https://github.com/emilk/egui", rev = "f2ce6424f3a32f47308fb9871d540c01377b2cd9" }
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,6 +2,7 @@ use std::{
|
|||||||
fs,
|
fs,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
sync::{Arc, mpsc},
|
sync::{Arc, mpsc},
|
||||||
|
thread,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{file_editor::FileEditor, preferences::Preferences, util::GuiSender};
|
use crate::{file_editor::FileEditor, preferences::Preferences, util::GuiSender};
|
||||||
@ -203,10 +204,9 @@ impl eframe::App for App {
|
|||||||
self.open_tab(Tab::File(file));
|
self.open_tab(Tab::File(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
if ui.button("Open File").clicked() {
|
if ui.button("Open File").clicked() {
|
||||||
let actions_tx = self.actions_tx(ui.ctx());
|
let actions_tx = self.actions_tx(ui.ctx());
|
||||||
std::thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let file = rfd::FileDialog::new().pick_file();
|
let file = rfd::FileDialog::new().pick_file();
|
||||||
|
|
||||||
let Some(file_path) = file else { return };
|
let Some(file_path) = file else { return };
|
||||||
@ -263,7 +263,6 @@ impl eframe::App for App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
if ui
|
if ui
|
||||||
.add_enabled(open_file.is_some(), Button::new("Save As"))
|
.add_enabled(open_file.is_some(), Button::new("Save As"))
|
||||||
.clicked()
|
.clicked()
|
||||||
|
|||||||
@ -49,7 +49,7 @@ fn main() {
|
|||||||
.start(
|
.start(
|
||||||
canvas,
|
canvas,
|
||||||
web_options,
|
web_options,
|
||||||
Box::new(|cc| Ok(Box::new(inkr::App::new(cc)))),
|
Box::new(|cc| Ok(Box::new(eframe_template::TemplateApp::new(cc)))),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ use std::{
|
|||||||
iter, mem,
|
iter, mem,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
use base64::{Engine, prelude::BASE64_STANDARD};
|
use base64::{Engine, prelude::BASE64_STANDARD};
|
||||||
@ -435,8 +436,7 @@ impl Handwriting {
|
|||||||
|
|
||||||
self.refresh_texture = false;
|
self.refresh_texture = false;
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
let start_time = Instant::now();
|
||||||
let start_time = std::time::Instant::now();
|
|
||||||
|
|
||||||
let mut tesselator = Tessellator::new(
|
let mut tesselator = Tessellator::new(
|
||||||
mesh_context.pixels_per_point,
|
mesh_context.pixels_per_point,
|
||||||
@ -468,12 +468,9 @@ impl Handwriting {
|
|||||||
self.image = rasterize::<StrokeBlendMode>(px_x, px_y, point_to_pixel, triangles);
|
self.image = rasterize::<StrokeBlendMode>(px_x, px_y, point_to_pixel, triangles);
|
||||||
texture.set(self.image.clone(), Default::default());
|
texture.set(self.image.clone(), Default::default());
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
{
|
|
||||||
let elapsed = start_time.elapsed();
|
let elapsed = start_time.elapsed();
|
||||||
println!("refreshed mesh in {:.3}s", elapsed.as_secs_f32());
|
println!("refreshed mesh in {:.3}s", elapsed.as_secs_f32());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pub fn ui(&mut self, style: &HandwritingStyle, ui: &mut Ui) {
|
pub fn ui(&mut self, style: &HandwritingStyle, ui: &mut Ui) {
|
||||||
ui.vertical_centered_justified(|ui| {
|
ui.vertical_centered_justified(|ui| {
|
||||||
|
|||||||
Reference in New Issue
Block a user