mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
fix(editor): incorrect edgeless viewport in peek view (#11040)
### What Changes - Fixed incorrect edgeless viewport display in peek view - Moved page block viewport fit animation logic from `EdgelessRootBlockComponent` to note config extension - Disabled page block viewport fit animation in peek view, using default `fitToScreen` instead - @doodlewind Fixed viewport resizing issues by adding a immediate update mechanism to ensure proper rendering during peek view operations. The setViewportByBound is only called once during peek view initialization, so there are barely perf overhead. - Updated related test cases - Refactored peek view test cases to make them clearer and more reliable - Added new test helper function `getViewportBound` for getting viewport boundary information
This commit is contained in:
@@ -109,6 +109,17 @@ export async function getViewportCenter(page: Page, editorIndex = 0) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function getViewportBound(page: Page, editorIndex = 0) {
|
||||
const container = locateEditorContainer(page, editorIndex);
|
||||
return container.evaluate(container => {
|
||||
const root = container.querySelector('affine-edgeless-root');
|
||||
if (!root) {
|
||||
throw new Error('Edgeless root not found');
|
||||
}
|
||||
return root.gfx.viewport.viewportBounds.toXYWH();
|
||||
});
|
||||
}
|
||||
|
||||
export async function setViewportCenter(
|
||||
page: Page,
|
||||
center: IVec,
|
||||
|
||||
Reference in New Issue
Block a user