Browse Source

Only dispatch ActionEvent on mouse down in SvgButton.

tags/v2.1.1
Andrew Belt 2 years ago
parent
commit
d1683067c6
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      src/app/SvgButton.cpp

+ 7
- 7
src/app/SvgButton.cpp View File

@@ -21,11 +21,10 @@ SvgButton::SvgButton() {
void SvgButton::onButton(const ButtonEvent& e) { void SvgButton::onButton(const ButtonEvent& e) {
OpaqueWidget::onButton(e); OpaqueWidget::onButton(e);


// Accept left and right-click dragging.
if (e.action == GLFW_PRESS && (e.button == GLFW_MOUSE_BUTTON_LEFT || e.button == GLFW_MOUSE_BUTTON_RIGHT)) {
// Dispatch ActionEvent on left click
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) {
ActionEvent eAction; ActionEvent eAction;
onAction(eAction); onAction(eAction);
e.consume(this);
} }
} }


@@ -64,10 +63,11 @@ void SvgButton::onDragEnd(const DragEndEvent& e) {




void SvgButton::onDragDrop(const DragDropEvent& e) { void SvgButton::onDragDrop(const DragDropEvent& e) {
if (e.origin == this) {
ActionEvent eAction;
onAction(eAction);
}
// Don't dispatch ActionEvent on DragDrop because it's already called on mouse down.
// if (e.origin == this) {
// ActionEvent eAction;
// onAction(eAction);
// }
} }






Loading…
Cancel
Save