Fixed a major bug and now use the same cursor paint logic as the editor

This commit is contained in:
Mikayla Maki
2022-06-30 20:43:51 -07:00
parent 64d3dc32d2
commit ae836e1465
2 changed files with 50 additions and 20 deletions
+20 -2
View File
@@ -1630,7 +1630,7 @@ impl Default for CursorShape {
}
}
struct Cursor {
pub struct Cursor {
origin: Vector2F,
block_width: f32,
line_height: f32,
@@ -1640,7 +1640,25 @@ struct Cursor {
}
impl Cursor {
fn paint(&self, cx: &mut PaintContext) {
pub fn new(
origin: Vector2F,
block_width: f32,
line_height: f32,
color: Color,
shape: CursorShape,
block_text: Option<Line>,
) -> Cursor {
Cursor {
origin,
block_width,
line_height,
color,
shape,
block_text,
}
}
pub fn paint(&self, cx: &mut PaintContext) {
let bounds = match self.shape {
CursorShape::Bar => RectF::new(self.origin, vec2f(2.0, self.line_height)),
CursorShape::Block => {