From a956e60eabc32f9d81b723e42c2d9f62f465a874 Mon Sep 17 00:00:00 2001 From: Chris Williams Date: Sun, 12 Jan 2020 16:06:30 -0800 Subject: [PATCH] typescript(vx-demo): Fix Drag-ii types --- packages/vx-demo/src/components/tiles/Drag-ii.tsx | 6 +++--- packages/vx-demo/src/pages/Drag-ii.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/vx-demo/src/components/tiles/Drag-ii.tsx b/packages/vx-demo/src/components/tiles/Drag-ii.tsx index 749f974bb..d9ff12f47 100644 --- a/packages/vx-demo/src/components/tiles/Drag-ii.tsx +++ b/packages/vx-demo/src/components/tiles/Drag-ii.tsx @@ -37,11 +37,11 @@ export default function DragII({ width, height }: ShowProvidedProps) { width={width} height={height} resetOnStart - onDragStart={({ x, y }) => { + onDragStart={({ x = 0, y = 0 }) => { // add the new line with the starting point setLines(currLines => [...currLines, [{ x, y }]]); }} - onDragMove={({ x, y, dx, dy }) => { + onDragMove={({ x = 0, y = 0, dx, dy }) => { // add the new point to the current line setLines(currLines => { const nextLines = [...currLines]; @@ -52,7 +52,7 @@ export default function DragII({ width, height }: ShowProvidedProps) { }); }} > - {({ x, y, dx, dy, isDragging, dragStart, dragEnd, dragMove }) => ( + {({ x = 0, y = 0, dx, dy, isDragging, dragStart, dragEnd, dragMove }) => ( {/* decorate the currently drawing line */} {isDragging && ( diff --git a/packages/vx-demo/src/pages/Drag-ii.tsx b/packages/vx-demo/src/pages/Drag-ii.tsx index 7b9e10749..833146df7 100644 --- a/packages/vx-demo/src/pages/Drag-ii.tsx +++ b/packages/vx-demo/src/pages/Drag-ii.tsx @@ -44,11 +44,11 @@ export default function DragII({ width, height }: ShowProvidedProps) { width={width} height={height} resetOnStart - onDragStart={({ x, y }) => { + onDragStart={({ x = 0, y = 0 }) => { // add the new line with the starting point setLines(currLines => [...currLines, [{ x, y }]]); }} - onDragMove={({ x, y, dx, dy }) => { + onDragMove={({ x = 0, y = 0, dx, dy }) => { // add the new point to the current line setLines(currLines => { const nextLines = [...currLines]; @@ -59,7 +59,7 @@ export default function DragII({ width, height }: ShowProvidedProps) { }); }} > - {({ x, y, dx, dy, isDragging, dragStart, dragEnd, dragMove }) => ( + {({ x = 0, y = 0, dx, dy, isDragging, dragStart, dragEnd, dragMove }) => ( {/* decorate the currently drawing line */} {isDragging && (