diff --git a/src/js/logger-ui.js b/src/js/logger-ui.js index 9fedb7130..34414129f 100644 --- a/src/js/logger-ui.js +++ b/src/js/logger-ui.js @@ -101,7 +101,7 @@ const onStartMovingWidget = (( ) => { const move = ( ) => { timer = undefined; - const l1 = Math.min(Math.max(l0 + mx1 - mx0, 0), pw - cw); + const l1 = Math.min(Math.max(l0 + mx1 - mx0, 0), Math.max(pw - cw, 0)); if ( (l1+cw/2) < (pw/2) ) { widget.style.left = `${l1/pw*100}%`; widget.style.right = ''; @@ -109,7 +109,7 @@ const onStartMovingWidget = (( ) => { widget.style.right = `${(pw-l1-cw)/pw*100}%`; widget.style.left = ''; } - const t1 = Math.min(Math.max(t0 + my1 - my0, 0), ph - ch); + const t1 = Math.min(Math.max(t0 + my1 - my0, 0), Math.max(ph - ch, 0)); widget.style.top = `${t1/ph*100}%`; widget.style.bottom = ''; };