Skip to content

Commit

Permalink
[ui] ImageGallery: update the Viewer2D correctly when the GridView's …
Browse files Browse the repository at this point in the history
…item changes

This commit ensures that any change in the ImageGallery's GridView
selection is correctly reflected in the Viewer2D. In particular:
- When a new project file is opened, the first image in the gallery
is now displayed in the 2D viewer, after a correct auto-fit has been
applied
- When an image in the gallery is removed, the adjacent image that
becomes selected is automatically displayed in the 2D viewer
  • Loading branch information
cbentejac committed Nov 17, 2022
1 parent c4d44aa commit a531caf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions meshroom/ui/qml/ImageGallery/ImageGallery.qml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ Panel {
Connections {
target: _reconstruction
onSelectedViewIdChanged: {
grid.updateCurrentIndexFromSelectionViewId()
if (_reconstruction.selectedViewId > -1) {
grid.updateCurrentIndexFromSelectionViewId()
}
}
}
function makeCurrentItemVisible()
Expand All @@ -183,12 +185,12 @@ Panel {
function updateCurrentIndexFromSelectionViewId()
{
var idx = grid.model.find(_reconstruction.selectedViewId, "viewId")
if(idx >= 0 && grid.currentIndex != idx) {
if (idx >= 0 && grid.currentIndex != idx) {
grid.currentIndex = idx
}
}
onCurrentIndexChanged: {
if(grid.updateSelectedViewFromGrid) {
onCurrentItemChanged: {
if (grid.updateSelectedViewFromGrid && grid.currentItem) {
_reconstruction.selectedViewId = grid.currentItem.viewpoint.get("viewId").value
}
}
Expand Down

0 comments on commit a531caf

Please sign in to comment.