diff --git a/src/components/viewtypes/ListViewType.tsx b/src/components/viewtypes/ListViewType.tsx index 0b916a7..8903e70 100644 --- a/src/components/viewtypes/ListViewType.tsx +++ b/src/components/viewtypes/ListViewType.tsx @@ -1,3 +1,5 @@ +/* eslint-disable jsx-a11y/no-static-element-interactions */ +/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ // Resize derived from @nimrod-cohen https://gitter.im/rsuite/rsuite?at=5e1cd3f165540a529a0f5deb import React, { useState, @@ -35,9 +37,9 @@ const ListViewType = ( }: any, ref: any ) => { - // const [isDragging, setIsDragging] = useState(false); - // const [dragDirection, setDragDirection] = useState('down'); - // const [dragSpeed, setDragSpeed] = useState('medium'); + const [isDragging, setIsDragging] = useState(false); + const [dragDirection, setDragDirection] = useState(''); + const [dragSpeed, setDragSpeed] = useState(''); const [height, setHeight] = useState(0); const [show, setShow] = useState(false); const [columns] = useState(tableColumns); @@ -78,7 +80,7 @@ const ListViewType = ( }); }, [getHeight]); - /* useEffect(() => { + useEffect(() => { let scrollDistance = 0; switch (dragSpeed) { case 'slow': @@ -90,6 +92,9 @@ const ListViewType = ( case 'fast': scrollDistance = 60; break; + case 'fastest': + scrollDistance = 240; + break; default: scrollDistance = 15; break; @@ -103,14 +108,14 @@ const ListViewType = ( ? currentScroll + scrollDistance : dragDirection === 'up' && currentScroll - scrollDistance > 0 ? currentScroll - scrollDistance - : 0 + : currentScroll ); }, 50); return () => clearInterval(interval); } return () => clearInterval(); - }, [dragDirection, dragSpeed, isDragging]); */ + }, [dragDirection, dragSpeed, isDragging]); return ( <> @@ -123,23 +128,30 @@ const ListViewType = ( /> )} - {/* */} - {/* */} - {/*
{ + e.preventDefault(); + if (e.button === 1) { + console.log('middle click'); + setIsDragging(true); + } + if (e.button === 0 && isDragging) { + console.log('left click'); + setIsDragging(false); + } + }} > -
Direction: {dragDirection}
-
IsDragging: {isDragging ? 'true' : 'false'}
-
DragSpeed: {dragSpeed}
-
*/} - -
- {/*
{ - console.log('panning down'); - setIsDragging(true); setDragDirection('up'); }} onMouseLeave={() => { - console.log('stopped panning down'); - setIsDragging(false); setDragDirection('none'); }} > +
{ + setDragSpeed('fastest'); + }} + />
{ setDragSpeed('fast'); }} />
{ setDragSpeed('medium'); }} />
{ setDragSpeed('slow'); }} />
+
{ + setDragDirection('none'); + }} + />
{ - console.log('panning down'); - setIsDragging(true); setDragDirection('down'); }} onMouseLeave={() => { - console.log('stopped panning down'); - setIsDragging(false); setDragDirection('none'); }} >
{ setDragSpeed('slow'); }} />
{ setDragSpeed('medium'); }} />
{ setDragSpeed('fast'); }} /> -
*/} +
{ + setDragSpeed('fastest'); + }} + /> +
{show && (