on_gui_click drag & drop support
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
on_gui_click drag & drop support
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.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Long Handed Inserter
- Posts: 92
- Joined: Sun Jun 18, 2017 2:21 pm
- Contact:
Re: on_gui_click drag & drop support
+1
This is a great idea and I would love to see this implemented. especially the drag/drop has a great potential.
This is a great idea and I would love to see this implemented. especially the drag/drop has a great potential.
Re: on_gui_click drag & drop support
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.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_gui_click drag & drop support
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?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.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: on_gui_click drag & drop support
Yes.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?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.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_gui_click drag & drop support
Rseding91 wrote:Yes.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?
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: on_gui_click drag & drop support
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.eradicator wrote:Rseding91 wrote:Yes.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?
This makes me curious how "slider" type elements work in the base GUI though. Would you be nice enough to explain that?
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_gui_click drag & drop support
Ok. I'll guess i'll just wait a few years then...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.
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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: on_gui_click drag & drop support
The slider itself is 1 widget, the slider with the text display and the label is 4 different widgets.eradicator wrote:Ok. I'll guess i'll just wait a few years then...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.
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.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: on_gui_click drag & drop support
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.Rseding91 wrote: The slider itself is 1 widget, the slider with the text display and the label is 4 different 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.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: on_gui_click drag & drop support
I'm not, that's just what was requested in the other topic.eradicator wrote: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.Rseding91 wrote: 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.