Fix: wheel over UI scrolls the list instead of zooming the camera
The orbit rig read the wheel unfiltered for zoom, so scrolling a paint-mode scroll list also zoomed the camera. Gate the zoom behind a shared InputUtil.PointerOverUi() helper (EventSystem raycast); MeshPainter's private IsPointerOverUi() now delegates to the same helper (DRY). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
a4604328d2
commit
50efc7e8b3
3 files changed
+18
-11
No files matched your search
@@ -238,11 +238,13 @@ public class ThirdPersonOrbitInput : MonoBehaviour
|
||||
|
||||
float scale = CurrentScale();
|
||||
|
||||
// Shift/Ctrl+wheel is reserved for the paint brush resize (MeshPainter) - but only in paint
|
||||
// mode (PanEnabled), where the resize actually claims the wheel. Outside paint mode Shift is
|
||||
// the sprint key, so the wheel must still zoom.
|
||||
bool brushResizeClaimsWheel = PanEnabled && (InputUtil.ShiftHeld() || InputUtil.CtrlHeld());
|
||||
float scroll = brushResizeClaimsWheel ? 0f : InputUtil.ReadScroll();
|
||||
// The wheel belongs to the UI when the pointer is over an interactive element (e.g. a scroll
|
||||
// list), so it scrolls the UI instead of zooming. Shift/Ctrl+wheel is likewise reserved for the
|
||||
// paint brush resize (MeshPainter) - but only in paint mode (PanEnabled), where the resize
|
||||
// actually claims the wheel; outside paint mode Shift is the sprint key, so the wheel must zoom.
|
||||
bool wheelClaimed = InputUtil.PointerOverUi()
|
||||
|| (PanEnabled && (InputUtil.ShiftHeld() || InputUtil.CtrlHeld()));
|
||||
float scroll = wheelClaimed ? 0f : InputUtil.ReadScroll();
|
||||
if (!Mathf.Approximately(scroll, 0f))
|
||||
{
|
||||
// One wheel notch = one zoom step (sign only, platform-independent). The step scales with
|
||||
|
||||
Reference in new issue
Block a user