@raydiant/playlist-window-manager 0.0.0-test-13 → 0.0.0-test-14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/BrowserWindowRenderer.js +31 -19
- package/package.json +1 -1
- package/src/BrowserWindowRenderer.ts +37 -26
|
@@ -385,31 +385,43 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
385
385
|
* 1919x1079.
|
|
386
386
|
*/
|
|
387
387
|
BrowserWindowRenderer.prototype.setWindowOrViewBounds = function (window, bounds) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
388
|
+
if (window instanceof electron_1.BrowserView) {
|
|
389
|
+
this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds1: ".concat(JSON.stringify({
|
|
390
|
+
windowBounds: window.getBounds(),
|
|
391
|
+
bounds: bounds,
|
|
392
|
+
})));
|
|
393
|
+
window.setBounds(bounds);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds2: ".concat(JSON.stringify({
|
|
397
|
+
newBounds: bounds,
|
|
398
|
+
fullscreen: window.isFullScreen(),
|
|
399
|
+
bounds: window.getBounds(),
|
|
400
|
+
contentBounds: window.getContentBounds(),
|
|
401
|
+
normalBounds: window.getNormalBounds(),
|
|
391
402
|
})));
|
|
392
|
-
// calling setBounds may introduce -1px resolution error
|
|
393
|
-
|
|
394
|
-
|
|
403
|
+
// calling setBounds or setFullscreen may introduce -1px resolution error
|
|
404
|
+
// so we try to avoid unnecessary calls
|
|
405
|
+
if ((0, boundUtils_1.areBoundsEqual)(window.getBounds(), bounds) ||
|
|
406
|
+
((0, boundUtils_1.isFullscreen)(bounds) && window.isFullScreen())) {
|
|
407
|
+
this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds3: bounds are equal");
|
|
395
408
|
return;
|
|
396
409
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
410
|
+
if ((0, boundUtils_1.isFullscreen)(bounds)) {
|
|
411
|
+
this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds4: full screen");
|
|
412
|
+
window.setFullScreen(true);
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
// setBounds will be ignored if window was in fullscreen mode
|
|
400
416
|
window.setFullScreen(false);
|
|
417
|
+
window.setBounds(bounds);
|
|
401
418
|
}
|
|
402
|
-
this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
windowBounds: window.getBounds(),
|
|
419
|
+
this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds6: before: ".concat(JSON.stringify({
|
|
420
|
+
fullscreen: window.isFullScreen(),
|
|
421
|
+
bounds: window.getBounds(),
|
|
422
|
+
contentBounds: window.getContentBounds(),
|
|
423
|
+
normalBounds: window.getNormalBounds(),
|
|
408
424
|
})));
|
|
409
|
-
if (window instanceof electron_1.BrowserWindow && (0, boundUtils_1.isFullscreen)(bounds)) {
|
|
410
|
-
this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds6: is full screen");
|
|
411
|
-
window.setFullScreen(true);
|
|
412
|
-
}
|
|
413
425
|
};
|
|
414
426
|
BrowserWindowRenderer.prototype.getWindow = function (windowId) {
|
|
415
427
|
return this.windows[windowId];
|
package/package.json
CHANGED
|
@@ -475,53 +475,64 @@ export default class BrowserWindowRenderer
|
|
|
475
475
|
window: BrowserWindow | BrowserView,
|
|
476
476
|
bounds: WindowBounds
|
|
477
477
|
) {
|
|
478
|
+
if (window instanceof BrowserView) {
|
|
479
|
+
this.logger.info(
|
|
480
|
+
`playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds1: ${JSON.stringify(
|
|
481
|
+
{
|
|
482
|
+
windowBounds: window.getBounds(),
|
|
483
|
+
bounds,
|
|
484
|
+
}
|
|
485
|
+
)}`
|
|
486
|
+
);
|
|
487
|
+
window.setBounds(bounds);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
|
|
478
491
|
this.logger.info(
|
|
479
|
-
`playlist-window-manager/src/BrowserWindowRenderer.ts
|
|
492
|
+
`playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds2: ${JSON.stringify(
|
|
480
493
|
{
|
|
481
|
-
|
|
482
|
-
|
|
494
|
+
newBounds: bounds,
|
|
495
|
+
fullscreen: window.isFullScreen(),
|
|
496
|
+
bounds: window.getBounds(),
|
|
497
|
+
contentBounds: window.getContentBounds(),
|
|
498
|
+
normalBounds: window.getNormalBounds(),
|
|
483
499
|
}
|
|
484
500
|
)}`
|
|
485
501
|
);
|
|
486
502
|
|
|
487
|
-
// calling setBounds may introduce -1px resolution error
|
|
488
|
-
|
|
503
|
+
// calling setBounds or setFullscreen may introduce -1px resolution error
|
|
504
|
+
// so we try to avoid unnecessary calls
|
|
505
|
+
if (
|
|
506
|
+
areBoundsEqual(window.getBounds(), bounds) ||
|
|
507
|
+
(isFullscreen(bounds) && window.isFullScreen())
|
|
508
|
+
) {
|
|
489
509
|
this.logger.info(
|
|
490
|
-
`playlist-window-manager/src/BrowserWindowRenderer.ts
|
|
510
|
+
`playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds3: bounds are equal`
|
|
491
511
|
);
|
|
492
512
|
return;
|
|
493
513
|
}
|
|
494
514
|
|
|
495
|
-
|
|
496
|
-
if (window instanceof BrowserWindow && !isFullscreen(bounds)) {
|
|
515
|
+
if (isFullscreen(bounds)) {
|
|
497
516
|
this.logger.info(
|
|
498
|
-
`playlist-window-manager/src/BrowserWindowRenderer.ts
|
|
517
|
+
`playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds4: full screen`
|
|
499
518
|
);
|
|
519
|
+
window.setFullScreen(true);
|
|
520
|
+
} else {
|
|
521
|
+
// setBounds will be ignored if window was in fullscreen mode
|
|
500
522
|
window.setFullScreen(false);
|
|
523
|
+
window.setBounds(bounds);
|
|
501
524
|
}
|
|
502
525
|
|
|
503
526
|
this.logger.info(
|
|
504
|
-
`playlist-window-manager/src/BrowserWindowRenderer.ts
|
|
527
|
+
`playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds6: before: ${JSON.stringify(
|
|
505
528
|
{
|
|
506
|
-
|
|
529
|
+
fullscreen: window.isFullScreen(),
|
|
530
|
+
bounds: window.getBounds(),
|
|
531
|
+
contentBounds: window.getContentBounds(),
|
|
532
|
+
normalBounds: window.getNormalBounds(),
|
|
507
533
|
}
|
|
508
534
|
)}`
|
|
509
535
|
);
|
|
510
|
-
window.setBounds(bounds);
|
|
511
|
-
this.logger.info(
|
|
512
|
-
`playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds5: before: ${JSON.stringify(
|
|
513
|
-
{
|
|
514
|
-
windowBounds: window.getBounds(),
|
|
515
|
-
}
|
|
516
|
-
)}`
|
|
517
|
-
);
|
|
518
|
-
|
|
519
|
-
if (window instanceof BrowserWindow && isFullscreen(bounds)) {
|
|
520
|
-
this.logger.info(
|
|
521
|
-
`playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds6: is full screen`
|
|
522
|
-
);
|
|
523
|
-
window.setFullScreen(true);
|
|
524
|
-
}
|
|
525
536
|
}
|
|
526
537
|
|
|
527
538
|
private getWindow(windowId: string): BrowserWindowRendererWindow | null {
|