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

Automation Editor - Straighten out draw line function #3997

Merged
merged 1 commit into from
Dec 6, 2017

Conversation

zonkmachine
Copy link
Member

@zonkmachine zonkmachine commented Nov 21, 2017

Nudge the line (biggest improvement) and quantize x arguments to AutomationEditor::drawLine(..).

Fixes #3995

@zonkmachine
Copy link
Member Author

zonkmachine commented Nov 22, 2017

This isn't one issue only. I've fixed up AutomationEditor::drawLine(...) but there is still things to do.
In AutomationEditor::mousePressEvent(...), if the shift button is held and the left mouse button is pressed, we first draw a line and then carry on with the final point and create a drag value as the last point is selected for dragging. The magic happens here. Many times it's the last or next to last point that is off so I think this is related to a rounding off error and/or quantization in the above mentioned functions and in AutomationPattern::setDragValue(...). If you draw your points close to their quantized values there is little risk of a draw error. If you draw a line with steep angles between two points and aim for slightly to the left of the left point and to the right of the right one (picture), you will get a draw error. The closest points on both sides will snap to the same level. Setting m_drawLastTick = new_time; after it = time_map.find( new_time ); avoids this but just pushes the error around.

Edit: this specific behaviour was introduced in this PR This part reverted, issue fixed.
drawerror

@zonkmachine
Copy link
Member Author

I think it's out of scope for 1.2 to fix this and suggest that we merge #3997 and leave #3995 open.

@zonkmachine
Copy link
Member Author

Quantize drawline() input. The line is drawn from a mix of unquantized x0, x1 input values and the quantized deltax, and will sometimes not draw correct.

The function to draw a straight line the Automation Editor is glitchy.

Fixes:
  Adjust the line level.
  AutomationEditor::drawLine(..) - quantize input
@zonkmachine
Copy link
Member Author

Fixed. I'll merge this tomorrow if there are no objections.

@zonkmachine zonkmachine merged commit 06c40fc into LMMS:stable-1.2 Dec 6, 2017
@zonkmachine zonkmachine deleted the drawstraightline branch December 6, 2017 06:07
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
Fixes:
  AutomationEditor::drawLine(..) - quantize input
  AutomationEditor::drawLine(..) - Adjust line level.
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.

1 participant