mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
fix(core): peek view animation use zoom when possible (#8793)
fix AF-1667
This commit is contained in:
@@ -258,10 +258,7 @@ export class PeekViewEntity extends Entity {
|
||||
this._active$.next({ target, info: resolvedInfo });
|
||||
this._show$.next({
|
||||
value: true,
|
||||
animation:
|
||||
resolvedInfo.type === 'doc' || resolvedInfo.type === 'ai-chat-block'
|
||||
? 'zoom'
|
||||
: 'fade',
|
||||
animation: target.element ? 'zoom' : 'fade',
|
||||
});
|
||||
|
||||
if (abortSignal) {
|
||||
|
||||
@@ -128,6 +128,23 @@ export const PeekViewModalContainer = forwardRef<
|
||||
const targets = contentClip;
|
||||
const lockSizeEl = content;
|
||||
|
||||
// if target has no bounding client rect, find its parent that has bounding client rect
|
||||
let iteration = 0;
|
||||
while (
|
||||
target &&
|
||||
!target.getBoundingClientRect().width &&
|
||||
iteration < 10
|
||||
) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
target = target.parentElement || undefined;
|
||||
iteration++;
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
const from = zoomIn ? target : contentClip;
|
||||
const to = zoomIn ? contentClip : target;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user