Request: A way for sprite-button to fire event on mouse_down

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
KingIonTrueLove
Inserter
Inserter
Posts: 24
Joined: Sun Jun 04, 2017 1:38 am
Contact:

Request: A way for sprite-button to fire event on mouse_down

Post by KingIonTrueLove »

Right off the bat, I know there is a lot of issues that could arise from this request but thought I would atleast ask and start a discussion.

I made a mod called Placeables that generates many sprite-buttons that when clicked puts the shown item from the inventory into the players hand.

The problem is that the on_gui_click event fires when the player *releases* the mouse button. I have gotten so fast at using my mod that by the time I actually release the mouse button my mouse is halfway across the screen, so a lot of times the event doesn't even fire. (example image below)
I originally thought it was a bug in my mod because the 'click' sound effect would still play, as that happens on mouse_down.

Image

After testing many of the vanilla buttons in Factorio, it seems like half the buttons that could be said to be 'sprite-buttons' activate on mouse_down: items in hotbar, items in inventory, logistics requests, crafting tabs.
The other half of the buttons activate on mouse_up: elements on top-right of menus(like close), the icons on the right of the toolbar, buttons on the right side (trains, tips, achievements, etc)

It seems that all the ones that Factorio fires on mouse_down are buttons that are involved with using items, and the mouse_up ones are involved with menus and such. It would just be nice if modders could choose when mouse_down is needed, and match the GUI experience of Factorio.
Post Reply

Return to “Modding interface requests”