GarageGames / Torque2D

MIT Licensed Open Source version of Torque 2D game engine from GarageGames
MIT License
1.67k stars 1.56k forks source link

Tooltip timer does not reset between GUI controls #387

Closed ParodyGames closed 7 years ago

ParodyGames commented 7 years ago

Even though you can set different hover timers on GUI controls, once any tool top becomes active on an item in a GUI then all other controls on that GUI will show their text as soon as the mouse enters them with no hover timer delay.

ParodyGames commented 7 years ago

Not super familiar with Github, or how to actually submit a proposed fix. But, to fix this behavior in guiCanvas.cc you can add two lines in with the onMouseLeave handling. The updated function should look like this:

void GuiCanvas::findMouseControl(const GuiEvent &event)
{
   if(size() == 0)
   {
      mMouseControl = NULL;
      return;
   }
   GuiControl *controlHit = findHitControl(event.mousePoint);
   if(controlHit != static_cast<GuiControl*>(mMouseControl))
   {
       if (bool(mMouseControl))
       {
           mMouseControl->onMouseLeave(event);
           hoverControlStart = Platform::getRealMilliseconds();
           hoverPositionSet = false;
       }
      mMouseControl = controlHit;
      mMouseControl->onMouseEnter(event);

   }
}
greenfire27 commented 7 years ago

Thanks, ParodyGames! If you checked in the change you could create a pull request by following these instructions: https://github.com/GarageGames/Torque2D/wiki/Contributing#creating-a-new-branch-for-a-pull-request

Give it a try if you want. Otherwise I will create a pull request in a few days with your suggested change. Thanks for contributing!

greenfire27 commented 7 years ago

I tested your fix and it works great. I've merged the code and I'm closing this issue. Thanks again for contributing!