Skip to content

Commit 4f75bf5

Browse files
docs: Added more detailed comments to menu popup method and DPI-related classes (#13368)
* Detailed function description for popup() * Expanded DPI class descriptions * fmt --------- Co-authored-by: Lucas Nogueira <[email protected]>
1 parent b5c549d commit 4f75bf5

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/api/src/dpi.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { SERIALIZE_TO_IPC_FN } from './core'
66

77
/**
88
* A size represented in logical pixels.
9+
* Logical pixels are scaled according to the window's DPI scale.
10+
* Most browser APIs (i.e. `MouseEvent`'s `clientX`) will return logical pixels.
11+
*
12+
* For logical-pixel-based position, see {@linkcode LogicalPosition}.
913
*
1014
* @since 2.0.0
1115
*/
@@ -72,6 +76,12 @@ class LogicalSize {
7276
/**
7377
* A size represented in physical pixels.
7478
*
79+
* Physical pixels represent actual screen pixels, and are DPI-independent.
80+
* For high-DPI windows, this means that any point in the window on the screen
81+
* will have a different position in logical pixels (@linkcode LogicalSize).
82+
*
83+
* For physical-pixel-based position, see {@linkcode PhysicalPosition}.
84+
*
7585
* @since 2.0.0
7686
*/
7787
class PhysicalSize {
@@ -197,6 +207,7 @@ class Size {
197207

198208
/**
199209
* A position represented in logical pixels.
210+
* For an explanation of what logical pixels are, see description of {@linkcode LogicalSize}.
200211
*
201212
* @since 2.0.0
202213
*/
@@ -263,6 +274,8 @@ class LogicalPosition {
263274
/**
264275
* A position represented in physical pixels.
265276
*
277+
* For an explanation of what physical pixels are, see description of {@linkcode PhysicalSize}.
278+
*
266279
* @since 2.0.0
267280
*/
268281
class PhysicalPosition {

packages/api/src/menu/menu.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ export class Menu extends MenuItemBase {
213213
/**
214214
* Popup this menu as a context menu on the specified window.
215215
*
216-
* If the position, is provided, it is relative to the window's top-left corner.
216+
* @param at If a position is provided, it is relative to the window's top-left corner.
217+
* If there isn't one provided, the menu will pop up at the current location of the mouse.
217218
*/
218219
async popup(
219220
at?: PhysicalPosition | LogicalPosition | Position,

0 commit comments

Comments
 (0)