more house keeping 🧹

macos-click-through
exoticus 5 years ago
parent a42c7a3b4e
commit df229c602c

@ -111,6 +111,7 @@ impl Editor {
pub fn build_draw_commands(&mut self) -> (Vec<DrawCommand>, bool) { pub fn build_draw_commands(&mut self) -> (Vec<DrawCommand>, bool) {
let mut draw_commands = Vec::new(); let mut draw_commands = Vec::new();
for (row_index, row) in self.grid.rows().enumerate() { for (row_index, row) in self.grid.rows().enumerate() {
let mut command = None; let mut command = None;

@ -105,14 +105,17 @@ impl Corner {
) -> bool { ) -> bool {
// Update destination if needed // Update destination if needed
let mut immediate_movement = false; let mut immediate_movement = false;
if destination != self.previous_destination { if destination != self.previous_destination {
let travel_distance = destination - self.previous_destination; let travel_distance = destination - self.previous_destination;
let chars_travel_x = travel_distance.x / font_dimensions.x; let chars_travel_x = travel_distance.x / font_dimensions.x;
if travel_distance.y == 0.0 && (chars_travel_x - 1.0).abs() < 0.1 { if travel_distance.y == 0.0 && (chars_travel_x - 1.0).abs() < 0.1 {
// We're moving one character to the right. Make movement immediate to avoid lag // We're moving one character to the right. Make movement immediate to avoid lag
// while typing // while typing
immediate_movement = true; immediate_movement = true;
} }
self.t = 0.0; self.t = 0.0;
self.start_position = self.current_position; self.start_position = self.current_position;
self.previous_destination = destination; self.previous_destination = destination;
@ -127,8 +130,7 @@ impl Corner {
let relative_scaled_position: Point = ( let relative_scaled_position: Point = (
self.relative_position.x * font_dimensions.x, self.relative_position.x * font_dimensions.x,
self.relative_position.y * font_dimensions.y, self.relative_position.y * font_dimensions.y,
) ).into();
.into();
let corner_destination = destination + relative_scaled_position; let corner_destination = destination + relative_scaled_position;
@ -240,7 +242,6 @@ impl CursorRenderer {
dt: f32, dt: f32,
) { ) {
let render = self.blink_status.update_status(&cursor); let render = self.blink_status.update_status(&cursor);
let settings = SETTINGS.get::<CursorSettings>(); let settings = SETTINGS.get::<CursorSettings>();
if settings.vfx_mode != self.previous_vfx_mode { if settings.vfx_mode != self.previous_vfx_mode {
@ -270,7 +271,6 @@ impl CursorRenderer {
}; };
let (grid_x, grid_y) = self.previous_position; let (grid_x, grid_y) = self.previous_position;
let (character, font_dimensions): (String, Point) = { let (character, font_dimensions): (String, Point) = {
let editor = EDITOR.lock(); let editor = EDITOR.lock();
let character = match editor.grid.get_cell(grid_x, grid_y) { let character = match editor.grid.get_cell(grid_x, grid_y) {
@ -289,9 +289,9 @@ impl CursorRenderer {
}; };
(character, (font_width, font_height).into()) (character, (font_width, font_height).into())
}; };
let destination: Point = (grid_x as f32 * font_width, grid_y as f32 * font_height).into(); let destination: Point = (grid_x as f32 * font_width, grid_y as f32 * font_height).into();
let center_destination = destination + font_dimensions * 0.5; let center_destination = destination + font_dimensions * 0.5;
let new_cursor = Some(cursor.shape.clone()); let new_cursor = Some(cursor.shape.clone());
if self.previous_cursor_shape != new_cursor { if self.previous_cursor_shape != new_cursor {
@ -307,6 +307,7 @@ impl CursorRenderer {
} }
let mut animating = false; let mut animating = false;
if !center_destination.is_zero() { if !center_destination.is_zero() {
for corner in self.corners.iter_mut() { for corner in self.corners.iter_mut() {
let corner_animating = let corner_animating =

Loading…
Cancel
Save