-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixed inverted zooming. #3570
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
Merged
Merged
Fixed inverted zooming. #3570
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Fixed inverted zooming.
- Loading branch information
commit 2c4d07e28041887c85d4bcf2e1e164ea91e1593e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,7 +143,7 @@ PianoRoll::PianoRollKeyTypes PianoRoll::prKeyOrder[] = | |
| const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DefaultStepsPerTact; | ||
|
|
||
| const QVector<double> PianoRoll::m_zoomLevels = | ||
| { 8.0f, 4.0f, 2.0f, 1.0f, 0.5f, 0.25f, 0.125f }; | ||
| { 0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f }; | ||
|
|
||
|
|
||
| PianoRoll::PianoRoll() : | ||
|
|
@@ -805,7 +805,7 @@ void PianoRoll::setBackgroundShade( const QColor & c ) | |
|
|
||
|
|
||
|
|
||
| void PianoRoll::drawNoteRect( QPainter & p, int x, int y, | ||
| void PianoRoll::drawNoteRect( QPainter & p, int x, int y, | ||
| int width, const Note * n, const QColor & noteCol, | ||
| const QColor & selCol, const int noteOpc, const bool borders ) | ||
| { | ||
|
|
@@ -1917,7 +1917,7 @@ void PianoRoll::mouseReleaseEvent( QMouseEvent * me ) | |
| { | ||
| // select the notes within the selection rectangle and | ||
| // then destroy the selection rectangle | ||
| computeSelectedNotes( | ||
| computeSelectedNotes( | ||
| me->modifiers() & Qt::ShiftModifier ); | ||
| } | ||
| else if( m_action == ActionMoveNote ) | ||
|
|
@@ -2462,15 +2462,15 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl ) | |
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| else if (m_action == ActionResizeNote) | ||
| { | ||
| // When resizing notes: | ||
| // If shift is not pressed, resize the selected notes but do not rearrange them | ||
| // If shift is pressed we resize and rearrange only the selected notes | ||
| // If shift + ctrl then we also rearrange all posterior notes (sticky) | ||
| // If shift is pressed but only one note is selected, apply sticky | ||
|
|
||
| if (shift) | ||
| { | ||
| // Algorithm: | ||
|
|
@@ -2490,8 +2490,8 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl ) | |
| const Note *posteriorNote = nullptr; | ||
| for (const Note *note : notes) | ||
| { | ||
| if (note->selected() && (posteriorNote == nullptr || | ||
| note->oldPos().getTicks() + note->oldLength().getTicks() > | ||
| if (note->selected() && (posteriorNote == nullptr || | ||
| note->oldPos().getTicks() + note->oldLength().getTicks() > | ||
| posteriorNote->oldPos().getTicks() + posteriorNote->oldLength().getTicks())) | ||
| { | ||
| posteriorNote = note; | ||
|
|
@@ -2511,9 +2511,9 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl ) | |
| if(note->selected()) | ||
| { | ||
| // scale relative start and end positions by scaleFactor | ||
| int newStart = stretchStartTick + scaleFactor * | ||
| int newStart = stretchStartTick + scaleFactor * | ||
| (note->oldPos().getTicks() - stretchStartTick); | ||
| int newEnd = stretchStartTick + scaleFactor * | ||
| int newEnd = stretchStartTick + scaleFactor * | ||
| (note->oldPos().getTicks()+note->oldLength().getTicks() - stretchStartTick); | ||
| // if not holding alt, quantize the offsets | ||
| if(!alt) | ||
|
|
@@ -2532,7 +2532,7 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl ) | |
| int newLength = qMax(1, newEnd-newStart); | ||
| if (note == posteriorNote) | ||
| { | ||
| posteriorDeltaThisFrame = (newStart+newLength) - | ||
| posteriorDeltaThisFrame = (newStart+newLength) - | ||
| (note->pos().getTicks() + note->length().getTicks()); | ||
| } | ||
| note->setLength( MidiTime(newLength) ); | ||
|
|
@@ -3281,11 +3281,11 @@ void PianoRoll::wheelEvent(QWheelEvent * we ) | |
| int z = m_zoomingModel.value(); | ||
| if( we->delta() > 0 ) | ||
| { | ||
| z--; | ||
| z++; | ||
| } | ||
| if( we->delta() < 0 ) | ||
| { | ||
| z++; | ||
| z--; | ||
|
Contributor
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. Same here... |
||
| } | ||
| z = qBound( 0, z, m_zoomingModel.size() - 1 ); | ||
| // update combobox with zooming-factor | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,7 @@ void positionLine::paintEvent( QPaintEvent * pe ) | |
| } | ||
|
|
||
| const QVector<double> SongEditor::m_zoomLevels = | ||
| { 16.0f, 8.0f, 4.0f, 2.0f, 1.0f, 0.5f, 0.25f, 0.125f }; | ||
| { 0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f, 8.0f, 16.0f }; | ||
|
|
||
|
|
||
| SongEditor::SongEditor( Song * song ) : | ||
|
|
@@ -361,11 +361,11 @@ void SongEditor::wheelEvent( QWheelEvent * we ) | |
|
|
||
| if( we->delta() > 0 ) | ||
| { | ||
| z--; | ||
| z++; | ||
| } | ||
| if( we->delta() < 0 ) | ||
| { | ||
| z++; | ||
| z--; | ||
|
Contributor
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. And here too. |
||
| } | ||
| z = qBound( 0, z, m_zoomingModel->size() - 1 ); | ||
| // update combobox with zooming-factor | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will prevent one useless test when
x > 0. I know it's not directly related to this PR, but spotted this so...