mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +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._active$.next({ target, info: resolvedInfo });
|
||||||
this._show$.next({
|
this._show$.next({
|
||||||
value: true,
|
value: true,
|
||||||
animation:
|
animation: target.element ? 'zoom' : 'fade',
|
||||||
resolvedInfo.type === 'doc' || resolvedInfo.type === 'ai-chat-block'
|
|
||||||
? 'zoom'
|
|
||||||
: 'fade',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (abortSignal) {
|
if (abortSignal) {
|
||||||
|
|||||||
@@ -128,6 +128,23 @@ export const PeekViewModalContainer = forwardRef<
|
|||||||
const targets = contentClip;
|
const targets = contentClip;
|
||||||
const lockSizeEl = content;
|
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 from = zoomIn ? target : contentClip;
|
||||||
const to = zoomIn ? contentClip : target;
|
const to = zoomIn ? contentClip : target;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user