refactor: extract drop indicator geometry
This commit is contained in:
@@ -22,8 +22,8 @@ use web_sys::{
|
||||
|
||||
use editor_runtime::attachment_upload::dispatch_editor_upload_request;
|
||||
use editor_runtime::block_dnd::{
|
||||
drop_indicator_top, drop_placement_from_block_point, event_target_from_point,
|
||||
pointer_in_handle_corridor_geometry, HandleCorridorGeometry,
|
||||
drop_indicator_from_geometry, event_target_from_point, pointer_in_handle_corridor_geometry,
|
||||
HandleCorridorGeometry,
|
||||
};
|
||||
use editor_runtime::block_menu_overlay;
|
||||
use editor_runtime::block_menu_legacy_html::{
|
||||
@@ -5419,14 +5419,13 @@ fn drop_indicator_from_target(
|
||||
let stage = editor_stage_element()?;
|
||||
let block_rect = block.get_bounding_client_rect();
|
||||
let stage_rect = stage.get_bounding_client_rect();
|
||||
let placement = drop_placement_from_block_point(client_y, block_rect.top(), block_rect.height());
|
||||
let top = drop_indicator_top(stage_rect.top(), block_rect.top(), block_rect.bottom(), placement);
|
||||
|
||||
Some(DropIndicatorState {
|
||||
index: hovered.index,
|
||||
top,
|
||||
placement,
|
||||
})
|
||||
Some(drop_indicator_from_geometry(
|
||||
hovered.index,
|
||||
block_rect.top(),
|
||||
block_rect.height(),
|
||||
stage_rect.top(),
|
||||
client_y,
|
||||
))
|
||||
}
|
||||
|
||||
fn drop_indicator_from_point(client_x: i32, client_y: i32) -> Option<DropIndicatorState> {
|
||||
|
||||
Reference in New Issue
Block a user