+
+ // set up values in case the alignment is wrapped
+ int verticalOffset = 0;
+ int horizontalOffset = 0;
+ if (av.getWrapAlignment())
+ {
+ int hgap = charHeight;
+ if (av.getScaleAboveWrapped())
+ {
+ hgap += charHeight;
+ }
+
+ // get the start res of the group and work out the offsets for it in the wrapped alignment
+ int groupstart = group.getStartRes();
+ int cWidth = (getWidth() - LABEL_EAST - LABEL_WEST) / charWidth;
+
+ // group is in which slice of alignment? res position / width in residues
+ int slice = groupstart / cWidth;
+ // vertical offset is increased by slice number * number of sequences * height of each sequence
+ verticalOffset = slice * (av.getAlignment().getHeight() * charHeight
+ + getAnnotationHeight() + hgap) + hgap;
+
+ // horizontal offset is number of residues to subtract from group residue
+ // position
+ horizontalOffset = (slice * cWidth);
+ }