File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 28
28
"""
29
29
30
30
import json
31
+ import math
31
32
import os
32
33
from typing import Optional
33
34
60
61
QDialogButtonBox ,
61
62
QWidget ,
62
63
)
63
- from shapely import Point
64
64
65
65
from ORStools import (
66
66
RESOURCE_PREFIX ,
@@ -605,16 +605,21 @@ def change_cursor_on_hover(self, pos):
605
605
QApplication .restoreOverrideCursor ()
606
606
607
607
def check_annotation_hover (self , pos ):
608
- click = Point ( pos .x (), pos .y ())
608
+ click = [ pos .x (), pos .y ()]
609
609
dists = {}
610
610
for i , anno in enumerate (self .annotations ):
611
611
x , y = anno .mapPosition ()
612
612
mapcanvas = self ._iface .mapCanvas ()
613
613
point = mapcanvas .getCoordinateTransform ().transform (x , y ) # die ist es
614
- p = Point (point .x (), point .y ())
615
- dist = click .distance (p )
616
- if dist > 0 :
617
- dists [dist ] = anno
614
+ p = [point .x (), point .y ()]
615
+
616
+ distance = 0.0
617
+ for i in range (len (click )):
618
+ distance += (click [i ] - p [i ]) ** 2
619
+ distance = math .sqrt (distance )
620
+
621
+ if distance > 0 :
622
+ dists [distance ] = anno
618
623
if dists and min (dists ) < self .click_dist :
619
624
idx = dists [min (dists )]
620
625
return idx
You can’t perform that action at this time.
0 commit comments