Skip to content

Commit

Permalink
Merge pull request #2479 from framer/fix/layout-animations-html
Browse files Browse the repository at this point in the history
Limit layout animations to HTML elements
  • Loading branch information
mergetron[bot] authored Jan 9, 2024
2 parents 4e3f426 + 807feee commit 8e76146
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,11 @@ export class VisualElementDragControls {
this.stop(event, info)

const resumeAnimation = () =>
eachAxis((axis) => (this.getAnimationState(axis) === 'paused') && this.getAxisMotionValue(axis).animation?.play())

eachAxis(
(axis) =>
this.getAnimationState(axis) === "paused" &&
this.getAxisMotionValue(axis).animation?.play()
)

const { dragSnapToOrigin } = this.getProps()
this.panSession = new PanSession(
Expand All @@ -221,7 +224,7 @@ export class VisualElementDragControls {
onStart,
onMove,
onSessionEnd,
resumeAnimation
resumeAnimation,
},
{
transformPagePoint: this.visualElement.getTransformPagePoint(),
Expand Down
6 changes: 5 additions & 1 deletion packages/framer-motion/src/render/VisualElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ export abstract class VisualElement<
}
}

if (!this.projection && ProjectionNodeConstructor) {
if (
this.type === "html" &&
!this.projection &&
ProjectionNodeConstructor
) {
this.projection = new ProjectionNodeConstructor(
this.latestValues,
this.parent && this.parent.projection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class HTMLVisualElement extends DOMVisualElement<
HTMLRenderState,
DOMVisualElementOptions
> {
type: "html"
type = "html"

readValueFromInstance(
instance: HTMLElement,
Expand Down
2 changes: 1 addition & 1 deletion packages/framer-motion/src/render/svg/SVGVisualElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class SVGVisualElement extends DOMVisualElement<
SVGRenderState,
DOMVisualElementOptions
> {
type: "svg"
type = "svg"

isSVGTag = false

Expand Down

0 comments on commit 8e76146

Please sign in to comment.