+ }
+ }
+ else
+ {
+ // no row (or row that can be adjusted) was pressed. Simulate a ruler
+ // click
+ ap.getScalePanel().mousePressed(evt);
+ }
+ }
+
+ /**
+ * checks whether the annotation row under the mouse click evt's handles the
+ * event
+ *
+ * @param evt
+ * @return false if evt was not handled
+ */
+ boolean matrix_clicked(MouseEvent evt)
+ {
+ int[] rowIndex = getRowIndexAndOffset(evt.getY(),
+ av.getAlignment().getAlignmentAnnotation());
+ if (rowIndex == null)
+ {
+ jalview.bin.Console
+ .error("IMPLEMENTATION ERROR: matrix click out of range.");
+ return false;
+ }
+ int yOffset = rowIndex[1];
+ AlignmentAnnotation[] allAnnotation = av.getAlignment()
+ .getAlignmentAnnotation();
+ if (allAnnotation == null || rowIndex[0] < 0
+ || rowIndex[0] >= allAnnotation.length)
+ {
+ return false;
+ }
+ AlignmentAnnotation clicked = av.getAlignment()
+ .getAlignmentAnnotation()[rowIndex[0]];
+ if (clicked.graph != AlignmentAnnotation.CONTACT_MAP)
+ {
+ return false;
+ }
+
+ // TODO - use existing threshold to select related sections of matrix
+ GraphLine thr = clicked.getThreshold();
+
+ int currentX = getColumnForXPos(evt.getX());
+ ContactListI forCurrentX = av.getContactList(clicked, currentX);
+ if (forCurrentX != null)
+ {
+ ContactGeometry cXcgeom = new ContactGeometry(forCurrentX,
+ clicked.graphHeight);
+ ContactGeometry.contactInterval cXci = cXcgeom.mapFor(yOffset);
+ if (cXci != null)
+ {
+ /**
+ * start and end range corresponding to the row range under the mouse at
+ * column currentX
+ */
+ int fr, to;
+ fr = Math.min(cXci.cStart, cXci.cEnd);
+ to = Math.max(cXci.cStart, cXci.cEnd);
+
+ // double click selects the whole group
+ if (evt.getClickCount() == 2)