Skip to content

Commit

Permalink
Fix #1114 gallery: keep current item if possible when updating items
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Oct 12, 2023
1 parent a843086 commit d6b7c2c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/gallery-plugin/src/GalleryPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class GalleryPlugin extends AbstractConfigurablePlugin<
if (e instanceof events.PanoramaLoadedEvent) {
const item = this.items.find((i) => utils.deepEqual(i.panorama, e.data.panorama));
this.currentId = item?.id;
this.gallery.setActive(item?.id);
this.gallery.setActive(this.currentId);
} else if (e instanceof events.ShowPanelEvent) {
this.gallery.isVisible() && this.hide();
}
Expand Down Expand Up @@ -152,6 +152,12 @@ export class GalleryPlugin extends AbstractConfigurablePlugin<

this.gallery.setItems(this.items);

if (this.currentId) {
const item = this.items.find((i) => i.id === this.currentId);
this.currentId = item?.id;
this.gallery.setActive(this.currentId);
}

this.__updateButton();
}

Expand Down

0 comments on commit d6b7c2c

Please sign in to comment.