Skip to content

Button.Click() fires two button clicked events #265

@mat007

Description

@mat007

Hi!

From the latest master, running go run ./_examples/widget_demos/button, and pressing b, we can see two lines printed to the output, meaning the pressed event gets sent twice:

button clicked
button clicked

I tracked it to these last changes on the button code: 43704ad#diff-62a61810f876fc3fd542cd9078b1d4a41c9efb8a841e0d97c4376c1fac9d59e2R720-R727

	if b.justSubmitted {
		b.widget.MouseButtonClickedEvent.Fire(&WidgetMouseButtonClickedEventArgs{
			Widget:  b.widget,
			Button:  ebiten.MouseButtonLeft,
			OffsetX: offx,
			OffsetY: offy,
		})
	}

The commit has four changes associated:

* Fix duplicate keyboard entries
* Fix default button click buttons not triggering click event
* Revert changes to button text positioning
* Update TextOpts.Insets to TextOpts.Padding

Which one was the reason for the code addition? I suspect the second one, is that correct?
What was it fixing exactly?

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions