diff --git a/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/client/gui/component/WheelWidget.java b/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/client/gui/component/WheelWidget.java index 73f5995a..5c45bf4f 100644 --- a/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/client/gui/component/WheelWidget.java +++ b/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/client/gui/component/WheelWidget.java @@ -630,9 +630,11 @@ public void checkMousePos(double mouseX, double mouseY) { double rotation = cursorPos.x < 0 ? Math.PI - rot : Math.PI + rot; this.mouseAngleRad = (float) (rotation % (Math.PI * 2)); for (WheelSection section : this.sections) { - if (( - section.angleStart > section.angleEnd && rotation >= section.angleStart || rotation >= section.angleStart && rotation <= section.angleEnd - ) && section.selectable) { + // 跨越 0° 的扇区由圆周末尾与开头两段组成。 + boolean containsRotation = section.angleStart > section.angleEnd + ? rotation >= section.angleStart || rotation <= section.angleEnd + : rotation >= section.angleStart && rotation <= section.angleEnd; + if (containsRotation && section.selectable) { this.currentAngle = section.angle; this.setCurrentSectionIndex(this.sections.indexOf(section)); break;