table: Emit MoveCol when moved column. (#473)

This commit is contained in:
ihavecoke 2024-12-09 15:21:37 +08:00 committed by GitHub
parent d8636a31bd
commit bf0e3a22de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View file

@ -673,6 +673,9 @@ impl TableStory {
}
TableEvent::SelectCol(ix) => println!("Select col: {}", ix),
TableEvent::SelectRow(ix) => println!("Select row: {}", ix),
TableEvent::MoveCol(origin_idx, target_idx) => {
println!("Move col index: {} -> {}", origin_idx, target_idx);
}
}
}
}

View file

@ -101,6 +101,7 @@ pub enum TableEvent {
SelectRow(usize),
SelectCol(usize),
ColWidthsChanged(Vec<Option<Pixels>>),
MoveCol(usize, usize),
}
#[derive(Clone, Copy, Default)]
@ -567,6 +568,7 @@ where
let col_group = self.col_groups.remove(col_ix);
self.col_groups.insert(to_ix, col_group);
cx.emit(TableEvent::MoveCol(col_ix, to_ix));
cx.notify();
}