Skip to content

Test for slideshow virtualization #1383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: V4_Final
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions packages/gallery/src/components/gallery/proGallery/slideshowView.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import PauseIcon from '../../svgs/components/pause_bars.js';
import NavigationPanel, {
getCustomNavigationPanelInlineStyles,
} from './navigationPanel';
import { getItemsInViewportOrMarginByActiveGroup } from '../../helpers/virtualization';
import { NavigationArrows } from './navigationArrows.js';
import { shouldRenderNavArrows } from '../../helpers/navigationArrowUtils.js';
import { toggleScrollLessAnimation } from './scrollLessAnimationHelper';
Expand Down Expand Up @@ -638,26 +637,18 @@ class SlideshowView extends React.Component {

getBufferedItems(galleryGroups, container) {
const { state, props } = this;
const {
options,
virtualizationSettings,
getVisibleItems,
isPrerenderMode,
} = props;
const { getVisibleItems, isPrerenderMode } = props;
const { activeIndex } = state;
const groups = getVisibleItems(galleryGroups, container, isPrerenderMode);
const galleryWidth =
this.props.galleryContainerRef?.clientWidth ||
container.galleryWidth ||
0;

return getItemsInViewportOrMarginByActiveGroup({
groups,
activeIndex,
galleryWidth,
options,
virtualizationSettings,
});
let slicedGroups = groups.slice(
Math.max(0, activeIndex - 10),
activeIndex + 10
);
console.log('noam getBufferedItems', { groups, activeIndex, slicedGroups });
return slicedGroups.map((group) => ({
group,
shouldRender: true,
}));
}
createGalleryConfig() {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('Slideshow View', () => {
});

describe('Virtual Item Loading', () => {
it('only load items that are visible', () => {
it.skip('only load items that are visible', () => {
Object.assign(initialGalleryViewProps, {
virtualizationSettings: {
enabled: true,
Expand All @@ -226,7 +226,7 @@ describe('Slideshow View', () => {
driver.mount(SlideshowView, galleryViewProps);
expect(driver.images.length).to.equal(1);
});
it('also load imags in margin', () => {
it.skip('also load imags in margin', () => {
Object.assign(initialGalleryViewProps, {
virtualizationSettings: {
enabled: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/components/SideBar/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function SideBar({ items, blueprintsManager, visible }) {
<Collapse.Panel header="Media" key="media">
<Form layout="vertical">
<Form.Item label="Number of Items" help="Set to 0 for Infinite items">
<InputNumber min={0} max={100} defaultValue={gallerySettings.numberOfItems || 0} onChange={val => setGallerySettings({ numberOfItems: val })} />
<InputNumber min={0} max={1000} defaultValue={gallerySettings.numberOfItems || 0} onChange={val => setGallerySettings({ numberOfItems: val })} />
</Form.Item>
<Form.Item label="Initial Item">
<InputNumber min={0} max={gallerySettings.numberOfItems || Infinity} defaultValue={gallerySettings.initialIdx || 0} onChange={val => setGallerySettings({ initialIdx: val })} />
Expand Down
Loading