ScreenToWorldPoint works wrong after updating to 2019.3.5

Hello. I’m using ScreenToWorldPoint in editor with 2d camera for adding custom ways to manipulate objects on scene.
It worked properly until update (I used 2019.3.0 before), now it gives wrong position — it match mouse position in top left corner, but is shifted more the more I move mouse to bottom right corner (see attached images).

The code I’m using for that:

  var sceneCamera = SceneView.lastActiveSceneView.camera;
  var sceneHeight = SceneView.lastActiveSceneView.camera.pixelHeight;
    
  Vector2 MouseWorldPos = sceneCamera.ScreenToWorldPoint(new 
      Vector3(Event.current.mousePosition.x, sceneHeight - Event.current.mousePosition.y, 0));

Hope someone will help me figure out what changed, because before update this had worked as intended.

UPDATE: ScreenToWorldPoint wasn’t resolving correctly for me because I was calling it during the wrong phase of Event.type.

To answer your question, I believe you need to use:

var MouseScreenPosition = HandleUtility.GUIPointToScreenPixelCoordinate( e.mousePosition );

…this automatically adjusts for two UnityEditor “features” added in recent years: Retina support (which makes all coordinates in all existing code and all games … wrong), and Unity’s flip-the-Y bug, where they fail to take account of their own flipping in several of their APIs.