diff options
author | bobzel <zzzman@gmail.com> | 2025-05-09 23:02:18 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-05-09 23:02:18 -0400 |
commit | afc2b90c3eab26a8a3d17bdb711652b68d2528d9 (patch) | |
tree | 58f9edb8a79c9e1e983c9cc4e8c07988e7dd5f1d /src/client/views/ObservableReactComponent.tsx | |
parent | 076bdacc5f05dd124823981e49174d276a7aebfd (diff) | |
parent | 299398cb7e21259de3bf7597995840b84e7e0590 (diff) |
Merge branch 'master' into lanyi-branch
Diffstat (limited to 'src/client/views/ObservableReactComponent.tsx')
-rw-r--r-- | src/client/views/ObservableReactComponent.tsx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/client/views/ObservableReactComponent.tsx b/src/client/views/ObservableReactComponent.tsx index 2290516dc..cf4bf991e 100644 --- a/src/client/views/ObservableReactComponent.tsx +++ b/src/client/views/ObservableReactComponent.tsx @@ -16,15 +16,13 @@ export abstract class ObservableReactComponent<T> extends React.Component<T, obj makeObservable(this); } __passiveWheel: HTMLElement | null = null; - _isContentActive: () => boolean | undefined = () => false; + __isContentActive: () => boolean | undefined = () => false; /** * default method to stop wheel events from bubbling up to parent components. * @param e */ - onPassiveWheel = (e: WheelEvent) => { - if (this._isContentActive?.()) e.stopPropagation(); - }; + onPassiveWheel = (e: WheelEvent) => this.__isContentActive?.() && e.stopPropagation(); /** * This fixes the problem where a component uses wheel events to scroll, but is nested inside another component that @@ -36,7 +34,7 @@ export abstract class ObservableReactComponent<T> extends React.Component<T, obj * @param onPassiveWheel an optional function to call to handle the wheel event (and block its propagation. If omitted, the event won't propagate. */ fixWheelEvents = (ele: HTMLElement | null, isContentActive: () => boolean | undefined, onPassiveWheel?: (e: WheelEvent) => void) => { - this._isContentActive = isContentActive; + this.__isContentActive = isContentActive; this.__passiveWheel?.removeEventListener('wheel', onPassiveWheel ?? this.onPassiveWheel); this.__passiveWheel = ele; ele?.addEventListener('wheel', onPassiveWheel ?? this.onPassiveWheel, { passive: false }); |