コード例 #1
0
  @Override
  public void onMouseClick(final MsClickedEvent evt) {
    if (evt.getButton() != MsButtonEvent.LEFT_BUTTON) return;

    if (recorder == null) {
      recorder = new PixelRecorder(getContext(), true);
    }

    // if click did not happen within the bounds of an ImageDisplay then
    // just consume event and return
    if (!recorder.record(evt)) {
      evt.consume();
      return;
    }

    final OptionsChannels options = getOptions();

    final ChannelCollection values = recorder.getValues();

    setChannels(options, values);

    setLastColor(options, recorder.getColor());

    // make sure future options reflect those new values
    options.save();

    // let user know the FG or BG values changed
    statusMessage(getLabel(), values);

    recorder.releaseDataset();

    evt.consume();
  }
コード例 #2
0
ファイル: DefaultToolService.java プロジェクト: joevegan/xray
 @EventHandler
 protected void onEvent(final MsClickedEvent event) {
   if (event.isConsumed()) return;
   final Tool aTool = getActiveTool();
   if (eventOk(event, aTool)) aTool.onMouseClick(event);
   for (final Tool tool : getAlwaysActiveTools()) {
     if (event.isConsumed()) break;
     if (eventOk(event, tool)) tool.onMouseClick(event);
   }
 }