fixed back button positioning issue in gallery element

This commit is contained in:
Dmitri 2026-04-27 13:32:40 +02:00
parent 8244a33c69
commit 988139c063

View File

@ -876,6 +876,30 @@ const ConstructorPage = ({ mode = 'constructor' }: ConstructorPageProps) => {
typeof item.galleryCarouselBackY === 'number'
? item.galleryCarouselBackY
: undefined,
galleryCarouselPrevWidth:
typeof item.galleryCarouselPrevWidth === 'string'
? item.galleryCarouselPrevWidth
: undefined,
galleryCarouselPrevHeight:
typeof item.galleryCarouselPrevHeight === 'string'
? item.galleryCarouselPrevHeight
: undefined,
galleryCarouselNextWidth:
typeof item.galleryCarouselNextWidth === 'string'
? item.galleryCarouselNextWidth
: undefined,
galleryCarouselNextHeight:
typeof item.galleryCarouselNextHeight === 'string'
? item.galleryCarouselNextHeight
: undefined,
galleryCarouselBackWidth:
typeof item.galleryCarouselBackWidth === 'string'
? item.galleryCarouselBackWidth
: undefined,
galleryCarouselBackHeight:
typeof item.galleryCarouselBackHeight === 'string'
? item.galleryCarouselBackHeight
: undefined,
tooltipTitle:
typeof item.tooltipTitle === 'string' ? item.tooltipTitle : '',
tooltipText:
@ -1184,7 +1208,15 @@ const ConstructorPage = ({ mode = 'constructor' }: ConstructorPageProps) => {
? { galleryCarouselNextX: x, galleryCarouselNextY: y }
: { galleryCarouselBackX: x, galleryCarouselBackY: y };
updateSelectedElement(positionPatch);
// Update the element by explicit ID (not by selection)
// because the gallery element may not be selected when the carousel is open
setElements((prev) =>
prev.map((el) =>
el.id === activeGalleryCarousel.element.id
? { ...el, ...positionPatch }
: el,
),
);
// Update the active carousel element to reflect the new positions
setActiveGalleryCarousel((prev) =>
@ -1193,7 +1225,7 @@ const ConstructorPage = ({ mode = 'constructor' }: ConstructorPageProps) => {
: null,
);
},
[activeGalleryCarousel, updateSelectedElement],
[activeGalleryCarousel, setElements],
);
// Handler for carousel element button position changes (constructor only)