@24i/bigscreen-sdk 1.0.3-alpha.2087 → 1.0.3-alpha.2091
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -524,6 +524,7 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
|
|
|
524
524
|
forEach(this.groups, (group, index) => {
|
|
525
525
|
this.updateItemsInGroup(group, index * itemsInGroup);
|
|
526
526
|
});
|
|
527
|
+
base.mrcuRef.current?.handleArrowState();
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
prependData(data: T[]) {
|
|
@@ -549,5 +550,6 @@ export class UnifiedGridController<T> implements IUnifiedGridController<T> {
|
|
|
549
550
|
this.scrollIndexToPixels(this.scrollIndex),
|
|
550
551
|
);
|
|
551
552
|
this.focusCurrentItem();
|
|
553
|
+
base.mrcuRef.current?.handleArrowState();
|
|
552
554
|
}
|
|
553
555
|
}
|
|
@@ -344,7 +344,7 @@ export class ListBase<T extends Item<U>, U>
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
render() {
|
|
347
|
-
const { horizontal, className } = this.props;
|
|
347
|
+
const { horizontal, className, mrcuMountingPoint } = this.props;
|
|
348
348
|
return (
|
|
349
349
|
<Scroller
|
|
350
350
|
className={className}
|
|
@@ -357,7 +357,7 @@ export class ListBase<T extends Item<U>, U>
|
|
|
357
357
|
<MouseNavigation
|
|
358
358
|
// @ts-ignore - needed to convert fallback (false) to interface
|
|
359
359
|
ref={this.mrcuRef}
|
|
360
|
-
getMountingPoint={() => this.scroller.current!.wrapRef}
|
|
360
|
+
getMountingPoint={() => mrcuMountingPoint || this.scroller.current!.wrapRef}
|
|
361
361
|
{...this.props}
|
|
362
362
|
/>
|
|
363
363
|
</Scroller>
|
|
@@ -66,6 +66,11 @@ export type BasicProps<T extends Item<U>, U> = {
|
|
|
66
66
|
*/
|
|
67
67
|
fastFocusingOptimization?: boolean,
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Returns a reference to the custom HTML element for the MRCU arrows.
|
|
71
|
+
*/
|
|
72
|
+
mrcuMountingPoint?: Reference<HTMLDivElement>,
|
|
73
|
+
|
|
69
74
|
/**
|
|
70
75
|
* Function called every time before list performs one full scroll.
|
|
71
76
|
* @param item Reference to item on current scroll
|
|
@@ -94,6 +94,22 @@ export class MouseNavigation extends Component<Props> {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
onWheel = (event: WheelEvent) => {
|
|
98
|
+
const { forward, backward, direction } = this.props;
|
|
99
|
+
const { horizontal } = this.mapDirectionToProps(direction);
|
|
100
|
+
if (horizontal) return;
|
|
101
|
+
if (event.deltaY > 0) forward();
|
|
102
|
+
else if (event.deltaY < 0) backward();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
addWheelListner() {
|
|
106
|
+
this.arrows.current?.domRef.current?.addEventListener('wheel', this.onWheel);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
removeWheelListner() {
|
|
110
|
+
this.arrows.current?.domRef.current?.removeEventListener('wheel', this.onWheel);
|
|
111
|
+
}
|
|
112
|
+
|
|
97
113
|
isActive() {
|
|
98
114
|
return this.navigationState === 'active';
|
|
99
115
|
}
|
|
@@ -112,6 +128,7 @@ export class MouseNavigation extends Component<Props> {
|
|
|
112
128
|
getMountingPoint(),
|
|
113
129
|
);
|
|
114
130
|
this.handleArrowState();
|
|
131
|
+
this.addWheelListner();
|
|
115
132
|
this.navigationState = 'active';
|
|
116
133
|
};
|
|
117
134
|
|
|
@@ -129,6 +146,7 @@ export class MouseNavigation extends Component<Props> {
|
|
|
129
146
|
destroyArrows() {
|
|
130
147
|
if (this.navigationState === 'inactive') return;
|
|
131
148
|
this.navigationState = 'inactive';
|
|
149
|
+
this.removeWheelListner();
|
|
132
150
|
removeNode(this.arrows.current!.domRef);
|
|
133
151
|
}
|
|
134
152
|
|