Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change cursor to hand when dragging #152

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added Gum/Content/Cursors/cursor-grab.cur
Binary file not shown.
1 change: 1 addition & 0 deletions Gum/Gum.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@
<None Include="Content\Icons\ChildrenLayout\AutoGridHorizontal.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="Content\Cursors\cursor-grab.cur" />
<Content Include="Content\Icons\Origins\Baseline.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
10 changes: 10 additions & 0 deletions Gum/Wireframe/CameraController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace Gum.Wireframe
{
public class CameraController : Gum.Managers.Singleton<CameraController>
{

Cursor handGrabCursor;

global::RenderingLibrary.Camera Camera
{
get;
Expand All @@ -26,6 +29,9 @@ public void Initialize(Camera camera, WireframeEditControl wireframeEditControl,

Renderer.Self.Camera.X = defaultWidth / 2 - 30;
Renderer.Self.Camera.Y = defaultHeight / 2 - 30;

handGrabCursor = new Cursor("../../../Content/Cursors/cursor-grab.cur");

}

internal void HandleMouseWheel(object sender, MouseEventArgs e)
Expand Down Expand Up @@ -73,6 +79,10 @@ internal void HandleMouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Middle)
{

//Changing cursor to hand when dragging
Cursor.Current = handGrabCursor;

int xChange = e.X - mLastMouseLocation.X;
int yChange = e.Y - mLastMouseLocation.Y;

Expand Down
2 changes: 1 addition & 1 deletion InputLibrary/Cursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void StartCursorSettingFrameStart()

public void SetWinformsCursor(WinCursor cursor)
{
if (!mHasBeenSet)
if (!mHasBeenSet && !MiddleDown)
{
mSetCursor = cursor;
mHasBeenSet = true;
Expand Down