Skip to content

Commit

Permalink
Fixed scaling of images when the window is already opened and the ima…
Browse files Browse the repository at this point in the history
…ge is

big on the screen.
  • Loading branch information
ggarra13 committed May 24, 2024
1 parent f316ca2 commit dd7da8e
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions mrv2/lib/mrvGL/mrvTimelineViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,10 @@ namespace mrv

int minX, minY, maxW, maxH, posX, posY;
Fl::screen_work_area(minX, minY, maxW, maxH, screen);
#ifdef DEBUG_SCALING
std::cerr << "work area=" << minX << " " << minY << " "
<< maxW << "x" << maxH << std::endl;
#endif

PreferencesUI* uiPrefs = p.ui->uiPrefs;
if (!desktop::Wayland() && uiPrefs->uiWindowFixedPosition->value())
Expand Down Expand Up @@ -1386,7 +1390,7 @@ namespace mrv
{
p.frameView = true;
H = minY + maxH - posY + dH;
W /= aspectRatio;
// W /= aspectRatio;

#ifdef DEBUG_SCALING
std::cerr << "Adjust sizing on height" << std::endl;
Expand All @@ -1399,7 +1403,7 @@ namespace mrv
{
p.frameView = true;
W = minX + maxW - posX + dW;
H /= aspectRatio;
// H /= aspectRatio;

#ifdef DEBUG_SCALING
std::cerr << "Adjust sizing on width" << std::endl;
Expand Down Expand Up @@ -1466,20 +1470,27 @@ namespace mrv
}

#ifdef DEBUG_SCALING
std::cerr << "clamped minimum W=" << W << " H=" << H << std::endl;
std::cerr << "clamped minimum " << posX << " " << posY << " W=" << W
<< " H=" << H << std::endl;
#endif

//
// Final sanity checks.
//
if (posY + H + dH > minY + maxH)
{
H = minY + maxH - posY;
p.frameView = true;
}
// if (posX + W + dW > minX + maxW)
// {
// W = minX + maxW - posX;
// p.frameView = true;
// }
// if (posY + H + dH > minY + maxH)
// {
// H = minY + maxH - posY;
// p.frameView = true;
// }

#ifdef DEBUG_SCALING
std::cerr << "First minimum W=" << W << " H=" << H << std::endl;
std::cerr << "First minimum " << posX << " " << posY << " W=" << W
<< " H=" << H << std::endl;
#endif

// Finally, if we are still failing, position the viewer at
Expand Down

0 comments on commit dd7da8e

Please sign in to comment.