on_gui_click drag & drop support

Things that we aren't going to implement
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

on_gui_click drag & drop support

Post by eradicator »

Long description:
Currently on_gui_click only supports "conventional" clicking, i.e. if the <button down> and <button up> event occur above the same gui element. If the mouse is moved inbetween those two events - i.e. in a circle back to the button - that movement is ignored, and if they happen above different gui elements (i.e. the player holds a mouse button down above an element, drags somewhere else and then releases the mouse button, the event is not fired at all.) then the event is not raised at all. Left Mouse Button clicks do even already seem to have "drag and drop" compatible rendering in that the GuiElement that recives <button down> continues to be rendered with it's clicked_graphical_set style even if the cursor is moved off the button, while right/middle click dragged buttons revert to their default style when the cursor does no longer hover them even if the button is still hold down. Full drag-and-drop style guis would require an event raised for every gui element that the mouse cursor passes over while the mouse button is being held down, containing both the original element, and the hovered over element, and a final event when then mouse button is released. Partial drop-and-drag support would be possible if only the final event was raised.

Short description:
Either extend on_gui_click or introduce a new event on_gui_drag that reports event.button_down_element in combination with either event.button_up_element or event.cursor_hover_element.

Usecase:

Any GUI element where the player needs to reorder a list of elements, this could be for example a research queue, priorities for different inventories to be accessed or a list of ore fields that are being monitored.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

robertpaulson
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jun 18, 2017 2:21 pm
Contact:

Re: on_gui_click drag & drop support

Post by robertpaulson »

+1

This is a great idea and I would love to see this implemented. especially the drag/drop has a great potential.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: on_gui_click drag & drop support

Post by Rseding91 »

The base GUI logic doesn't support the concept of click-and-drag starting on one widget and ending on another so that makes this request highly improbable.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: on_gui_click drag & drop support

Post by eradicator »

Rseding91 wrote:The base GUI logic doesn't support the concept of click-and-drag starting on one widget and ending on another so that makes this request highly improbable.
As described above for partial support it would be sufficient to have seperate <button_down> and <button_up> events. Are you saying that the base logic doesn't even support that? :|
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: on_gui_click drag & drop support

Post by Rseding91 »

eradicator wrote:
Rseding91 wrote:The base GUI logic doesn't support the concept of click-and-drag starting on one widget and ending on another so that makes this request highly improbable.
As described above for partial support it would be sufficient to have seperate <button_down> and <button_up> events. Are you saying that the base logic doesn't even support that? :|
Yes.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: on_gui_click drag & drop support

Post by eradicator »

Rseding91 wrote:
eradicator wrote:As described above for partial support it would be sufficient to have seperate <button_down> and <button_up> events. Are you saying that the base logic doesn't even support that? :|
Yes.
:cry:

This makes me curious how "slider" type elements work in the base GUI though. Would you be nice enough to explain that? ;)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: on_gui_click drag & drop support

Post by Rseding91 »

eradicator wrote:
Rseding91 wrote:
eradicator wrote:As described above for partial support it would be sufficient to have seperate <button_down> and <button_up> events. Are you saying that the base logic doesn't even support that? :|
Yes.
:cry:

This makes me curious how "slider" type elements work in the base GUI though. Would you be nice enough to explain that? ;)
A slider is all 1 widget that receives the mouse-drag event and renders the "pip" at the new location on the same 1 widget.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: on_gui_click drag & drop support

Post by eradicator »

Rseding91 wrote:A slider is all 1 widget that receives the mouse-drag event and renders the "pip" at the new location on the same 1 widget.
Ok. I'll guess i'll just wait a few years then... :ugeek:

I'm a bit confused though as you said in another thread that the slider was a combination of 4 widgets and gave that as a reason for not being able to add it to the api.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: on_gui_click drag & drop support

Post by Rseding91 »

eradicator wrote:
Rseding91 wrote:A slider is all 1 widget that receives the mouse-drag event and renders the "pip" at the new location on the same 1 widget.
Ok. I'll guess i'll just wait a few years then... :ugeek:

I'm a bit confused though as you said in another thread that the slider was a combination of 4 widgets and gave that as a reason for not being able to add it to the api.
The slider itself is 1 widget, the slider with the text display and the label is 4 different widgets.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: on_gui_click drag & drop support

Post by eradicator »

Rseding91 wrote: The slider itself is 1 widget, the slider with the text display and the label is 4 different widgets.
So wouldn't it be possible for modders to just "manually" add the text+label on the lua side if the slider was available via the API? Or does it not fire an on_gui_click event for every mouse movement? Just trying to understand why you seem to be saying that the slider can only be used as a groupd-of-4-widgets.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: on_gui_click drag & drop support

Post by Rseding91 »

eradicator wrote:
Rseding91 wrote: The slider itself is 1 widget, the slider with the text display and the label is 4 different widgets.
So wouldn't it be possible for modders to just "manually" add the text+label on the lua side if the slider was available via the API? Or does it not fire an on_gui_click event for every mouse movement? Just trying to understand why you seem to be saying that the slider can only be used as a groupd-of-4-widgets.
I'm not, that's just what was requested in the other topic.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't implement”