Skip to content

Commit

Permalink
Added checks for current
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry committed Nov 7, 2022
1 parent 4d4a33e commit 06e38ff
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ export class VisualElementDragControls {
* relative to where it was before the resize.
*/
scalePositionWithinConstraints() {
if (!this.visualElement.current) return

const { drag, dragConstraints } = this.getProps()
const { projection } = this.visualElement
if (!isRefObject(dragConstraints) || !projection || !this.constraints)
Expand Down Expand Up @@ -490,7 +492,7 @@ export class VisualElementDragControls {
* Update the layout of this element and resolve the latest drag constraints
*/
const { transformTemplate } = this.visualElement.getProps()
this.visualElement.current!.style.transform = transformTemplate
this.visualElement.current.style.transform = transformTemplate
? transformTemplate({}, "")
: "none"
projection.root?.updateScroll()
Expand All @@ -514,8 +516,9 @@ export class VisualElementDragControls {
}

addListeners() {
if (!this.visualElement.current) return
elementDragControls.set(this.visualElement, this)
const element = this.visualElement.current!
const element = this.visualElement.current

/**
* Attach a pointerdown event listener on this DOM element to initiate drag tracking.
Expand Down

0 comments on commit 06e38ff

Please sign in to comment.