feat(ui): FRO-5 Animation Card Played #23
@@ -25,9 +25,7 @@ function triggerWiggle(index: number) {
|
|||||||
function handlePlayCard(index: number | null) {
|
function handlePlayCard(index: number | null) {
|
||||||
if (index === null) return
|
if (index === null) return
|
||||||
|
|
||||||
wb.sendAndWait("PlayCard", { cardindex: index }).then(
|
wb.sendAndWait("PlayCard", { cardindex: index }).catch((error) => {
|
||||||
|
|
||||||
).catch((error) => {
|
|
||||||
triggerWiggle(index)
|
triggerWiggle(index)
|
||||||
|
|
||||||
$q.notify({
|
$q.notify({
|
||||||
@@ -40,14 +38,9 @@ function handlePlayCard(index: number | null) {
|
|||||||
}
|
}
|
||||||
function onBeforeLeave(el: Element) {
|
function onBeforeLeave(el: Element) {
|
||||||
const element = el as HTMLElement;
|
const element = el as HTMLElement;
|
||||||
// 1. Get the current position relative to the container
|
|
||||||
const { marginLeft, marginTop, width, height } = window.getComputedStyle(element);
|
const { marginLeft, marginTop, width, height } = window.getComputedStyle(element);
|
||||||
|
|
||||||
// 2. Explicitly set the geometry to freeze it in place
|
|
||||||
element.style.left = `${element.offsetLeft - parseFloat(marginLeft)}px`;
|
element.style.left = `${element.offsetLeft - parseFloat(marginLeft)}px`;
|
||||||
element.style.top = `${element.offsetTop - parseFloat(marginTop)}px`;
|
element.style.top = `${element.offsetTop - parseFloat(marginTop)}px`;
|
||||||
|
|
||||||
// 3. Keep the width/height fixed so it doesn't shrink when becoming absolute
|
|
||||||
element.style.width = width;
|
element.style.width = width;
|
||||||
element.style.height = height;
|
element.style.height = height;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user