diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index aa47fb9..9cf8787 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -158,8 +158,8 @@ function App(): JSX.Element { height={80} position={position} selection={viewport} - onSelectionStart={(x1: number) => { - console.log('onSelectionStart', x1); + onSelectionStart={() => { + // empty }} onSelectionChange={handleOverviewSelectionChange} /> diff --git a/frontend/src/Overview.tsx b/frontend/src/Overview.tsx index 122fe86..3490878 100644 --- a/frontend/src/Overview.tsx +++ b/frontend/src/Overview.tsx @@ -46,6 +46,17 @@ export const Overview: React.FC = ({ // effects + // handle global mouse up. + // Currently this adds and removes the global event listener every time the + // component is rerendered (which is often when dragging or redrawing). It + // works but probably better to optimize this for performance reasons. + useEffect(() => { + window.addEventListener('mouseup', handleMouseUp); + return () => { + window.removeEventListener('mouseup', handleMouseUp); + }; + }, [mode, newSelection]); + // load peaks on mediaset change useEffect(() => { (async function () { @@ -244,7 +255,6 @@ export const Overview: React.FC = ({ style={hudCanvasStyles} onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} - onMouseUp={handleMouseUp} >