Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give the canvas some margin when first opening a score #24483

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

mike-spa
Copy link
Contributor

@mike-spa mike-spa commented Sep 5, 2024

Resolves: #23404

[EDIT]

After consulting with @Tantacrul, I have slightly changed my initial implementation such that:

if there is enough space given the default zoom level and the canvas size, we center it on the canvas
image

ff there isn't, we align it with a padding to the margin that I've set equal to the gap between pages.
image

Copy link
Contributor

@cbjeukendrup cbjeukendrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually we might want to center the score page; this was implemented for 3.6.1 or 3.6.2, but we never ported it to MS4. But for now this is a nice improvement!

@@ -171,6 +171,17 @@ void NotationViewInputController::initZoom()
currentNotation()->viewState()->setMatrixInited(true);
}

void NotationViewInputController::initCanvasPos()
{
double canvasMargin = 10 * DPMM; // 1 centimetre
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume it's intentional that this cm is relative to the score size, and not always corresponds to 1 cm on the screen (for example when the default zoom percentage is not 100%).

Maybe it's a bit much though. I would personally prefer something closer to MScore::horizontalPageGapOdd.

@MarcSabatella
Copy link
Contributor

Eventually we might want to center the score page; this was implemented for 3.6.1 or 3.6.2, but we never ported it to MS4. But for now this is a nice improvement!

If I'm remember correctly (I could be confusing it with something else), the centering was a somewhat controversial choice. The downside is, it makes the score farther from the palette by default on a large monitor, making drag & drop significantly more work. On the other hand, clearly a nice for many purposes. So while I'm not a huge fan of having more and more preferences, the centering seems like a good possibility. Especially if it were tied to the workspace the way UI preferences are supposed to be but aren't - see #15957. Then a "presentation" workspace and an "editing" workspace could use different settings of that preference to good effect.

@mike-spa
Copy link
Contributor Author

mike-spa commented Sep 6, 2024

@cbjeukendrup could you pls take a second look at this after the changes and review/merge :)

Copy link
Contributor

@cbjeukendrup cbjeukendrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

src/notation/view/notationviewinputcontroller.cpp Outdated Show resolved Hide resolved
src/notation/view/notationviewinputcontroller.cpp Outdated Show resolved Hide resolved
@cbjeukendrup
Copy link
Contributor

cbjeukendrup commented Sep 16, 2024

Looks like 'zoom to page width' etc. is not completely right yet (there's too much margin). Perhaps it has to do with whether MScore::horizontalPageGapOdd is interpreted as 'screen coordinates' or 'score coordinates'.

Schermopname.2024-09-16.om.12.50.06.mov

Comment on lines 184 to 185
bool centerHorizontally = totalScoreWidth < viewWidth;
bool centerVertically = totalScoreHeight < viewHeight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edge case:
if totalScoreWidth < viewWidth - 2 * canvasMargin, then the score would be centered, but this results in the margin being less than canvasMargin. So, you get this:
Scherm­afbeelding 2024-09-16 om 12 59 58
instead of
Scherm­afbeelding 2024-09-16 om 13 00 34

@mike-spa
Copy link
Contributor Author

@cbjeukendrup hopefully should be ok now

@mike-spa mike-spa merged commit faa5a67 into musescore:master Sep 17, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce padding around first page of score in canvas
4 participants