File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 2828"""
2929
3030import json
31+ import math
3132import os
3233from typing import Optional
3334
6061 QDialogButtonBox ,
6162 QWidget ,
6263)
63- from shapely import Point
6464
6565from ORStools import (
6666 RESOURCE_PREFIX ,
@@ -605,16 +605,21 @@ def change_cursor_on_hover(self, pos):
605605 QApplication .restoreOverrideCursor ()
606606
607607 def check_annotation_hover (self , pos ):
608- click = Point ( pos .x (), pos .y ())
608+ click = [ pos .x (), pos .y ()]
609609 dists = {}
610610 for i , anno in enumerate (self .annotations ):
611611 x , y = anno .mapPosition ()
612612 mapcanvas = self ._iface .mapCanvas ()
613613 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
618623 if dists and min (dists ) < self .click_dist :
619624 idx = dists [min (dists )]
620625 return idx
You can’t perform that action at this time.
0 commit comments