-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make Tiny Notes Easier to Move #8386
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
Changes from 3 commits
0b313b7
a2ac34a
26a6ad5
031982f
49c6026
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,8 +106,10 @@ const int PR_TOP_MARGIN = 18; | |
| const int PR_RIGHT_MARGIN = SCROLLBAR_SIZE; | ||
|
|
||
|
|
||
| // width of area used for resizing (the grip at the end of a note) | ||
| const int RESIZE_AREA_WIDTH = 9; | ||
| //! Width of area used for resizing (the grip at the end of a note) | ||
| const int RESIZE_GRIP_WIDTH = 9; | ||
| //! The maximum fraction of the note width that the resize grip is allowed to take up | ||
| const float RESIZE_GRIP_MAX_WIDTH_FRACTION = 0.25; | ||
|
regulus79 marked this conversation as resolved.
Outdated
|
||
|
|
||
| // width of line for setting volume/panning of note | ||
| const int NOTE_EDIT_LINE_WIDTH = 3; | ||
|
|
@@ -1922,8 +1924,8 @@ void PianoRoll::mousePressEvent(QMouseEvent * me ) | |
| } | ||
|
|
||
| // clicked at the "tail" of the note? | ||
| if( pos_ticks * m_ppb / TimePos::ticksPerBar() > | ||
| m_currentNote->endPos() * m_ppb / TimePos::ticksPerBar() - RESIZE_AREA_WIDTH | ||
| if(x + m_currentPosition * m_ppb / TimePos::ticksPerBar() > | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI I changed this from comparing the mouse position in ticks to comparing the mouse position in pixels, since at high zoom levels, ticks get very wide, and they don't provide enough resolution.
regulus79 marked this conversation as resolved.
Outdated
|
||
| m_currentNote->endPos() * m_ppb / TimePos::ticksPerBar() - resizeGripWidth(m_currentNote->length()) | ||
| && m_currentNote->length() > 0 ) | ||
| { | ||
| m_midiClip->addJournalCheckPoint(); | ||
|
|
@@ -2719,8 +2721,7 @@ void PianoRoll::mouseMoveEvent( QMouseEvent * me ) | |
| int noteRightX = ( note->pos() + note->length() - | ||
| m_currentPosition) * m_ppb/TimePos::ticksPerBar(); | ||
| // cursor at the "tail" of the note? | ||
| bool atTail = note->length() > 0 && x > noteRightX - | ||
| RESIZE_AREA_WIDTH; | ||
| bool atTail = note->length() > 0 && x > noteRightX - resizeGripWidth(note->length()); | ||
| Qt::CursorShape cursorShape = atTail ? Qt::SizeHorCursor : | ||
| Qt::SizeAllCursor; | ||
| setCursor( cursorShape ); | ||
|
|
@@ -3290,6 +3291,11 @@ void PianoRoll::dragNotes(int x, int y, bool alt, bool shift, bool ctrl) | |
| } | ||
|
|
||
|
|
||
| int PianoRoll::resizeGripWidth(tick_t noteLength) const | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given how this is used, you could probably change the parameter to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 49c6026 |
||
| { | ||
| const int noteWidth = noteLength * m_ppb / TimePos::ticksPerBar(); | ||
| return std::min(RESIZE_GRIP_WIDTH, static_cast<int>(std::round(RESIZE_GRIP_MAX_WIDTH_FRACTION * noteWidth))); | ||
| } | ||
|
|
||
|
|
||
| void PianoRoll::paintEvent(QPaintEvent * pe ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.