X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FAnnotationColourGradient.java;h=c74fdbc62f83ce0dd089217dd817b08685d37483;hb=424648b2e57e45eaa21c006b44828d8fca418581;hp=c28ea5f7dd727fd6f1af5948a7dd1122f7d7a762;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index c28ea5f..c74fdbc 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -185,7 +185,7 @@ public class AnnotationColourGradient extends FollowerColourScheme } else { - seqannot = new IdentityHashMap(); + seqannot = new IdentityHashMap<>(); } // resolve the context containing all the annotation for the sequence AnnotatedCollectionI alcontext = alignment instanceof AlignmentI @@ -414,14 +414,17 @@ public class AnnotationColourGradient extends FollowerColourScheme && aboveAnnotationThreshold == ABOVE_THRESHOLD && value >= ann.threshold.value) { - range = (value - ann.threshold.value) + range = ann.graphMax == ann.threshold.value ? 1f + : (value - ann.threshold.value) / (ann.graphMax - ann.threshold.value); } else if (thresholdIsMinMax && ann.threshold != null && aboveAnnotationThreshold == BELOW_THRESHOLD && value <= ann.threshold.value) { - range = (value - ann.graphMin) / (ann.threshold.value - ann.graphMin); + range = ann.graphMin == ann.threshold.value ? 0f + : (value - ann.graphMin) + / (ann.threshold.value - ann.graphMin); } else {