Skip to content

Commit

Permalink
fix: prevent error on drag end
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlewis92 committed Oct 22, 2020
1 parent 931203a commit 4a6bdbb
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,18 +522,18 @@ export class DraggableDirective implements OnInit, OnChanges, OnDestroy {
this.zone.run(() => {
this.dragging.next({ x, y });
});
if (this.ghostElement) {
const transform = `translate3d(${transformX}px, ${transformY}px, 0px)`;
requestAnimationFrame(() => {
this.setElementStyles(this.ghostElement as HTMLElement, {
requestAnimationFrame(() => {
if (this.ghostElement) {
const transform = `translate3d(${transformX}px, ${transformY}px, 0px)`;
this.setElementStyles(this.ghostElement, {
transform,
'-webkit-transform': transform,
'-ms-transform': transform,
'-moz-transform': transform,
'-o-transform': transform,
});
});
}
}
});
currentDrag$.next({
clientX,
clientY,
Expand Down

0 comments on commit 4a6bdbb

Please sign in to comment.