override fun mouseDragged()

in src/main/kotlin/com/jetbrains/interactiveRebase/listeners/CircleDragAndDropListener.kt [101:145]


    override fun mouseDragged(e: MouseEvent) {
        maxY = parent.branchPanel.height - circle.height
        if (!commit.getChangesAfterPick().any { it is DropCommand || it is CollapseCommand } &&
            parent.branch.isWritable
        ) {
            parent.branchPanel.setComponentZOrder(circle, 0)
            wasDragged = true
            commit.isDragged = true
            val newCircleY = e.yOnScreen - parent.branchPanel.locationOnScreen.y - circle.height / 2

            setCurrentCircleLocation(newCircleY)

            val newIndex = findNewBranchIndex()
            circles.forEachIndexed { index, circle ->
                circle.colorTheme = circlesThemes[index]
                circle.commit.isHovered = false
                circle.repaint()
            }
            if (isHoveringOverCircle(newIndex - 1, newIndex + 1)) {
                val targetCircle = circles[squashIntoIndex]
                if (targetCircle.commit.getChangesAfterPick().any { it is DropCommand || it is CollapseCommand }) {
                    squashIntoIndex = -1
                } else {
                    circle.colorTheme = Palette.BLUE_THEME_LIGHT
                    circle.commit.isHovered = true
                    circle.repaint()
                    targetCircle.colorTheme = Palette.BLUE_THEME_LIGHT
                    targetCircle.commit.isHovered = true
                    targetCircle.repaint()
                }
            }
            if (newIndex != currentIndex) {
                updateIndices(newIndex, currentIndex)
                repositionOnDrag()
                parent.repaint()
                currentIndex = newIndex
            }

            // Handle visual indication of movement limits
//        indicateLimitedVerticalMovement(newCircleY)

            (parent.parent as GraphPanel).repaint()
        }
        e.consume()
    }