зеркало из https://github.com/electron/electron.git
docs: coordinate system of badly named method getCursorScreenPoint (#27156)
* Document coordinate system of badly named method getCursorScreenPoint
[Electron inherits this confusing name from Chromium](99314be815/ui/display/win/screen_win.cc (L677-L681)
). We can also see there that the return value is a DIPPoint, due to `ScreenToDIPPoint` call:
gfx::Point ScreenWin::GetCursorScreenPoint() {
POINT pt;
::GetCursorPos(&pt);
return gfx::ToFlooredPoint(ScreenToDIPPoint(gfx::PointF(gfx::Point(pt))));
}
I lost over a day due to debugging this. I don't think we can change the method name due to backwards compatibility, but we can at least make amends in the documentation.
* Remove advice
* Softer wording
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
This commit is contained in:
Родитель
442f106bb4
Коммит
01b7ceac17
|
@ -92,6 +92,8 @@ Returns [`Point`](structures/point.md)
|
|||
|
||||
The current absolute position of the mouse pointer.
|
||||
|
||||
**Note:** The return value is a DIP point, not a screen physical point.
|
||||
|
||||
### `screen.getPrimaryDisplay()`
|
||||
|
||||
Returns [`Display`](structures/display.md) - The primary display.
|
||||
|
|
Загрузка…
Ссылка в новой задаче