@Override
	public void onMouseUp(MouseUpEvent event) {
		// handle click if any?
		if (dragging) {
			// shift or CTRL is used when depressed either at beginning or end:
			shiftOrCtrl = (event.isShiftKeyDown() || event.isControlKeyDown());

			if (timestamp + clickTimeout > new Date().getTime()
					&& (bounds.getWidth() < pixelTolerance || bounds.getHeight() < pixelTolerance)) {
				stopDragging();
				// click behavior instead of drag
				ToggleSelectionAction action = new ToggleSelectionAction(mapWidget, priorityToSelectedLayer,
						pixelTolerance);
				action.toggle(getScreenPosition(event), !shiftOrCtrl);
				return;
			}
		}
		// normal "rectangle" handling
		super.onMouseUp(event);
	}
@ Override public void onMouseUp ( MouseUpEvent event ) { if ( dragging ) { shiftOrCtrl = ( event . isShiftKeyDown ( ) || event . isControlKeyDown ( ) ) ; if ( timestamp + clickTimeout > new Date ( ) . getTime ( ) && ( bounds . getWidth ( ) < pixelTolerance || bounds . getHeight ( ) < pixelTolerance ) ) { stopDragging ( ) ; ToggleSelectionAction action = new ToggleSelectionAction ( mapWidget , priorityToSelectedLayer , pixelTolerance ) ; action . toggle ( getScreenPosition ( event ) , ! shiftOrCtrl ) ; return ; } } super . onMouseUp ( event ) ; }
First mouse button: publish a toggle event on the selection topic for the referenced MapWidget. Second mouse
button opens a menu.

@param event
event