orbital_datatable/core/
row_drag.rs1#[derive(Clone, Debug, PartialEq)]
3pub struct RowDragGhost {
4 pub cells: Vec<String>,
5 pub widths_px: Vec<f32>,
6 pub x: f32,
7 pub y: f32,
8}
9
10const GHOST_OFFSET_X: f32 = 12.0;
11const GHOST_OFFSET_Y: f32 = 12.0;
12
13pub fn row_drag_ghost_at_pointer(
14 cells: Vec<String>,
15 widths_px: Vec<f32>,
16 x: f32,
17 y: f32,
18) -> RowDragGhost {
19 RowDragGhost {
20 cells,
21 widths_px,
22 x: x - GHOST_OFFSET_X,
23 y: y - GHOST_OFFSET_Y,
24 }
25}
26
27pub fn move_row_drag_ghost(ghost: &mut RowDragGhost, x: f32, y: f32) {
28 ghost.x = x - GHOST_OFFSET_X;
29 ghost.y = y - GHOST_OFFSET_Y;
30}