From 7e46ad7153a1c8acdd1e888ae6b39c280f7aa9c6 Mon Sep 17 00:00:00 2001 From: fengpingping Date: Thu, 17 Oct 2024 10:45:50 +0800 Subject: [PATCH] fix: Retrieve pointerLockElement from shadowRoot --- src/components/NumericInput/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/NumericInput/index.ts b/src/components/NumericInput/index.ts index 9d3e1a36..fc183546 100644 --- a/src/components/NumericInput/index.ts +++ b/src/components/NumericInput/index.ts @@ -213,8 +213,20 @@ class NumericInput extends InputElement { super._onInputKeyDown(evt); } + protected _getPointerLockElementByShadowRoot(pointerLockElement: any): boolean { + const shadowRoot = pointerLockElement.shadowRoot; + if (shadowRoot) { + const pointerLockElement = shadowRoot.pointerLockElement; + return this._getPointerLockElementByShadowRoot(pointerLockElement); + } + return pointerLockElement === this._sliderControl.dom; + } + protected _isScrolling() { if (!this._sliderControl) return false; + if (document.pointerLockElement && document.pointerLockElement.shadowRoot) { + return this._getPointerLockElementByShadowRoot(document.pointerLockElement); + } return document.pointerLockElement === this._sliderControl.dom; }