Closed as duplicate of#11666
Description
When implementing a pop-over with anchor positioning, a common pattern is to animate its appearance using transforms (e.g., scaling or rotating). In such cases, it’s often desirable to set the transform origin at the vertex closest to the anchor point. Example:
.some-popover-ele
{
display: none;
opacity: 0;
transform: scale(.97);
transition: transform .2s, opacity .2s, display .2s allow-discrete, overlay .2s allow-discrete;
position: absolute;
top: calc(anchor(bottom) + 5px);
left: anchor(left);
transform-origin: top left;
position-try: --popover-from-top-left, --popover-from-bottom-right, --popover-from-top-right;
}
.some-popover-ele:popover-open
{
display: block;
opacity: 1;
transform: none;
@starting-style
{
opacity: 0;
transform: scale(.97);
}
}
@position-try --popover-from-top-left
{
top: auto;
bottom: calc(anchor(top) + 5px);
transform-origin: bottom left;
}
@position-try --popover-from-bottom-right
{
left: auto;
right: anchor(right);
transform-origin: top right;
}
@position-try --popover-from-top-right
{
left: auto;
right: anchor(right);
top: auto;
bottom: calc(anchor(top) + 5px);
transform-origin: bottom right;
}
Unfortunately, transform-origin
is currently not allowed within @position-try
. Therefore, I propose adding support for transform-origin
in this context.