feat: DIP <-> screen coordinate conversions (#12879)

This commit is contained in:
Milan Burda 2018-05-16 11:34:09 +02:00 committed by Cheng Zhao
parent 73eb5af2cc
commit 211d7825d3
2 changed files with 67 additions and 0 deletions

View file

@ -119,3 +119,43 @@ Returns [`Display`](structures/display.md) - The display nearest the specified p
Returns [`Display`](structures/display.md) - The display that most closely
intersects the provided bounds.
### `screen.screenToDipPoint(point)` _Windows_
* `point` [Point](structures/point.md)
Returns [`Point`](structures/point.md)
Converts a screen physical point to a screen DIP point.
The DPI scale is performed relative to the display containing the physical point.
### `screen.dipToScreenPoint(point)` _Windows_
* `point` [Point](structures/point.md)
Returns [`Point`](structures/point.md)
Converts a screen DIP point to a screen physical point.
The DPI scale is performed relative to the display containing the DIP point.
### `screen.screenToDipRect(window, rect)` _Windows_
* `window` [BrowserWindow](browser-window.md)
* `rect` [Rectangle](structures/rectangle.md)
Returns [`Rectangle`](structures/rectangle.md)
Converts a screen physical rect to a screen DIP rect.
The DPI scale is performed relative to the display nearest to `window`.
If `window` is null, scaling will be performed to the display nearest to `rect`.
### `screen.dipToScreenRect(window, rect)` _Windows_
* `window` [BrowserWindow](browser-window.md)
* `rect` [Rectangle](structures/rectangle.md)
Returns [`Rectangle`](structures/rectangle.md)
Converts a screen DIP rect to a screen physical rect.
The DPI scale is performed relative to the display nearest to `window`.
If `window` is null, scaling will be performed to the display nearest to `rect`.