Author Topic: Can I use onHover when mouse button is held?  (Read 4387 times)

Johanna

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Can I use onHover when mouse button is held?
« on: April 09, 2015, 07:14:32 AM »
Can I use onHover when mouse button is held? - Currently, it does not seem possible.

What I want to achieve is that a sprite is shown as long as I hold the left mouse button down and move the mouse over a grid of buttons.
Showing the sprite works fine when I use onHover, but I can't get it working together with holding the mouse button down.

Can I add some code into the "if(isOver)" brackets which makes this possible?

Or can I use something else to check if the mouse button is hold and the cursor is currently over the buttons?

PS: I do not want to press the buttons while holding the mouse button down. I just want to show the current position of the mouse on the grid by showing the sprite.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Can I use onHover when mouse button is held?
« Reply #1 on: April 09, 2015, 03:59:04 PM »
I am not clear on what you are trying to do there. Hover event while button is held down? There is no such thing. Hover event only happens when no mouse button is held down and you move the mouse directly over a collider. When you press on the collider, you get OnPress(true). When you release -- OnPress(false). When you drag the mouse away while holding the button you get OnDragOut. When you drag it over something while holding the button, you get OnDragOver.

Johanna

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: Can I use onHover when mouse button is held?
« Reply #2 on: April 10, 2015, 02:12:08 PM »
Thanks, "OnDragOver" was what I was searching for!