Skip to content

Commit 88c0cac

Browse files
committed
fixed screenerror related to invokedscreenleft setting when invoked window width is less than 1000
1 parent 46faf20 commit 88c0cac

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/extension/background.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,10 @@ chrome.contextMenus.onClicked.addListener(({ menuItemId }) => {
507507
// console.log(displayUnitInfo);
508508
// });
509509
chrome.windows.getCurrent((window) => {
510+
console.log(window);
510511
const invokedScreenTop = 75; // window.top || 0;
511-
const invokedScreenLeft = window.left || 0;
512-
const invokedScreenWidth = Math.max(Math.trunc(window.width / 2), 1000) || 1000; // set reactime window to half of chrome window, with a min of 1000px
512+
const invokedScreenLeft = window.width < 1000 ? window.left + window.width - 1000 : window.left;
513+
const invokedScreenWidth = 1000; // set reactime window to half of chrome window, with a min of 1000px
513514
const invokedScreenHeight = window.height - invokedScreenTop || 1000;
514515
const options = {
515516
type: 'panel',
@@ -519,6 +520,7 @@ chrome.contextMenus.onClicked.addListener(({ menuItemId }) => {
519520
height: invokedScreenHeight,
520521
url: chrome.runtime.getURL('panel.html'),
521522
};
523+
console.log(options);
522524
if (menuItemId === 'reactime') chrome.windows.create(options);
523525
});
524526

0 commit comments

Comments
 (0)