diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index da2f6f174..f09c34b07 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -455,11 +455,11 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous private void doWithCellElementDragged(int evtX, int evtY, CellSelection cs) { ElementCasePane reportPane = grid.getElementCasePane(); - java.awt.Rectangle cellRectangle = cs.toRectangle(); + java.awt.Rectangle startRec = cs.toRectangle(); - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); - if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) { - grid.getDragRectangle().setBounds(cellRectangle); + ColumnRow currentMouseCell = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution); + if (startRec.contains(currentMouseCell.getColumn(), currentMouseCell.getRow())) { + grid.getDragRectangle().setBounds(startRec); } else { if (isOutECBlockPane(evtX, evtY)) { return; @@ -467,12 +467,12 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous int xDistance = evtX - this.oldEvtX; int yDistance = evtY - this.oldEvtY; int dragDirection = calculateDragDirection(xDistance, yDistance); - grid.getDragRectangle().x = calculateDragRectangleX(selectedCellPoint, cellRectangle, dragDirection); - grid.getDragRectangle().y = calculateDragRectangleY(selectedCellPoint, cellRectangle, dragDirection); - grid.getDragRectangle().width = calculateDragRectangleWidth(selectedCellPoint, cellRectangle, dragDirection); - grid.getDragRectangle().height = calculateDragRectangleHeight(selectedCellPoint, cellRectangle, dragDirection); + grid.getDragRectangle().x = calculateDragRectangleX(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().y = calculateDragRectangleY(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().width = calculateDragRectangleWidth(currentMouseCell, startRec, dragDirection); + grid.getDragRectangle().height = calculateDragRectangleHeight(currentMouseCell, startRec, dragDirection); } - reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn() + 1, selectedCellPoint.getRow() + 1); + reportPane.ensureColumnRowVisible(currentMouseCell.getColumn() + 1, currentMouseCell.getRow() + 1); } private int calculateDragDirection(int xDistance, int yDistance) {