Skip to content

Commit 65a014d

Browse files
committed
[qt6][Viewer] Viewer2D: Fix fit() with the Sequence Player
With the Sequence Player always enabled by default, the `fit()` function must be triggered at the right moment, and only once the layout has been correctly initialized; otherwise, zoom factors may become negative and the images will not be placed correctly in the viewer. Changes in the orientation tag must be handled independently from the state of the zoom factor.
1 parent 2699bff commit 65a014d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

meshroom/ui/qml/Viewer/Viewer2D.qml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,9 @@ FocusScope {
501501
var sizeValid = (width > 0) && (height > 0)
502502
var layoutValid = (root.width > 50) && (root.height > 50)
503503
var sizeChanged = (root.previousWidth != width) || (root.previousHeight != height)
504-
504+
505505
if ((!root.fittedOnce && imgContainer.image && sizeValid && layoutValid) ||
506-
(root.fittedOnce && sizeChanged && sizeValid && layoutValid)) {
506+
(root.fittedOnce && sizeChanged && sizeValid && layoutValid)) {
507507
var ret = fit()
508508
if (!ret)
509509
return
@@ -515,12 +515,16 @@ FocusScope {
515515
}
516516
}
517517

518-
onHeightChanged : {
518+
onWidthChanged : {
519519
floatImageViewerLoader.sizeChanged();
520520
}
521521

522522
Connections {
523523
target: root
524+
function onWidthChanged() {
525+
floatImageViewerLoader.sizeChanged()
526+
}
527+
524528
function onHeightChanged() {
525529
floatImageViewerLoader.sizeChanged()
526530
}
@@ -534,7 +538,6 @@ FocusScope {
534538
var ret = fit()
535539
if (!ret)
536540
return
537-
root.fittedOnce = true
538541
root.previousWidth = width
539542
root.previousHeight = height
540543
root.previousOrientationTag = orientationTag

0 commit comments

Comments
 (0)