Pārlūkot izejas kodu

fix gui event propagtion

leonsal 8 gadi atpakaļ
vecāks
revīzija
b95232cbfb
3 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  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
 		}
 	}