File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -595,7 +595,10 @@ def mouseMoveEvent(self, event):
595
595
def _getRelativePosition (self , yPixel ):
596
596
"""yPixel : pixel position into _ColorScale widget reference"""
597
597
# widgets are bottom-top referencial but we display in top-bottom referential
598
- return 1.0 - (yPixel - self .margin ) / float (self .height () - 2 * self .margin )
598
+ height = float (self .height () - 2 * self .margin )
599
+ if height == 0 :
600
+ return 0.0
601
+ return 1.0 - (yPixel - self .margin ) / height
599
602
600
603
def getValueFromRelativePosition (self , value ):
601
604
"""Return the value in the colorMap from a relative position in the
@@ -814,8 +817,9 @@ def _getRelativePosition(self, val):
814
817
815
818
if normMin == normMax :
816
819
return 0.0
817
- else :
818
- return 1.0 - (normVal - normMin ) / (normMax - normMin )
820
+ if not numpy .isfinite (normVal ):
821
+ return 0.0
822
+ return 1.0 - (normVal - normMin ) / (normMax - normMin )
819
823
820
824
def _paintTick (self , val , painter , majorTick = True ):
821
825
"""
You can’t perform that action at this time.
0 commit comments