@raydiant/playlist-window-manager 0.0.0-test-13 → 0.0.0-test-15

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.
@@ -95,6 +95,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
95
95
  },
96
96
  });
97
97
  this.proxySettings = null;
98
+ this.logger = opts.logger;
98
99
  opts.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts constructor1 ".concat(JSON.stringify(opts.bounds)));
99
100
  this.setWindowOrViewBounds(this.offscreenWindow, opts.bounds);
100
101
  opts.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts constructor2 ".concat(JSON.stringify({
@@ -106,7 +107,6 @@ var BrowserWindowRenderer = /** @class */ (function () {
106
107
  if (opts.proxySettings) {
107
108
  this.proxySettings = opts.proxySettings;
108
109
  }
109
- this.logger = opts.logger;
110
110
  if (opts.windowCrashHandler) {
111
111
  this.windowCrashHandler = opts.windowCrashHandler;
112
112
  }
@@ -385,31 +385,43 @@ var BrowserWindowRenderer = /** @class */ (function () {
385
385
  * 1919x1079.
386
386
  */
387
387
  BrowserWindowRenderer.prototype.setWindowOrViewBounds = function (window, bounds) {
388
- this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds1: ".concat(JSON.stringify({
389
- windowBounds: window.getBounds(),
390
- bounds: bounds,
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
- if ((0, boundUtils_1.areBoundsEqual)(window.getBounds(), bounds)) {
394
- this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds2: bounds are equal");
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
- // setBounds will be ignored if window was in fullscreen mode
398
- if (window instanceof electron_1.BrowserWindow && !(0, boundUtils_1.isFullscreen)(bounds)) {
399
- this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds3: not full screen");
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 setWindowOrViewBounds4: before: ".concat(JSON.stringify({
403
- windowBounds: window.getBounds(),
404
- })));
405
- window.setBounds(bounds);
406
- this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds5: before: ".concat(JSON.stringify({
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydiant/playlist-window-manager",
3
- "version": "0.0.0-test-13",
3
+ "version": "0.0.0-test-15",
4
4
  "description": "Window manager for playlist playback.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -75,6 +75,7 @@ export default class BrowserWindowRenderer
75
75
  private logger: Logger;
76
76
 
77
77
  constructor(private opts: BrowserWindowRendererOptions) {
78
+ this.logger = opts.logger;
78
79
  opts.logger.info(
79
80
  `playlist-window-manager/src/BrowserWindowRenderer.ts constructor1 ${JSON.stringify(
80
81
  opts.bounds
@@ -96,8 +97,6 @@ export default class BrowserWindowRenderer
96
97
  this.proxySettings = opts.proxySettings;
97
98
  }
98
99
 
99
- this.logger = opts.logger;
100
-
101
100
  if (opts.windowCrashHandler) {
102
101
  this.windowCrashHandler = opts.windowCrashHandler;
103
102
  }
@@ -475,53 +474,64 @@ export default class BrowserWindowRenderer
475
474
  window: BrowserWindow | BrowserView,
476
475
  bounds: WindowBounds
477
476
  ) {
477
+ if (window instanceof BrowserView) {
478
+ this.logger.info(
479
+ `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds1: ${JSON.stringify(
480
+ {
481
+ windowBounds: window.getBounds(),
482
+ bounds,
483
+ }
484
+ )}`
485
+ );
486
+ window.setBounds(bounds);
487
+ return;
488
+ }
489
+
478
490
  this.logger.info(
479
- `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds1: ${JSON.stringify(
491
+ `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds2: ${JSON.stringify(
480
492
  {
481
- windowBounds: window.getBounds(),
482
- bounds,
493
+ newBounds: bounds,
494
+ fullscreen: window.isFullScreen(),
495
+ bounds: window.getBounds(),
496
+ contentBounds: window.getContentBounds(),
497
+ normalBounds: window.getNormalBounds(),
483
498
  }
484
499
  )}`
485
500
  );
486
501
 
487
- // calling setBounds may introduce -1px resolution error
488
- if (areBoundsEqual(window.getBounds(), bounds)) {
502
+ // calling setBounds or setFullscreen may introduce -1px resolution error
503
+ // so we try to avoid unnecessary calls
504
+ if (
505
+ areBoundsEqual(window.getBounds(), bounds) ||
506
+ (isFullscreen(bounds) && window.isFullScreen())
507
+ ) {
489
508
  this.logger.info(
490
- `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds2: bounds are equal`
509
+ `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds3: bounds are equal`
491
510
  );
492
511
  return;
493
512
  }
494
513
 
495
- // setBounds will be ignored if window was in fullscreen mode
496
- if (window instanceof BrowserWindow && !isFullscreen(bounds)) {
514
+ if (isFullscreen(bounds)) {
497
515
  this.logger.info(
498
- `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds3: not full screen`
516
+ `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds4: full screen`
499
517
  );
518
+ window.setFullScreen(true);
519
+ } else {
520
+ // setBounds will be ignored if window was in fullscreen mode
500
521
  window.setFullScreen(false);
522
+ window.setBounds(bounds);
501
523
  }
502
524
 
503
525
  this.logger.info(
504
- `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds4: before: ${JSON.stringify(
505
- {
506
- windowBounds: window.getBounds(),
507
- }
508
- )}`
509
- );
510
- window.setBounds(bounds);
511
- this.logger.info(
512
- `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds5: before: ${JSON.stringify(
526
+ `playlist-window-manager/src/BrowserWindowRenderer.ts setWindowOrViewBounds6: before: ${JSON.stringify(
513
527
  {
514
- windowBounds: window.getBounds(),
528
+ fullscreen: window.isFullScreen(),
529
+ bounds: window.getBounds(),
530
+ contentBounds: window.getContentBounds(),
531
+ normalBounds: window.getNormalBounds(),
515
532
  }
516
533
  )}`
517
534
  );
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
535
  }
526
536
 
527
537
  private getWindow(windowId: string): BrowserWindowRendererWindow | null {