Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove transform #124

Merged
merged 10 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-students-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ember-velcro": patch
---

Removed CSS transform in favor of top+left positioning.
1 change: 1 addition & 0 deletions ember-velcro/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default {
// but we need the ember plugins converted first
// (template compilation and co-location)
transpiler: 'babel',
transpileOnly: true,
browserslist: ['last 2 firefox versions', 'last 2 chrome versions'],
tsconfig: {
fileName: 'tsconfig.json',
Expand Down
11 changes: 6 additions & 5 deletions ember-velcro/src/modifiers/velcro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class VelcroModifier extends Modifier<Signature> {
});

let update = async () => {
let { x, y, middlewareData } = await computePosition(referenceElement, floatingElement, {
let { middlewareData, x, y } = await computePosition(referenceElement, floatingElement, {
middleware: [
offset(offsetOptions),
flip(flipOptions),
Expand All @@ -89,14 +89,15 @@ export default class VelcroModifier extends Modifier<Signature> {
});

Object.assign(floatingElement.style, {
strategy,
transform: `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)`,
visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible',
top: `${y}px`,
left: `${x}px`,
margin: 0,
});

setVelcroData?.(middlewareData.metadata);
};

update();

let cleanup = autoUpdate(referenceElement, floatingElement, update);

registerDestructor(this, cleanup);
Expand Down
Loading