web-request-rpc
Advanced tools
+11
-0
| # web-request-rpc ChangeLog | ||
| ## 2.0.3 - 2023-01-26 | ||
| ### Fixed | ||
| - Fix popup window resize bugs. When calling `window.open`, the height | ||
| and width used are for the total content area not including any | ||
| title bar, when calling `resizeTo`, the height and width are for the | ||
| total content area and any title bar, etc. Additionally, the window | ||
| bounds parameters are ignored in Firefox when opening a new window | ||
| if the parent window is maximized, so the resizeTo/moveTo APIs must | ||
| always be called on popups. | ||
| ## 2.0.2 - 2022-11-17 | ||
@@ -4,0 +15,0 @@ |
+1
-1
| { | ||
| "name": "web-request-rpc", | ||
| "version": "2.0.2", | ||
| "version": "2.0.3", | ||
| "description": "Web Request RPC", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+14
-11
| /*! | ||
| * Copyright (c) 2017-2022 Digital Bazaar, Inc. All rights reserved. | ||
| * Copyright (c) 2017-2023 Digital Bazaar, Inc. All rights reserved. | ||
| */ | ||
@@ -88,13 +88,16 @@ import {WebAppWindowInlineDialog} from './WebAppWindowInlineDialog.js'; | ||
| } | ||
| } else if(this.popup && bounds) { | ||
| } | ||
| if(this.popup && bounds) { | ||
| // resize / re-position popup window as requested | ||
| if(bounds) { | ||
| const {top: y, left: x, width, height} = bounds; | ||
| if(x !== undefined && y !== undefined) { | ||
| this.dialog.handle.moveTo(x, y); | ||
| } | ||
| if(width !== undefined && height !== undefined) { | ||
| this.dialog.handle.resizeTo(width, height); | ||
| } | ||
| } | ||
| let {x, y, width = 500, height = 400} = bounds; | ||
| width = Math.min(width, window.innerWidth); | ||
| // ~30 pixels must be added when resizing for window titlebar | ||
| height = Math.min(height + 30, window.innerHeight); | ||
| x = Math.floor(x !== undefined ? | ||
| x : window.screenX + (window.innerWidth - width) / 2); | ||
| // ~15 pixels must be added to account for window titlebar | ||
| y = Math.floor(y !== undefined ? | ||
| y : window.screenY + (window.innerHeight - height) / 2 + 15); | ||
| this.dialog.handle.resizeTo(width, height); | ||
| this.dialog.handle.moveTo(x, y); | ||
| } | ||
@@ -101,0 +104,0 @@ |
| /*! | ||
| * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved. | ||
| * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved. | ||
| */ | ||
@@ -45,6 +45,6 @@ import {WebAppWindowDialog} from './WebAppWindowDialog.js'; | ||
| height = Math.min(height, window.innerHeight); | ||
| const left = x !== undefined ? | ||
| x : window.screenX + (window.innerWidth - width) / 2; | ||
| const top = y !== undefined ? | ||
| y : window.screenY + (window.innerHeight - height) / 2; | ||
| const left = Math.floor(x !== undefined ? | ||
| x : window.screenX + (window.innerWidth - width) / 2); | ||
| const top = Math.floor(y !== undefined ? | ||
| y : window.screenY + (window.innerHeight - height) / 2); | ||
| const features = | ||
@@ -51,0 +51,0 @@ 'popup=yes,menubar=no,location=no,resizable=no,scrollbars=no,status=no,' + |
45038
1.8%1160
0.26%