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

 Share

  • Recently Browsing   0 members

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