From 9f1a445e43ce269fdc841ee6c63d891e6e92580d Mon Sep 17 00:00:00 2001 From: Fff Date: Fri, 11 Sep 2026 19:29:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(wheel):=20=E4=BF=AE=E5=A4=8D=E8=BD=AE?= =?UTF-8?q?=E7=9B=98=E9=A1=BA=E6=97=B6=E9=92=88=E5=88=87=E6=8D=A2=E8=87=B3?= =?UTF-8?q?=E6=AD=A3=E4=B8=8A=E6=96=B9=E9=80=89=E5=8C=BA=E5=BB=B6=E8=BF=9F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 补齐跨越 0° 的扇区命中判定 - 鼠标从左上方进入正上方选区时立即切换,无需转到 0° --- .../lib/v2/wheel/client/gui/component/WheelWidget.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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;