diff --git a/src/cursor.rs b/src/cursor.rs index 57bb62b0..126923cc 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -656,6 +656,7 @@ fn parser_cursor_file( size: u32, scale: Scale, best_fit: i64, + best_fit_size: u32, } let mut targets = Vec::new(); for scale in scales { @@ -668,6 +669,7 @@ fn parser_cursor_file( size: *size, scale: *scale, best_fit: i64::MAX, + best_fit_size: 0, }); } } @@ -682,9 +684,10 @@ fn parser_cursor_file( let fit = (size as i64 - target.effective_size as i64).abs(); if fit < target.best_fit { target.best_fit = fit; + target.best_fit_size = size; target.positions.clear(); } - if fit == target.best_fit { + if size == target.best_fit_size { target.positions.push(position); } }