Skip to content

Commit

Permalink
cursors initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Feb 1, 2024
1 parent 8177b11 commit f3af862
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 514 deletions.
31 changes: 31 additions & 0 deletions sugarloaf/src/components/rich_text/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub use crate::components::rich_text::batch::{
pub use crate::components::rich_text::image_cache::{
AddImage, Epoch, ImageData, ImageId, ImageLocation, TextureEvent, TextureId,
};
use crate::core::SugarCursorStyle;

use crate::components::rich_text::batch::BatchManager;
use crate::components::rich_text::image_cache::{GlyphCache, ImageCache};
Expand Down Expand Up @@ -166,6 +167,36 @@ impl Compositor {
);
}

if let Some(cursor) = style.cursor {
match cursor.style {
SugarCursorStyle::Block => {
self.batches.add_rect(
&Rect::new(
rect.x,
style.topline,
rect.width,
style.line_height,
),
depth - 1.0,
&cursor.color,
);
}
SugarCursorStyle::Caret => {
self.batches.add_rect(
&Rect::new(
rect.x,
style.topline,
3.0,
style.line_height,
),
depth - 1.0,
&cursor.color,
);
}
_ => {}
}
}

if underline {
if entry.top - underline_offset < entry.height as i32 {
if let Some(mut desc_ink) = entry.desc.range() {
Expand Down
223 changes: 0 additions & 223 deletions sugarloaf/src/components/rich_text/gfx/device.rs

This file was deleted.

19 changes: 0 additions & 19 deletions sugarloaf/src/components/rich_text/gfx/gl.rs

This file was deleted.

Loading

0 comments on commit f3af862

Please sign in to comment.