Jump to content

Grab cursor style


tgsilveyra
 Share

Recommended Posts

Hi im new at Phaser, and im trying to change the style of the cursor to the grab hand. I know you can use the hand cursor with useHandCursor, but i was wondering if there is a way to set a grabbing hand.

on my game i have a draggable background, So the cursor style at first is the hand and when input is down i want to change to grab and u can drag through the background.

background.events.onInputDown.add(function(){
   mainLevel.content.classList.remove("grabCursor");
   mainLevel.content.className += ' grabbingCursor';
})
background.events.onInputUp.add(function(){
    mainLevel.content.classList.remove("grabbingCursor");
    mainLevel.content.className += ' grabbingCursor';
})

i try this and is not working. On mainlevel.content i have a reference of the canvas, and this is the css of those classes

 

.grabCursor{
     cursor: -webkit-grab;
     cursor:-moz-grab;
}

.grabbingCursor{
        cursor: -webkit-grabbing;
        cursor:-moz-grabbing;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...