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

New percussion mouse input interaction & popup #26000

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mathesoncalum
Copy link
Contributor

@mathesoncalum mathesoncalum commented Jan 6, 2025

This PR implements the new percussion mouse input interaction and associated popup.


Part 1 - ShadowNotePopup groundwork (eb6c141 & 21cb8ed)



Two of the main goals in this PR were to:


  1. 

Avoid coupling to percussion-specific logic.

  2. 
Reuse (and adapt) as much of our existing ElementPopup logic as possible.





With this in mind, the idea with this commit was to provide a generalised shadow-note popup which will determine its “content” based on the context (ShadowNotePopupModel::currentPopupType). This should help with future flexibility, for example if we wish to implement other shadow-note-based popups.











A couple of optimisations were made to our existing ElementPopup logic. Firstly, we no longer attempt to show a popup if it is already showing - this is essential for ShadowNotePopups as we should try to update the visibility on every hoverMoveEvent. Second, the option to close a specific element popup is also included here - we need this because we don't want to close all element popups when shift is released, only the shadow-note popup.




...



Part 2 - Percussion shadow-note popup

 (c015a98)





The content of this commit is fairly self-explanatory. It implements the “percussion note content” UI and outlines the circumstances where ShadowNotePopup should load this content.











This commit also contains logic for evaluating which percussion note should be inputted on click (see Score::noteValForPosition)

@mathesoncalum mathesoncalum force-pushed the percussion_input_popup branch 5 times, most recently from da5ed71 to e9cfe53 Compare January 13, 2025 19:47
@mathesoncalum mathesoncalum force-pushed the percussion_input_popup branch from e9cfe53 to ae30d4d Compare January 15, 2025 11:42
@mathesoncalum mathesoncalum changed the title New percussion mouse input interaction & popup (DRAFT) New percussion mouse input interaction & popup Jan 15, 2025
@mathesoncalum mathesoncalum marked this pull request as ready for review January 15, 2025 12:04
@mathesoncalum mathesoncalum force-pushed the percussion_input_popup branch from ae30d4d to 54069cb Compare February 7, 2025 14:00
nval.pitch = m_is.drumNote();
if (nval.pitch < 0 || !ds->isValid(nval.pitch) || ds->line(nval.pitch) != line) {
// Drum note from input state is not valid - fall back to the first valid pitch for this line...
m_is.setDrumNote(-1);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like that we change the input state here... Ideally, noteValForPosition should be const, and not change the state implicitly

}
if (drumNotePitch < 0) {
shadowNote.setVisible(false);
m_shadowNoteChanged.notify();
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not notify here, because this function is also used to draw the input by duration preview. The notification should be moved to NotationInteraction::showShadowNote

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.

2 participants