fix: adjust peek view modal container styles (#7173)
fix AFF-1233, AFF-1234
This commit is contained in:
@@ -140,7 +140,7 @@ export const SurfaceRefPeekView = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let mounted = true;
|
let mounted = true;
|
||||||
if (editorRef) {
|
if (editorRef) {
|
||||||
editorRef.host.updateComplete
|
editorRef.host?.updateComplete
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
const viewport = {
|
const viewport = {
|
||||||
|
|||||||
@@ -6,11 +6,9 @@ export const transformOrigin = createVar();
|
|||||||
|
|
||||||
const contentShow = keyframes({
|
const contentShow = keyframes({
|
||||||
from: {
|
from: {
|
||||||
opacity: 0,
|
|
||||||
transform: 'scale(0.10)',
|
transform: 'scale(0.10)',
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
opacity: 1,
|
|
||||||
transform: 'scale(1)',
|
transform: 'scale(1)',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -45,7 +43,7 @@ const fadeOut = keyframes({
|
|||||||
|
|
||||||
const slideRight = keyframes({
|
const slideRight = keyframes({
|
||||||
from: {
|
from: {
|
||||||
transform: 'translateX(-200%)',
|
transform: 'translateX(-100%)',
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
@@ -60,7 +58,7 @@ const slideLeft = keyframes({
|
|||||||
opacity: 1,
|
opacity: 1,
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
transform: 'translateX(-200%)',
|
transform: 'translateX(-100%)',
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -70,14 +68,14 @@ export const modalOverlay = style({
|
|||||||
inset: 0,
|
inset: 0,
|
||||||
zIndex: cssVar('zIndexModal'),
|
zIndex: cssVar('zIndexModal'),
|
||||||
backgroundColor: cssVar('black30'),
|
backgroundColor: cssVar('black30'),
|
||||||
willChange: 'opacity',
|
opacity: 0,
|
||||||
selectors: {
|
selectors: {
|
||||||
'&[data-state=entered], &[data-state=entering]': {
|
'&[data-state=entered], &[data-state=entering]': {
|
||||||
animation: `${fadeIn} ${animationTimeout} ease-in-out`,
|
animation: `${fadeIn} ${animationTimeout} ease-in-out`,
|
||||||
animationFillMode: 'forwards',
|
animationFillMode: 'forwards',
|
||||||
},
|
},
|
||||||
'&[data-state=exited], &[data-state=exiting]': {
|
'&[data-state=exited], &[data-state=exiting]': {
|
||||||
animation: `${fadeOut} ${animationTimeout} ${animationTimeout} ease-in-out`,
|
animation: `${fadeOut} ${animationTimeout} ease-in-out`,
|
||||||
animationFillMode: 'backwards',
|
animationFillMode: 'backwards',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -124,7 +122,6 @@ export const modalContent = style({
|
|||||||
animationName: contentHide,
|
animationName: contentHide,
|
||||||
animationDuration: animationTimeout,
|
animationDuration: animationTimeout,
|
||||||
animationTimingFunction: 'cubic-bezier(0.42, 0, 0.58, 1)',
|
animationTimingFunction: 'cubic-bezier(0.42, 0, 0.58, 1)',
|
||||||
animationDelay: animationTimeout,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -143,7 +140,6 @@ export const modalControls = style({
|
|||||||
animationDuration: animationTimeout,
|
animationDuration: animationTimeout,
|
||||||
animationFillMode: 'forwards',
|
animationFillMode: 'forwards',
|
||||||
animationTimingFunction: 'ease-in-out',
|
animationTimingFunction: 'ease-in-out',
|
||||||
animationDelay: `calc(${animationTimeout} / 2)`,
|
|
||||||
},
|
},
|
||||||
'&[data-state=exited], &[data-state=exiting]': {
|
'&[data-state=exited], &[data-state=exiting]': {
|
||||||
animationName: slideLeft,
|
animationName: slideLeft,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export const PeekViewModalContainer = ({
|
|||||||
onAnimateEnd?: () => void;
|
onAnimateEnd?: () => void;
|
||||||
}>) => {
|
}>) => {
|
||||||
const [{ status }, toggle] = useTransition({
|
const [{ status }, toggle] = useTransition({
|
||||||
timeout: animationTimeout * 1.5,
|
timeout: animationTimeout,
|
||||||
onStateChange(event) {
|
onStateChange(event) {
|
||||||
if (event.current.status === 'exited' && onAnimateEnd) {
|
if (event.current.status === 'exited' && onAnimateEnd) {
|
||||||
onAnimateEnd();
|
onAnimateEnd();
|
||||||
@@ -85,8 +85,13 @@ export const PeekViewModalContainer = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
toggle(open);
|
toggle(open);
|
||||||
const bondingBox = target ? getElementScreenPositionCenter(target) : null;
|
const bondingBox = target ? getElementScreenPositionCenter(target) : null;
|
||||||
|
const offsetLeft =
|
||||||
|
(window.innerWidth - Math.min(window.innerWidth * 0.9, 1200)) / 2;
|
||||||
|
const modalHeight = window.innerHeight * 0.05;
|
||||||
setTransformOrigin(
|
setTransformOrigin(
|
||||||
bondingBox ? `${bondingBox.x}px ${bondingBox.y}px` : null
|
bondingBox
|
||||||
|
? `${bondingBox.x - offsetLeft}px ${bondingBox.y - modalHeight}px`
|
||||||
|
: null
|
||||||
);
|
);
|
||||||
}, [open, target]);
|
}, [open, target]);
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ export const PeekViewManagerModal = () => {
|
|||||||
}
|
}
|
||||||
controls={controls}
|
controls={controls}
|
||||||
// there is a bug for edgeless mode when showing the peek view during start up animation
|
// there is a bug for edgeless mode when showing the peek view during start up animation
|
||||||
hideOnEntering={activePeekView?.info.mode === 'edgeless'}
|
hideOnEntering={
|
||||||
|
!activePeekView?.info.mode || activePeekView?.info.mode === 'edgeless'
|
||||||
|
}
|
||||||
onOpenChange={open => {
|
onOpenChange={open => {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
peekViewEntity.close();
|
peekViewEntity.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user