refactor: extract drop indicator rect helper

This commit is contained in:
lix-2026
2026-05-25 07:11:24 +08:00
parent cf98419f5a
commit ce32150db1
4 changed files with 26 additions and 9 deletions
@@ -107,6 +107,23 @@ pub(crate) fn direct_block_index_from_element(
top_level_block_index(root, &block)
}
pub(crate) fn drop_indicator_from_block_rects(
block_index: usize,
block: &Element,
stage: &Element,
client_y: i32,
) -> DropIndicatorState {
let block_rect = block.get_bounding_client_rect();
let stage_rect = stage.get_bounding_client_rect();
drop_indicator_from_geometry(
block_index,
block_rect.top(),
block_rect.height(),
stage_rect.top(),
client_y,
)
}
pub(crate) fn top_level_block_index(root: &Element, block: &Element) -> Option<usize> {
let children = root.children();
(0..children.length()).find_map(|index| {