Skip to content

Commit

Permalink
typescript(vx-demo): Fix Drag-ii types
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Williams committed Jan 13, 2020
1 parent b02cefa commit a956e60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/vx-demo/src/components/tiles/Drag-ii.tsx
Expand Up @@ -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];
Expand All @@ -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 }) => (
<g>
{/* decorate the currently drawing line */}
{isDragging && (
Expand Down
6 changes: 3 additions & 3 deletions packages/vx-demo/src/pages/Drag-ii.tsx
Expand Up @@ -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];
Expand All @@ -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 }) => (
<g>
{/* decorate the currently drawing line */}
{isDragging && (
Expand Down

0 comments on commit a956e60

Please sign in to comment.