summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Hakulinen <ville.hakulinen@gmail.com>2020-07-23 13:06:45 +0300
committerVille Hakulinen <ville.hakulinen@gmail.com>2020-07-23 13:06:45 +0300
commit161bd97706e54affa904e50e602dec4ce160bc77 (patch)
treed80d7a31f5af09a5fb782363dfa651c048bfcc0e
parente97d36efb4febed8c532497be466c3f1379ab013 (diff)
Add notes to Context::get_cursor_rect
-rw-r--r--src/ui/grid/context.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ui/grid/context.rs b/src/ui/grid/context.rs
index 8f4cab1..0b2d80f 100644
--- a/src/ui/grid/context.rs
+++ b/src/ui/grid/context.rs
@@ -211,14 +211,17 @@ impl Context {
};
}
- /// Returns x, y, width and height for current cursor location.
+ /// Returns x, y, width and height for cursor position on the screen (e.g. might be in middle
+ /// of an animation).
pub fn get_cursor_rect(&self) -> (i32, i32, i32, i32) {
let double_width = self
.cell_at_cursor()
.and_then(|cell| Some(cell.double_width))
.unwrap_or(false);
+ // Dont use cursor.get_position here, because we want to use the position on the screen.
let pos = self.cursor.pos.unwrap_or((0.0, 0.0));
+
let cm = &self.cell_metrics;
let (x, y) = render::get_coords(cm.height, cm.width, pos.0, pos.1);
(