コード例 #1
0
  protected void onDragInProgress(ViewportDragInProgressEvent event) {
    if (this.active) {
      Bounds bounds = event.getPixelBounds().normalizeBounds();

      this.view.setRelX(bounds.getLeft().intValue());
      this.view.setRelY(bounds.getTop().intValue());
      this.view.setWidth(bounds.getWidth().intValue());
      this.view.setHeight(bounds.getHeight().intValue());

      this.view.show();
    }
  }
コード例 #2
0
  protected void onDragFinished(ViewportDragFinishedEvent event) {
    if (this.active) {
      this.view.hide();

      if (this.currentDomainBounds != null) {
        if (dragNotAccidental(event)) {
          Bounds proportionalBounds = event.getProportionalBounds().normalizeBounds();

          Bounds newBounds = this.currentDomainBounds.transformProportional(proportionalBounds);

          if (this.currentMaxDomainBounds != null) {
            if (!this.currentMaxDomainBounds.containsHorizontally(
                newBounds.getLeft(), newBounds.getRight())) {
              newBounds = newBounds.setLeft(this.currentDomainBounds.getLeft());
              newBounds = newBounds.setRight(this.currentDomainBounds.getRight());
            }

            if (!this.currentMaxDomainBounds.containsVertically(
                newBounds.getTop(), newBounds.getBottom())) {
              newBounds = newBounds.setTop(this.currentDomainBounds.getTop());
              newBounds = newBounds.setBottom(this.currentDomainBounds.getBottom());
            }
          }

          // WORKAROUND to have a maximum zoom level in the time frame Bug 508
          long begin = newBounds.getLeft().longValue();
          long end = newBounds.getRight().longValue();
          if (ClientUtils.isValidTimeFrameForZoomIn(begin, end)) {
            this.handlerManager.fireEvent(new SwitchAutoscaleEvent(false));
            this.handlerManager.fireEvent(new SetDomainBoundsEvent(newBounds));
            if (this.fireLoadImageDataEvent) {
              this.handlerManager.fireEvent(new LoadImageDataEvent());
            }
          }
        }
      }
    }
  }