[ui] ImageGallery: Force index to -1 before setting it if there's a tempCameraInit

When there is a temporary CameraInit, it means that either the "Visualize
HDR images" or "Preprocessed images" options are enabled.

If several CameraInit groups are available, and if the currently selected
image in the GridView is the first one (index = 0), there is a possibility,
depending on the input images, that the first images in two different
groups are not identical but have the same view ID. If that happens, there
will be no update of the Viewer2D, as the selectedViewId property will not
have been modified.

By setting the selectedViewId property to -1 when there is a temporary
CameraInit and the current index in the GridView is 0, we trigger an
update of the viewer even when there is no apparent change in the view ID.
This commit is contained in:
Candice Bentéjac 2023-03-13 15:49:44 +01:00
parent 4001c4fc3e
commit 5e61a1da5a

View file

@ -201,6 +201,10 @@ Panel {
}
onCurrentItemChanged: {
if (grid.updateSelectedViewFromGrid && grid.currentItem) {
// If tempCameraInit is set and the first image in the GridView is selected, there has been a change of the CameraInit group and the viewId might be the same
// Forcing the index to -1 before re-setting it will always cause a refresh on the Viewer2D's side, even if the viewId has not changed
if (tempCameraInit !== null && grid.currentIndex == 0)
_reconstruction.selectedViewId = -1
_reconstruction.selectedViewId = grid.currentItem.viewpoint.get("viewId").value
}
}