Explorar o código

fix gui event propagtion

leonsal %!s(int64=8) %!d(string=hai) anos
pai
achega
b95232cbfb
Modificáronse 3 ficheiros con 6 adicións e 1 borrados
  1. 2 1
      gui/button.go
  2. 2 0
      gui/checkradio.go
  3. 2 0
      gui/root.go

+ 2 - 1
gui/button.go

@@ -139,6 +139,7 @@ func (b *Button) onCursor(evname string, ev interface{}) {
 	default:
 		return
 	}
+	b.root.StopPropagation(StopAll)
 }
 
 // onMouseEvent process subscribed mouse events
@@ -156,7 +157,7 @@ func (b *Button) onMouse(evname string, ev interface{}) {
 	default:
 		return
 	}
-	b.root.StopPropagation(Stop3D)
+	b.root.StopPropagation(StopAll)
 }
 
 // onKey processes subscribed key events

+ 2 - 0
gui/checkradio.go

@@ -185,6 +185,7 @@ func (cb *CheckRadio) onMouse(evname string, ev interface{}) {
 			cb.Dispatch(OnClick, nil)
 		}
 	}
+	cb.root.StopPropagation(StopAll)
 }
 
 // onCursor process OnCursor* events
@@ -196,6 +197,7 @@ func (cb *CheckRadio) onCursor(evname string, ev interface{}) {
 		cb.cursorOver = false
 	}
 	cb.update()
+	cb.root.StopPropagation(StopAll)
 }
 
 // onKey receives subscribed key events

+ 2 - 0
gui/root.go

@@ -296,9 +296,11 @@ func (r *Root) sendPanels(x, y float32, evname string, ev interface{}) {
 			}
 			// Mouse button event
 		} else {
+			log.Error("Dispatch event:%s to %T z:%v", evname, ipan, pan.Position().Z)
 			pan.Dispatch(evname, ev)
 		}
 		if (r.stopPropagation & StopGUI) != 0 {
+			log.Error("stopPropagation:%v", r.stopPropagation)
 			break
 		}
 	}