File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,10 @@ public void SnapPositionToMouse() {
226226
227227 var snapEl = this . SnapElement ?? this . autoNavSnapElement ;
228228 if ( snapEl != null ) {
229+ if ( snapEl . Root == null ) {
230+ this . Remove ( ) ;
231+ return ;
232+ }
229233 snap = this . GetSnapOffset ( this . AutoNavAnchor , snapEl . DisplayArea , this . AutoNavOffset ) / this . Scale ;
230234 } else {
231235 var mouseBounds = new RectangleF ( this . SnapPosition ?? this . Input . ViewportMousePosition . ToVector2 ( ) , Vector2 . Zero ) ;
@@ -306,6 +310,11 @@ public void AddToElement(Element elementToHover) {
306310 this . autoNavSnapElement = null ;
307311 }
308312 } ;
313+
314+ elementToHover . OnRemovedFromUi += e => {
315+ this . Remove ( ) ;
316+ this . autoNavSnapElement = null ;
317+ } ;
309318 }
310319
311320 private void Init ( Element elementToHover ) {
You can’t perform that action at this time.
0 commit comments