mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
fixed crash when using Pan View action and moving the mouse outside the map display
This commit is contained in:
parent
7426b77dc4
commit
f2f8ccf699
1 changed files with 10 additions and 6 deletions
|
@ -549,12 +549,16 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
/// </summary>
|
||||
protected virtual void OnUpdateViewPanning()
|
||||
{
|
||||
// Get the map coordinates of the last mouse posision (before it moved)
|
||||
Vector2D lastmappos;
|
||||
lastmappos = renderer2d.GetMapCoordinates(mouselastpos);
|
||||
|
||||
// Do the scroll
|
||||
ScrollBy(lastmappos.x - mousemappos.x, lastmappos.y - mousemappos.y);
|
||||
// We can only drag the map when the mouse pointer is inside
|
||||
// otherwise we don't have coordinates where to drag the map to
|
||||
if(mouseinside && !float.IsNaN(mouselastpos.x) && !float.IsNaN(mouselastpos.y))
|
||||
{
|
||||
// Get the map coordinates of the last mouse posision (before it moved)
|
||||
Vector2D lastmappos = renderer2d.GetMapCoordinates(mouselastpos);
|
||||
|
||||
// Do the scroll
|
||||
ScrollBy(lastmappos.x - mousemappos.x, lastmappos.y - mousemappos.y);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue