refactor: extract drop indicator rect helper
This commit is contained in:
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user