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

Fix #292900: Plugin: Expose Element.pos X/Y values to plugins. #5254

Merged
merged 2 commits into from Aug 4, 2019

Conversation

DLLarson
Copy link
Contributor

@DLLarson DLLarson commented Aug 2, 2019

Expose Element.pos X/Y values so that plugin's can accurately
position things like STAFF_TEXT on the score. One example is
to position a tin whistle finger hole pattern directly under
a grace note. Another is to place note names properly using
MuseScore's shipped notename.qml plugin.

@DLLarson DLLarson changed the title Fix #292900: Expose Element.pos X/Y values to plugins. Fix #292900: Plugin: Expose Element.pos X/Y values to plugins. Aug 2, 2019
@@ -88,6 +88,20 @@ class Element : public Ms::PluginAPI::ScoreElement {
* \since 3.3
*/
Q_PROPERTY(Ms::PluginAPI::Element* parent READ parent)
/**
* Computed X-axis layout position from a reference position.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it perhaps be better to say that this is actual position rather than computed to denote that it includes also offset and all other possible modifiers as its part? Or, as another option, perhaps we could explicitly mention the fact that this already includes any offset applied.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the api description.
-Dale

Expose Element.pos X/Y values so that plugin's can accurately
position things like STAFF_TEXT on the score. One example is
to position a tin whistle finger hole pattern directly under
a grace note. Another is to place note names properly using
MuseScore's shipped notename.qml plugin.
Modify plugin to take advantage of exposure of element.posX/Y which
allows for precise positioning of elements like STAFF_TEXT.
for (var i = 0; i < notes.length; i++) {
var sep = ","; // change to "\n" if you want them vertically
var sep = "\n"; // change to "," if you want them horizontally (anybody?)
Copy link
Contributor

Choose a reason for hiding this comment

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

@Jojo-Schmitz, that seems to be your code originally, do you agree with changing this default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check out my examples at the issue web page to see why I made that switch.

-Dale

Copy link
Contributor

Choose a reason for hiding this comment

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

@dmitrio95 I'm fine with that, and it isn't really my code alone anyway

@dmitrio95 dmitrio95 merged commit 5979345 into musescore:master Aug 4, 2019
@DLLarson DLLarson deleted the expose-element-pos branch August 4, 2019 22:31
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.

None yet

3 participants