From bc3012e2c85e4615f693d4f428d7c2db02fb9eda Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 2 Feb 2026 21:52:29 +0000 Subject: [PATCH] Started transition to allow building with WASM --- index.html | 149 +++++++++++++++++++++++++++++++++++++++++++++ src/rope_editor.rs | 13 +++- 2 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..9249338 --- /dev/null +++ b/index.html @@ -0,0 +1,149 @@ + + + + + + + + + + eframe template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

+ Loading… +

+
+
+ + + + + + + + + \ No newline at end of file diff --git a/src/rope_editor.rs b/src/rope_editor.rs index bdc3067..27ebbec 100644 --- a/src/rope_editor.rs +++ b/src/rope_editor.rs @@ -1,6 +1,6 @@ -use std::borrow::Cow; +use std::{borrow::Cow, sync::Arc}; -use eframe::egui::{self, Align2, NumExt, Rect, Sense, TextStyle, Ui, Vec2, pos2, text_edit::TextCursorState}; +use eframe::egui::{self, Align2, FontId, Galley, NumExt, Rect, Sense, TextBuffer, TextStyle, Ui, Vec2, pos2, text::LayoutJob, text_edit::TextCursorState}; use ropey::Rope; #[derive(Default)] @@ -51,4 +51,13 @@ impl RopeEdit { fn show_content() -> () { //let desired_height = () } +} + +fn implement(ui: &Ui, text: &dyn TextBuffer, wrap_width: f32, font_id_clone: FontId, text_color: egui::Color32 ) -> Arc { + let layouter = move |ui: &Ui, text: &dyn TextBuffer, wrap_width: f32| { + let layout_job = LayoutJob::simple(text.as_str().to_owned(), font_id_clone.clone(), text_color, wrap_width); + ui.fonts_mut(|f| f.layout_job(layout_job)) + }; + + layouter(ui, text, wrap_width) } \ No newline at end of file