Skip to content

Commit

Permalink
🐛 Convert bar transform-origin to rem
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-m-santos committed May 24, 2024
1 parent 214cd83 commit 810ffb3
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ export function useBarTransition(
const computedHeight = ref(0);

const transformOrigin = computed(() => {
const remFontSize = parseFloat(
getComputedStyle(document.documentElement).fontSize
);

// Convert to REM so that it behaves correctly in Safari browsers
// https://github.com/Adyen/lume/issues/430
const originX = (x.value + width.value / 2) / remFontSize;
const originY = (y.value + height.value / 2) / remFontSize;

// Calculates the middle point of a bar so that it can be rotated 180 deg
return `${x.value + width.value / 2}px ${y.value + height.value / 2}px`;
return `${originX}rem ${originY}rem`;
});

onMounted(() => {
Expand Down

0 comments on commit 810ffb3

Please sign in to comment.