Use geometry instead of geometryByDistance when computing mask
GeometryByDistance returns the place where the panel should be at a given moment; however it might not have moved there yet, thus it's better to use the actual screen geometry. If there's a mismatch between the two, e.g. when moving the panel around, then the mapFromGlobal function would place the mask outside the screen area.