Skip to content

Commit

Permalink
GNU nano 6.2 /home/rhill/Workshop/ublock/.git/COMMIT_EDITMSG *
Browse files Browse the repository at this point in the history
Prevent negative position when widget size is greater than viewport size

Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2718
- https://github.com/uBlockOrigin/uBlock-issues/issues/2704
  • Loading branch information
gorhill committed Jul 3, 2023
1 parent e52da39 commit 4bdef7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/js/logger-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ 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 = '';
} else {
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 = '';
};
Expand Down

0 comments on commit 4bdef7c

Please sign in to comment.