コード例 #1
1
ファイル: GlancePanel.java プロジェクト: Natinux/CodeGlance
    @Override
    public void mouseDragged(MouseEvent e) {

      if (resizing) {
        config.width = widthStart + (resizeStart - e.getXOnScreen());
        if (config.width < 1) {
          config.width = 1;
        }
        configService.dispatch().configChanged();
      }

      if (dragging) {
        // Disable animation when dragging for better experience.
        editor.getScrollingModel().disableAnimation();

        editor
            .getScrollingModel()
            .scrollVertically(
                scrollStart + coords.pixelsToLines(e.getY() - mouseStart) * editor.getLineHeight());
        editor.getScrollingModel().enableAnimation();
      }
    }
コード例 #2
0
ファイル: GlancePanel.java プロジェクト: Natinux/CodeGlance
 @Override
 public void mouseClicked(MouseEvent e) {
   if (!config.jumpOnMouseDown) {
     editor
         .getScrollingModel()
         .scrollTo(
             editor.offsetToLogicalPosition(
                 coords.screenSpaceToOffset(e.getY(), config.percentageBasedClick)),
             ScrollType.CENTER);
   }
 }
コード例 #3
0
ファイル: GlancePanel.java プロジェクト: Natinux/CodeGlance
    @Override
    public void mousePressed(MouseEvent e) {
      if (!dragging && inResizeGutter(e.getX())) {
        resizing = true;
      } else if (!resizing) {
        dragging = true;
      }

      if (resizing) {
        resizeStart = e.getXOnScreen();
        widthStart = config.width;
      }

      if (dragging) {
        Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
        int firstVisibleLine = getMapYFromEditorY((int) visibleArea.getMinY());
        int height =
            coords.linesToPixels(
                (int) ((visibleArea.getMaxY() - visibleArea.getMinY()) / editor.getLineHeight()));

        int panelY = e.getY() - getY();

        if (config.jumpOnMouseDown
            && (panelY <= firstVisibleLine || panelY >= (firstVisibleLine + height))) {
          editor.getScrollingModel().disableAnimation();
          editor
              .getScrollingModel()
              .scrollTo(
                  editor.offsetToLogicalPosition(
                      coords.screenSpaceToOffset(e.getY(), config.percentageBasedClick)),
                  ScrollType.CENTER);
          editor.getScrollingModel().enableAnimation();
        }

        scrollStart = editor.getScrollingModel().getVerticalScrollOffset();
        mouseStart = e.getY();
      }
    }