fix(editor): align scalar cell editor, edgeless note clip, calendar hover, and trackpad zoom

This commit is contained in:
DarkSky committed 2026-11-29 19:44:08 +09:00
1 parent e872a5a2f7
commit 2ce403df16
10 files changed
+550 -27

No files matched your search

@@ -401,10 +401,8 @@ impl BlockBody {
let scroll = state.code_scroll_x.clamp(0.0, scroll_cfg.max_x);
let shifted = point(origin.x - px(scroll), origin.y);
let bounds = scroll_cfg.area.bounds(origin);
window.with_content_mask(Some(ui::ContentMask { bounds }), |window| {
window.with_local_paint_mask(ui::ContentMask { bounds }, |window| {
self.paint_prims(shifted, state, window, cx);
})
window.with_local_paint_mask(ui::ContentMask { bounds }, |window| {
self.paint_prims(shifted, state, window, cx);
});
return;
}
@@ -423,12 +421,10 @@ impl BlockBody {
self.paint_single_prim(prim, origin, state, window, cx);
}
let bounds = scroll_cfg.area.bounds(origin);
window.with_content_mask(Some(ui::ContentMask { bounds }), |window| {
window.with_local_paint_mask(ui::ContentMask { bounds }, |window| {
for (_, prim) in scrolled {
self.paint_single_prim(prim, shifted, state, window, cx);
}
})
window.with_local_paint_mask(ui::ContentMask { bounds }, |window| {
for (_, prim) in scrolled {
self.paint_single_prim(prim, shifted, state, window, cx);
}
});
return;
}
+13 -1
View File
@@ -140,8 +140,10 @@ pub struct DatabaseUiState {
pub active_view_id: Option<String>,
/// Currently displayed Calendar `(year, month 1..=12)`.
pub calendar_month: Option<(i32, u32)>,
/// Selected local day index in Phone Calendar agenda view.
/// Selected local day index in Phone Calendar agenda or Desktop month view.
pub calendar_selected_day: Option<i64>,
/// Hovered local day index in Desktop Calendar month view (reveals day `+` button).
pub calendar_hovered_day: Option<i64>,
/// Horizontal scroll offset (whole px) for the touch database view tab strip.
pub view_tabs_scroll_px: i32,
/// One-shot hint set when switching `active_view_id` so the next layout pass brings the newly
@@ -195,6 +197,16 @@ impl DatabaseFlowState {
self.revision = self.revision.wrapping_add(1);
}
pub fn set_calendar_hovered_day(&mut self, block_id: &str, day_index: Option<i64>) -> bool {
let entry = self.ui_states.entry(block_id.to_string()).or_default();
if entry.calendar_hovered_day == day_index {
return false;
}
entry.calendar_hovered_day = day_index;
self.revision = self.revision.wrapping_add(1);
true
}
pub fn toggle_more_views(&mut self, block_id: &str) {
let entry = self.ui_states.entry(block_id.to_string()).or_default();
entry.more_views_open = !entry.more_views_open;
@@ -551,7 +551,8 @@ pub(super) fn render_calendar_view(
});
let show_plus = is_today
|| is_drag_target
|| ctx.ui_state.calendar_selected_day == Some(day.day_index);
|| ctx.ui_state.calendar_selected_day == Some(day.day_index)
|| ctx.ui_state.calendar_hovered_day == Some(day.day_index);
super::calendar_edit::render_calendar_day_controls(
ctx,
cell_rect,
@@ -560,6 +561,13 @@ pub(super) fn render_calendar_view(
&mut prims,
&mut authoring_hits,
);
hits.push(DatabaseHitTarget {
rect: cell_rect,
kind: DatabaseHitKind::CalendarSelectDay {
day_index: day.day_index,
},
scrolls_x: false,
});
let day_label = isolate_ltr(&day.day.to_string());
let day_ink = if is_today {
ctx.palette.on_accent
@@ -187,6 +187,26 @@ impl EdgelessCamera {
self.pan_y -= dy / z;
}
/// Normalize a DOM-convention wheel `deltaY` (negative = zoom in, positive = zoom out) into
/// the next Edgeless zoom factor, matching `@blocksuite/affine-block-surface`
/// `normalizeWheelDeltaY` (`ZOOM_WHEEL_STEP = 0.1`, `maxStep = 10`).
pub fn normalize_wheel_delta_y(delta: f32, zoom: f32) -> f32 {
if delta == 0.0 || !delta.is_finite() {
return zoom;
}
const MAX_STEP: f32 = 10.0;
let sign = delta.signum();
let abs = delta.abs();
let clamped = if abs > MAX_STEP {
MAX_STEP * sign
} else {
delta
};
let mut new_zoom = zoom - clamped / 100.0;
new_zoom += zoom.max(1.0).log10() * (-sign) * (abs / 20.0).min(1.0);
new_zoom
}
/// Change zoom to `new_zoom` while keeping the world point under `anchor_screen` fixed.
pub fn zoom_at(
&mut self,
@@ -533,4 +553,23 @@ mod tests {
assert!(p.progress(415.0) < 0.5);
assert!(p.gone(300.0 + SHAPE_PICKER_MOTION_MS));
}
#[test]
fn normalize_wheel_delta_y_matches_blocksuite_surface_across_trackpad_and_mouse_wheel() {
// Trackpad small pinch-out (`dom_delta_y = -5.0`) at low (0.25x), 1.0x, and high (3.0x) zoom:
assert!((EdgelessCamera::normalize_wheel_delta_y(-5.0, 0.25) - 0.30).abs() < 1e-5);
assert!((EdgelessCamera::normalize_wheel_delta_y(-5.0, 1.0) - 1.05).abs() < 1e-5);
let expected_3x = 3.05 + 3.0_f32.log10() * 0.25;
assert!((EdgelessCamera::normalize_wheel_delta_y(-5.0, 3.0) - expected_3x).abs() < 1e-5);
// Discrete mouse Ctrl+Wheel notch (`dom_delta_y = ±120.0`) clamps linear step to `±0.10`:
assert!((EdgelessCamera::normalize_wheel_delta_y(-120.0, 0.25) - 0.35).abs() < 1e-5);
assert!((EdgelessCamera::normalize_wheel_delta_y(-120.0, 1.0) - 1.10).abs() < 1e-5);
assert!((EdgelessCamera::normalize_wheel_delta_y(120.0, 1.0) - 0.90).abs() < 1e-5);
let expected_wheel_3x = 3.10 + 3.0_f32.log10();
assert!(
(EdgelessCamera::normalize_wheel_delta_y(-120.0, 3.0) - expected_wheel_3x).abs() < 1e-5
);
assert_eq!(EdgelessCamera::normalize_wheel_delta_y(0.0, 2.0), 2.0);
}
}
@@ -122,7 +122,7 @@ pub(super) fn render_editor_media_evidence(out_dir: &Path) -> Result<()> {
utf16_offset: 0,
anchor: None,
})?;
session.overlay(OverlayEvent::SlashScroll(-560.0))?;
session.overlay(OverlayEvent::SlashHover(15))?;
session.settle(250);
save_session_png(
&session,
@@ -153,19 +153,18 @@ pub(super) fn render_editor_media_evidence(out_dir: &Path) -> Result<()> {
)?;
}
// 4. Dark Edgeless Frame title pill contrast (`palette.panel` over `"frame-overview"`).
// 4. Dark Edgeless Frame title pill contrast + 0.25x zoomed wide Database/Table Note (unclipped).
{
let state = new_doc_state("Dark Edgeless Frame Contrast")?;
let session = start_headless_session(
1280,
760,
390,
844,
PlaygroundOptions {
theme: PlaygroundTheme::Dark,
mode: PlaygroundMode::Edgeless,
form_factor: playground::FormFactor::Phone,
..Default::default()
},
)?;
session.view(|v, cx| v.set_document(state, cx))?;
session.frame()?;
session.settle(200);
save_session_png(
@@ -175,5 +174,97 @@ pub(super) fn render_editor_media_evidence(out_dir: &Path) -> Result<()> {
)?;
}
// 5. Page `ScalarCell` (`Due` date) in-place editor aligned inside `TOPBAR_HEIGHT = 54px` surface,
// and Desktop Calendar month view hovered non-today day cell showing `+` button.
{
let session = start_headless_session(
1280,
900,
PlaygroundOptions {
theme: PlaygroundTheme::Light,
..Default::default()
},
)?;
session.scroll_block_to("showcase-database", 40.0)?;
let snap = session.frame()?;
let db_bounds = snap
.elements
.get("page.block.showcase-database")
.expect("showcase-database visible")
.bounds;
// Click row 1 `Start` date cell (`col-start`, visible at `scroll_x = 0`) to open `ScalarCell` editor.
let due_hit = session
.view(|v, _| {
v.database_authoring_hits("showcase-database")
.iter()
.find_map(|h| match &h.kind {
blocksuite_editor::database::DatabaseAuthoringHitKind::EditCell {
row_id,
column_id,
..
} if row_id == "showcase-db-row-1" && column_id == "col-start" => {
Some(h.rect)
}
_ => None,
})
})?
.expect("showcase-db-row-1 col-start EditCell hit");
session.pointer_down(
db_bounds.x + due_hit.x + 20.0,
db_bounds.y + due_hit.y + 12.0,
);
session.pointer_up(
db_bounds.x + due_hit.x + 20.0,
db_bounds.y + due_hit.y + 12.0,
);
session.settle(100);
let snap_due = session.frame()?;
anyhow::ensure!(
snap_due.elements.contains_key("page.database_cell_focus"),
"expected page.database_cell_focus when editing showcase-db-row-1 col-start"
);
save_session_png(
&session,
&out_dir.join("after-scalar-date-editor-aligned-light.png"),
"after-scalar-date-editor-aligned-light",
)?;
// Switch showcase-database to Calendar View and hover an empty March 2026 day cell (`Mar 18`).
session.view(|v, cx| {
v.set_database_active_view("showcase-database", "view-calendar", cx);
})?;
session.frame()?;
let snap_cal = session.scroll_block_to("showcase-database", 24.0)?;
let cal_bounds = snap_cal
.elements
.get("page.block.showcase-database")
.expect("calendar visible")
.bounds;
let hover_day_rect = session
.view(|v, _| {
v.database_authoring_hits("showcase-database")
.iter()
.filter_map(|h| match h.kind {
blocksuite_editor::database::DatabaseAuthoringHitKind::CalendarDayDropTarget {
..
} => Some(h.rect),
_ => None,
})
.nth(17)
})?
.expect("calendar day drop target");
session.pointer_move(
cal_bounds.x + hover_day_rect.x + 24.0,
cal_bounds.y + hover_day_rect.y + 24.0,
false,
);
session.settle(100);
save_session_png(
&session,
&out_dir.join("after-calendar-hover-plus-light.png"),
"after-calendar-hover-plus-light",
)?;
}
Ok(())
}
@@ -13,6 +13,8 @@ mod tests_authoring_lifecycle;
mod tests_inline_and_popovers;
#[cfg(test)]
mod tests_kanban_and_richtext;
#[cfg(test)]
mod tests_scalar_edgeless_calendar;
pub(crate) use inline::DatabaseInlineSession;
@@ -385,7 +387,8 @@ impl PlaygroundView {
}
}
/// Continue an active database column resize, progress scrub, or calendar reschedule drag.
/// Continue an active database column resize, progress scrub, or calendar reschedule drag,
/// or update desktop Calendar day-cell hover (`+` button visibility) when idle.
pub(crate) fn database_authoring_mouse_move(
&mut self,
event: &MouseMoveEvent,
@@ -396,14 +399,15 @@ impl PlaygroundView {
self.database_drag = None;
return false;
}
let pos_x = f32::from(event.position.x);
let pos_y = f32::from(event.position.y);
let Some(drag) = self.database_drag.clone() else {
self.update_calendar_hover(pos_x, pos_y, window, cx);
return false;
};
if event.pressed_button != Some(MouseButton::Left) {
return self.database_authoring_mouse_up(window, cx);
}
let pos_x = f32::from(event.position.x);
let pos_y = f32::from(event.position.y);
match drag {
DatabaseDragState::ColumnResize {
block_id,
@@ -539,6 +543,74 @@ impl PlaygroundView {
}
}
fn update_calendar_hover(
&mut self,
pos_x: f32,
pos_y: f32,
window: &Window,
cx: &mut Context<Self>,
) {
let mut hit_target: Option<(String, i64)> = None;
if pos_y >= crate::TOPBAR_HEIGHT
&& let Some(layout) = self.flow_layout()
{
let geom = self.current_page_geometry(f32::from(window.viewport_size().width));
let world_x = pos_x - geom.column_x;
let world_y = pos_y - crate::TOPBAR_HEIGHT + self.scroll_y;
for block in &layout.blocks {
if block.body.kind == crate::block_flow::FlowKind::Database
&& block.rect().contains(world_x, world_y)
{
let lx = world_x - block.x;
let ly = world_y - block.y;
if let Some(day_idx) = self
.flow
.database_authoring_hits(&block.block_id)
.iter()
.find_map(|h| match h.kind {
DatabaseAuthoringHitKind::CalendarDayDropTarget { day_index }
if h.rect.contains(lx, ly) =>
{
Some(day_index)
}
_ => None,
})
{
hit_target = Some((block.block_id.clone(), day_idx));
}
break;
}
}
}
let mut changed = false;
let existing_ids: Vec<String> =
self.flow.database_state.ui_states.keys().cloned().collect();
for bid in existing_ids {
let desired = hit_target
.as_ref()
.and_then(|(hb, d)| (hb == &bid).then_some(*d));
if self
.flow
.database_state
.set_calendar_hovered_day(&bid, desired)
{
changed = true;
}
}
if let Some((hb, d)) = hit_target
&& self
.flow
.database_state
.set_calendar_hovered_day(&hb, Some(d))
{
changed = true;
}
if changed {
self.env_rev += 1;
cx.notify();
}
}
/// Commit any active database drag on pointer release in a single CRDT undo step.
pub(crate) fn database_authoring_mouse_up(
&mut self,
@@ -60,13 +60,20 @@ fn paint_inline_box_elements(
out.push(
canvas(
move |_, _, _| {},
move |_, _, window, cx| {
move |bounds, _, window, cx| {
window.with_local_paint_mask(
ui::ContentMask {
bounds: clip_rect.bounds(point(px(0.0), px(0.0))),
bounds: clip_rect.bounds(bounds.origin),
},
|window| {
laid_paint.paint(point(px(inner_x), px(text_top_y)), window, cx);
laid_paint.paint(
point(
bounds.origin.x + px(inner_x),
bounds.origin.y + px(text_top_y),
),
window,
cx,
);
},
);
},
@@ -0,0 +1,288 @@
//! Regression tests for Page `ScalarCell` in-place glyph origin under `TOPBAR_HEIGHT`,
//! desktop Calendar month day-cell hover/click `+` controls, zoomed Edgeless Note
//! `Database`/`Table` local paint masking, and 1:1 Magic Trackpad / wheel zoom speed.
use blocksuite_editor::{block_flow::FormFactor, database::DatabaseAuthoringHitKind};
use ui::{
Modifiers, MouseMoveEvent, PinchEvent, PlatformInput, ScrollDelta, ScrollEvent, ScrollSource,
TouchPhase, point, px,
};
use crate::{PlaygroundMode, PlaygroundOptions, PlaygroundTheme};
use super::tests_inline_and_popovers::open_authoring_window;
#[test]
fn scalar_cell_paints_inside_topbar_offset_edgeless_note_db_unclipped_and_calendar_hover_plus() {
// 1. Page `ScalarCell` (`col-start` date cell) must paint its glyph ink strictly inside the
// `page.database_cell_focus` ring under `TOPBAR_HEIGHT = 54px` (not 54px above it).
let db_id = "showcase-database";
let state = crate::showcase::seed_showcase_doc().expect("showcase doc");
let (platform, app, win, headless) = open_authoring_window(
1280,
760,
PlaygroundOptions {
theme: PlaygroundTheme::Light,
..Default::default()
},
state,
);
let tick = || {
platform.run_until_parked();
headless.request_frame();
platform.run_until_parked();
};
// Scroll to the bottom of the page via real ScrollEvent so `showcase-database` is fully visible.
headless.dispatch_input(PlatformInput::Scroll(ScrollEvent {
position: point(px(640.0), px(380.0)),
delta: ScrollDelta::Pixels(point(px(0.0), px(-100_000.0))),
modifiers: Modifiers::default(),
touch_phase: TouchPhase::Moved,
source: ScrollSource::Pointer,
}));
tick();
let start_click = app.update(|cx| {
win.update(cx, |v, w, _| {
let db_bounds = w
.frame_snapshot()
.elements
.get("page.block.showcase-database")
.expect("showcase-database visible")
.bounds;
let hit = v
.database_authoring_hits(db_id)
.iter()
.find_map(|h| match &h.kind {
DatabaseAuthoringHitKind::EditCell {
row_id, column_id, ..
} if row_id == "showcase-db-row-1" && column_id == "col-start" => Some(h.rect),
_ => None,
})
.expect("col-start EditCell hit");
point(
px(db_bounds.x + hit.x + 20.0),
px(db_bounds.y + hit.y + 12.0),
)
})
.unwrap()
});
headless.simulate_click(start_click);
tick();
let (focus_bounds, img) = app.update(|cx| {
win.update(cx, |_, window, _| {
let snap = window.frame_snapshot().clone();
let b = snap
.elements
.get("page.database_cell_focus")
.expect("page.database_cell_focus present")
.bounds;
(b, window.render_to_image().unwrap())
})
.unwrap()
});
let mut ink_inside_cell = 0usize;
let x0 = (focus_bounds.x as u32 + 6).min(img.width().saturating_sub(1));
let x1 = ((focus_bounds.x + focus_bounds.width) as u32)
.saturating_sub(6)
.min(img.width());
let y0 = (focus_bounds.y as u32 + 4).min(img.height().saturating_sub(1));
let y1 = ((focus_bounds.y + focus_bounds.height) as u32)
.saturating_sub(4)
.min(img.height());
for y in y0..y1 {
for x in x0..x1 {
let p = img.get_pixel(x, y).0;
if p[0] < 160 && p[1] < 160 && p[2] < 160 {
ink_inside_cell += 1;
}
}
}
assert!(
ink_inside_cell >= 12,
"expected ScalarCell text ink inside page.database_cell_focus ({focus_bounds:?}), got {ink_inside_cell}"
);
// 2. Desktop Calendar month view: pointer hover over a non-today day cell sets
// `calendar_hovered_day`, and clicking an empty day cell sets `calendar_selected_day`.
app.update(|cx| {
win.update(cx, |v, _, cx| {
v.dismiss_all_database_authoring(None, cx);
v.set_database_active_view(db_id, "view-calendar", cx);
})
.unwrap();
});
tick();
headless.dispatch_input(PlatformInput::Scroll(ScrollEvent {
position: point(px(640.0), px(380.0)),
delta: ScrollDelta::Pixels(point(px(0.0), px(-100_000.0))),
modifiers: Modifiers::default(),
touch_phase: TouchPhase::Moved,
source: ScrollSource::Pointer,
}));
tick();
let (target_day, day_pt) = app.update(|cx| {
win.update(cx, |v, w, _| {
let db_bounds = w
.frame_snapshot()
.elements
.get("page.block.showcase-database")
.expect("calendar visible")
.bounds;
let (day_idx, rect) = v
.database_authoring_hits(db_id)
.iter()
.filter_map(|h| match h.kind {
DatabaseAuthoringHitKind::CalendarDayDropTarget { day_index } => {
Some((day_index, h.rect))
}
_ => None,
})
.nth(17)
.expect("18th calendar day cell");
(
day_idx,
point(
px(db_bounds.x + rect.x + 28.0),
px(db_bounds.y + rect.y + 28.0),
),
)
})
.unwrap()
});
app.update(|cx| {
win.update(cx, |v, w, cx| {
let mv = MouseMoveEvent {
position: day_pt,
pressed_button: None,
modifiers: Modifiers::default(),
};
v.root_mouse_move(&mv, w, cx);
assert_eq!(
v.flow.database_state.state_for(db_id).calendar_hovered_day,
Some(target_day),
"hovering desktop Calendar day cell must set calendar_hovered_day"
);
})
.unwrap();
});
headless.simulate_click(day_pt);
tick();
let sel_day = app.update(|cx| {
win.update(cx, |v, _, _| {
v.flow.database_state.state_for(db_id).calendar_selected_day
})
.unwrap()
});
assert_eq!(
sel_day,
Some(target_day),
"clicking desktop Calendar day cell must select day_index"
);
// 3. Dark Edgeless `390x844` zoomed showcase Note containing wide `showcase-table` +
// `showcase-database` must paint table/database body ink instead of clipping empty,
// and Magic Trackpad / wheel zoom must match JS `normalizeWheelDeltaY`.
let showcase_state = crate::showcase::seed_showcase_doc().expect("showcase doc");
let (edg_plat, edg_app, edg_win, edg_headless) = open_authoring_window(
390,
844,
PlaygroundOptions {
theme: PlaygroundTheme::Dark,
mode: PlaygroundMode::Edgeless,
form_factor: FormFactor::Phone,
..Default::default()
},
showcase_state,
);
edg_plat.run_until_parked();
edg_headless.request_frame();
edg_plat.run_until_parked();
let (db_screen_bounds, edg_img) = edg_app.update(|cx| {
edg_win
.update(cx, |_, window, _| {
let snap = window.frame_snapshot();
let b = snap
.elements
.get("edgeless.block.showcase-database")
.or_else(|| snap.elements.get("page.block.showcase-database"))
.map(|e| e.bounds);
(b, window.render_to_image().unwrap())
})
.unwrap()
});
let scan_rect = db_screen_bounds.unwrap_or(ui::SnapshotRect {
x: 68.0,
y: 350.0,
width: 150.0,
height: 80.0,
});
let sx0 = (scan_rect.x.max(0.0) as u32 + 4).min(edg_img.width().saturating_sub(1));
let sx1 = ((scan_rect.x + scan_rect.width).max(0.0) as u32)
.saturating_sub(4)
.min(edg_img.width());
let sy0 = ((scan_rect.y + scan_rect.height * 0.35).max(0.0) as u32)
.min(edg_img.height().saturating_sub(1));
let sy1 = ((scan_rect.y + scan_rect.height * 0.90).max(0.0) as u32).min(edg_img.height());
let base_px = edg_img.get_pixel(sx0, sy0).0;
let mut distinct_body_pixels = 0usize;
for y in sy0..sy1 {
for x in sx0..sx1 {
let p = edg_img.get_pixel(x, y).0;
let diff = p[0].abs_diff(base_px[0]) as u32
+ p[1].abs_diff(base_px[1]) as u32
+ p[2].abs_diff(base_px[2]) as u32;
if diff > 24 {
distinct_body_pixels += 1;
}
}
}
assert!(
distinct_body_pixels >= 40,
"zoomed Edgeless Note database body must render unclipped content pixels, got {distinct_body_pixels} in {scan_rect:?}"
);
// 4. Verify `on_edgeless_scroll` (Ctrl + small trackpad delta `+5.0` -> `+0.05` at 0.25x)
// and `on_edgeless_pinch` (`+0.05` -> `+0.05` at 0.25x).
edg_app.update(|cx| {
edg_win
.update(cx, |v, w, cx| {
v.edgeless.set_camera(0.0, 0.0, 0.25);
let trackpad_zoom_in = ScrollEvent {
position: point(px(195.0), px(400.0)),
delta: ScrollDelta::Pixels(point(px(0.0), px(5.0))),
modifiers: Modifiers {
control: true,
..Default::default()
},
touch_phase: TouchPhase::Moved,
source: ScrollSource::Pointer,
};
v.on_edgeless_scroll(&trackpad_zoom_in, w, cx);
assert!(
(v.edgeless.camera.zoom - 0.30).abs() < 1e-4,
"trackpad delta +5 at 0.25x must advance zoom to 0.30, got {}",
v.edgeless.camera.zoom
);
v.edgeless.set_camera(0.0, 0.0, 0.25);
let native_pinch = PinchEvent {
position: point(px(195.0), px(400.0)),
delta: 0.05,
modifiers: Modifiers::default(),
phase: TouchPhase::Moved,
};
v.on_edgeless_pinch(&native_pinch, w, cx);
assert!(
(v.edgeless.camera.zoom - 0.30).abs() < 1e-4,
"native pinch +0.05 at 0.25x must advance zoom to 0.30, got {}",
v.edgeless.camera.zoom
);
})
.unwrap();
});
}
+8 -3
View File
@@ -607,8 +607,10 @@ impl PlaygroundView {
let delta = event.delta.pixel_delta(px(SCROLL_LINE));
let vp_origin = point(px(0.0), px(TOPBAR_HEIGHT));
if event.modifiers.control || event.modifiers.platform {
let factor = (f32::from(delta.y) * 0.002).exp();
let target_zoom = self.edgeless.camera.zoom * factor;
let target_zoom = blocksuite_editor::edgeless::EdgelessCamera::normalize_wheel_delta_y(
-f32::from(delta.y),
self.edgeless.camera.zoom,
);
self.edgeless
.camera
.zoom_at(target_zoom, event.position, vp_origin);
@@ -636,7 +638,10 @@ impl PlaygroundView {
}
self.edgeless_camera_transition = None;
let vp_origin = point(px(0.0), px(TOPBAR_HEIGHT));
let target_zoom = self.edgeless.camera.zoom * (1.0 + event.delta).max(0.05);
let target_zoom = blocksuite_editor::edgeless::EdgelessCamera::normalize_wheel_delta_y(
-event.delta * 100.0,
self.edgeless.camera.zoom,
);
self.edgeless
.camera
.zoom_at(target_zoom, event.position, vp_origin);
@@ -323,6 +323,11 @@ impl PlaygroundView {
self.flow.database_hits(block_id)
}
/// Writable authoring hit targets of a laid-out `affine:database` block from the latest pass.
pub fn database_authoring_hits(&self, block_id: &str) -> &[database::DatabaseAuthoringHit] {
self.flow.database_authoring_hits(block_id)
}
pub(crate) fn apply_database_commit(
&mut self,
commit: Option<