Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 2d097cb

Browse files
committed
fix flutter bug (refer to flutter/flutter@b3a5be8)
1 parent 28733b2 commit 2d097cb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Runtime/gestures/mouse_tracking.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public void attachAnnotation(MouseTrackerAnnotation annotation) {
7575

7676
public void detachAnnotation(MouseTrackerAnnotation annotation) {
7777
_TrackedAnnotation trackedAnnotation = this._findAnnotation(annotation);
78-
D.assert(trackedAnnotation != null, $"Tried to detach an annotation that wasn't attached: {annotation}");
7978
foreach (int deviceId in trackedAnnotation.activeDevices) {
8079
annotation.onExit(PointerExitEvent.fromHoverEvent((PointerHoverEvent) this._lastMouseEvent[deviceId]));
8180
}
@@ -125,6 +124,10 @@ _TrackedAnnotation _findAnnotation(MouseTrackerAnnotation annotation) {
125124

126125
return trackedAnnotation;
127126
}
127+
128+
bool isAnnotationAttached(MouseTrackerAnnotation annotation) {
129+
return this._trackedAnnotations.ContainsKey(annotation);
130+
}
128131

129132
public void collectMousePositions() {
130133
void exitAnnotation(_TrackedAnnotation trackedAnnotation, int deviceId) {

Runtime/rendering/proxy_box.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,11 @@ public PointerExitEventListener onPointerExit {
19421942
MouseTrackerAnnotation _hoverAnnotation;
19431943

19441944
void _updateAnnotations() {
1945+
D.assert(this._onPointerEnter != this._hoverAnnotation.onEnter ||
1946+
this._onPointerHover != this._hoverAnnotation.onHover ||
1947+
this._onPointerExit != this._hoverAnnotation.onExit,
1948+
"Shouldn't call _updateAnnotations if nothing has changed.");
1949+
19451950
if (this._hoverAnnotation != null && this.attached) {
19461951
RendererBinding.instance.mouseTracker.detachAnnotation(this._hoverAnnotation);
19471952
}
@@ -1960,6 +1965,8 @@ void _updateAnnotations() {
19601965
else {
19611966
this._hoverAnnotation = null;
19621967
}
1968+
1969+
this.markNeedsPaint();
19631970
}
19641971

19651972
public override void attach(Object owner) {

0 commit comments

Comments
 (0)