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

fix: initial render transform-origin issues with SVG elements #104

Merged
merged 3 commits into from
Mar 12, 2025
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
3 changes: 1 addition & 2 deletions packages/motion/src/features/feature-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimationFeature, DragGesture, type Feature, HoverGesture, InViewGesture, LayoutFeature, PanGesture, PressGesture, SVGFeature } from '@/features'
import { AnimationFeature, DragGesture, type Feature, HoverGesture, InViewGesture, LayoutFeature, PanGesture, PressGesture } from '@/features'
import type { MotionState } from '@/state'
import { ProjectionFeature } from './layout/projection'
import { FocusGesture } from '@/features/gestures/focus'
Expand All @@ -11,7 +11,6 @@ export class FeatureManager {
new HoverGesture(state),
new PressGesture(state),
new InViewGesture(state),
new SVGFeature(state),
new LayoutFeature(state),
new ProjectionFeature(state),
new PanGesture(state),
Expand Down
1 change: 0 additions & 1 deletion packages/motion/src/features/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './feature'
export * from './gestures'
export * from './svg'
export * from './layout/layout'
export * from './gestures/pan'
export * from './feature-manager'
Expand Down
5 changes: 0 additions & 5 deletions packages/motion/src/features/layout/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ export class LayoutFeature extends Feature {
layoutGroup.group.remove(projection)
}

// Check lead's animation progress, if it exists, skip update to prevent lead from jumping
// @ts-ignore
if (projection.getStack()?.lead?.animationProgress) {
return
}
this.didUpdate()
}
}
Expand Down
38 changes: 0 additions & 38 deletions packages/motion/src/features/svg.ts

This file was deleted.

5 changes: 4 additions & 1 deletion packages/motion/src/state/motion-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ export class MotionState {
// Mount features in parent-to-child order
this.featureManager.mount()
if (!notAnimate && this.options.animate) {
this.startAnimation()
/**
* Immediately animate updates on mount to avoid transform-origin issues with SVG elements
*/
this.animateUpdates()
}
if (this.options.layoutId) {
mountedLayoutIds.add(this.options.layoutId)
Expand Down