Skip to content

Commit

Permalink
Fixed cursor position issue after popup box click
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrdacor committed Jun 2, 2020
1 parent 2df58c0 commit b8f9997
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
12 changes: 12 additions & 0 deletions Freeserf.Core/UI/Interface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public struct SpriteLocation
readonly object gameLock = new object();
public GameInitBox GameInitBox { get; private set; }

bool ignoreNextDelayedClick = false;
protected MapPos mapCursorPosition = 0u;
CursorType mapCursorType = CursorType.None;
BuildPossibility buildPossibility = BuildPossibility.None;
Expand Down Expand Up @@ -215,6 +216,11 @@ public override bool HandleEvent(Event.EventArgs e)
if (viewportEnabled && Viewport != null)
Viewport.Enabled = true;

// If it is an undelayed click the associated
// delayed click should be avoided as well
// for the viewport (e.g. when a popup is closed).
ignoreNextDelayedClick = e.Type == Event.Type.Click;

return true; // handled
}
}
Expand All @@ -228,6 +234,12 @@ public override bool HandleEvent(Event.EventArgs e)
{
Viewport.Enabled = true;

if (e.Type == Event.Type.DelayedClick && ignoreNextDelayedClick)
{
ignoreNextDelayedClick = false;
return true;
}

if (e.UntransformedArgs != null)
{
var position = new Position(e.UntransformedArgs.X, e.UntransformedArgs.Y);
Expand Down
4 changes: 2 additions & 2 deletions FreeserfNet/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

[assembly: Guid("ea9340ab-cdd1-40ee-b242-f405c0e1f6f9")]

[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Freeserf.net is a C# port and extension of [freeserf](https://github.com/freeser

| Windows | Linux |
| ---- | ---- |
| [v2.0.0](https://github.com/Pyrdacor/freeserf.net/releases/download/v2.0.0/Freeserf.net-Windows.zip "Windows v2.0.0") | [v2.0.0](https://github.com/Pyrdacor/freeserf.net/releases/download/v2.0.0/Freeserf.net-Linux.tar.gz "Linux v2.0.0") |
| [v2.0.1](https://github.com/Pyrdacor/freeserf.net/releases/download/v2.0.1/Freeserf.net-Windows.zip "Windows v2.0.1") | [v2.0.1](https://github.com/Pyrdacor/freeserf.net/releases/download/v2.0.1/Freeserf.net-Linux.tar.gz "Linux v2.0.1") |

Builds for other platforms will follow later. Only recent Ubuntu versions are tested for Linux version.

Expand Down
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 2.0.1:
==============

- When closing a popup box with a mouse click
(e.g. selecting a building from the build
menu) the cursor in the map view is not changed
to the position underneath the popup box anymore.


Version 2.0.0:
==============

Expand Down

0 comments on commit b8f9997

Please sign in to comment.