Skip to content

Commit

Permalink
Removing cast and adding default
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry committed Nov 1, 2021
1 parent aea1b39 commit f3d04eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dev/tests/drag.tsx
@@ -1,7 +1,6 @@
import { motion } from "@framer"
import * as React from "react"

// It's important for this test to only trigger a single rerender while dragging (in response to onDragStart) of draggable component.
function getValueParam(params: any, name: string) {
const param = params.get(name) as string | undefined
if (!param) return 0
Expand All @@ -12,6 +11,7 @@ function getValueParam(params: any, name: string) {
}
}

// It's important for this test to only trigger a single rerender while dragging (in response to onDragStart) of draggable component.
export const App = () => {
const params = new URLSearchParams(window.location.search)
const axis = params.get("axis")
Expand Down
4 changes: 2 additions & 2 deletions src/gestures/drag/VisualElementDragControls.ts
Expand Up @@ -127,7 +127,7 @@ export class VisualElementDragControls {
* Record gesture origin
*/
eachAxis((axis) => {
let current = this.getAxisMotionValue(axis).get()
let current = this.getAxisMotionValue(axis).get() || 0

/**
* If the MotionValue is a percentage value convert to px
Expand All @@ -142,7 +142,7 @@ export class VisualElementDragControls {
}
}

this.originPoint[axis] = current as number
this.originPoint[axis] = current
})

// Fire onDragStart event
Expand Down

0 comments on commit f3d04eb

Please sign in to comment.