|
|
@ -273,7 +273,7 @@ impl CursorRenderer {
|
|
|
|
let mut paint = Paint::new(skia_safe::colors::WHITE, None);
|
|
|
|
let mut paint = Paint::new(skia_safe::colors::WHITE, None);
|
|
|
|
paint.set_anti_alias(settings.antialiasing);
|
|
|
|
paint.set_anti_alias(settings.antialiasing);
|
|
|
|
|
|
|
|
|
|
|
|
let character = self.cursor.character.clone();
|
|
|
|
let character = self.cursor.grid_cell.0.clone();
|
|
|
|
|
|
|
|
|
|
|
|
let mut cursor_width = grid_renderer.font_dimensions.width;
|
|
|
|
let mut cursor_width = grid_renderer.font_dimensions.width;
|
|
|
|
if self.cursor.double_width && self.cursor.shape == CursorShape::Block {
|
|
|
|
if self.cursor.double_width && self.cursor.shape == CursorShape::Block {
|
|
|
@ -341,52 +341,58 @@ impl CursorRenderer {
|
|
|
|
self.previous_editor_mode = current_mode.clone();
|
|
|
|
self.previous_editor_mode = current_mode.clone();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if self.cursor.enabled && render {
|
|
|
|
if !(self.cursor.enabled && render) {
|
|
|
|
// Draw Background
|
|
|
|
return;
|
|
|
|
let background_color = self
|
|
|
|
}
|
|
|
|
.cursor
|
|
|
|
// Draw Background
|
|
|
|
.background(&grid_renderer.default_style.colors)
|
|
|
|
let background_color = self
|
|
|
|
.to_color();
|
|
|
|
.cursor
|
|
|
|
paint.set_color(background_color);
|
|
|
|
.background(&grid_renderer.default_style.colors)
|
|
|
|
|
|
|
|
.to_color();
|
|
|
|
// The cursor is made up of four points, so I create a path with each of the four
|
|
|
|
paint.set_color(background_color);
|
|
|
|
// corners.
|
|
|
|
|
|
|
|
let mut path = Path::new();
|
|
|
|
// The cursor is made up of four points, so I create a path with each of the four
|
|
|
|
|
|
|
|
// corners.
|
|
|
|
path.move_to(self.corners[0].current_position);
|
|
|
|
let mut path = Path::new();
|
|
|
|
path.line_to(self.corners[1].current_position);
|
|
|
|
|
|
|
|
path.line_to(self.corners[2].current_position);
|
|
|
|
path.move_to(self.corners[0].current_position);
|
|
|
|
path.line_to(self.corners[3].current_position);
|
|
|
|
path.line_to(self.corners[1].current_position);
|
|
|
|
path.close();
|
|
|
|
path.line_to(self.corners[2].current_position);
|
|
|
|
|
|
|
|
path.line_to(self.corners[3].current_position);
|
|
|
|
canvas.draw_path(&path, &paint);
|
|
|
|
path.close();
|
|
|
|
|
|
|
|
|
|
|
|
// Draw foreground
|
|
|
|
canvas.draw_path(&path, &paint);
|
|
|
|
let foreground_color = self
|
|
|
|
|
|
|
|
.cursor
|
|
|
|
// Draw foreground
|
|
|
|
.foreground(&grid_renderer.default_style.colors)
|
|
|
|
let foreground_color = self
|
|
|
|
.to_color();
|
|
|
|
.cursor
|
|
|
|
paint.set_color(foreground_color);
|
|
|
|
.foreground(&grid_renderer.default_style.colors)
|
|
|
|
|
|
|
|
.to_color();
|
|
|
|
canvas.save();
|
|
|
|
paint.set_color(foreground_color);
|
|
|
|
canvas.clip_path(&path, None, Some(false));
|
|
|
|
|
|
|
|
|
|
|
|
canvas.save();
|
|
|
|
let y_adjustment = grid_renderer.shaper.y_adjustment();
|
|
|
|
canvas.clip_path(&path, None, Some(false));
|
|
|
|
let blobs = &grid_renderer.shaper.shape_cached(character, false, false);
|
|
|
|
|
|
|
|
|
|
|
|
let y_adjustment = grid_renderer.shaper.y_adjustment();
|
|
|
|
for blob in blobs.iter() {
|
|
|
|
let style = &self.cursor.grid_cell.1;
|
|
|
|
canvas.draw_text_blob(
|
|
|
|
|
|
|
|
&blob,
|
|
|
|
let bold = style.as_ref().map(|x| x.bold).unwrap_or(false);
|
|
|
|
(self.destination.x, self.destination.y + y_adjustment as f32),
|
|
|
|
let italic = style.as_ref().map(|x| x.italic).unwrap_or(false);
|
|
|
|
&paint,
|
|
|
|
|
|
|
|
);
|
|
|
|
let blobs = &grid_renderer.shaper.shape_cached(character, bold, italic);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for blob in blobs.iter() {
|
|
|
|
|
|
|
|
canvas.draw_text_blob(
|
|
|
|
|
|
|
|
&blob,
|
|
|
|
|
|
|
|
(self.destination.x, self.destination.y + y_adjustment as f32),
|
|
|
|
|
|
|
|
&paint,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
canvas.restore();
|
|
|
|
canvas.restore();
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(vfx) = self.cursor_vfx.as_ref() {
|
|
|
|
if let Some(vfx) = self.cursor_vfx.as_ref() {
|
|
|
|
vfx.render(&settings, canvas, grid_renderer, &self.cursor);
|
|
|
|
vfx.render(&settings, canvas, grid_renderer, &self.cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|