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: points deleted while moving other points can be restored abnormally #4671

Open
PhysSong opened this issue Oct 23, 2018 · 7 comments

Comments

@PhysSong
Copy link
Member

Note that it's an unusual situation for ordinary users.
Steps to reproduce:

  • Click an automation point and start moving it
  • While holding the left mouse button, press the right mouse button on existing points to remove them
  • Release the mouse button and add a new automation point
  • Deleted points will re-appear

I believe m_oldTimeMap still contains deleted points, and those points are restored on the second AutomationPattern::setDragValue call.
I think related UI part is also problematic. Once I press the right mouse button, the dragging stops. However, AutomationPattern::applyDragValue is not called in that case. It will lead to restoring deleted points from m_oldTimeMap.

@zonkmachine
Copy link
Member

Tested. Behavior is there already in 1.1.3

@tecknixia
Copy link
Contributor

tecknixia commented Oct 18, 2019

Relates to #5157 Select, copy, and paste in automation track

@BaraMGB and @cyberdevilnl were both looking into this at one point, not sure if anyone is still interested?

How desirable is it to delete points while moving a point?
Would it better if the right button cancels the move?

If a point goes on top of another point, it is replaced. Is it necessary to be able to delete multiple points while moving a point, when you can just delete the points before or after the move?

Edit: I created a branch for working on automation editor bugs and enhancements
https://github.com/tecknixia/lmms/tree/automationProject

@tecknixia
Copy link
Contributor

tecknixia commented Oct 20, 2019

Despite creating a work-around to deleting points while dragging, using the select feature in Automation Editor (working on it), I've run into a problem of randomly disappearing points while moving other points.

Edit:

Turns out, the problem I'm experiencing does not call setDragValue at all, and just has a problem with replacing each point of the selection as it moves.

@tecknixia
Copy link
Contributor

tecknixia commented Nov 1, 2019

@PhysSong

Once I press the right mouse button, the dragging stops. However, AutomationPattern::applyDragValue is not called in that case. It will lead to restoring deleted points from m_oldTimeMap.

applyDragValue occurs when releasing the left mouse button, which sets m_dragging back to false, but only when m_action == MOVE VALUE. Dragging stops because when the right mouse button is pressed in DRAW mode while over a point, m_pattern->removeValue(it.key()); is called, and m_action is set to NONE. At this point, m_dragging is still true.

Basically, m_action becomes NONE when pressing the right mouse button, and if that's the case when releasing the left button, m_action is no longer MOVE VALUE, so applyDragValue is not called. In this case, setDragValue occurs again without applyDragValue when pressing left mouse button again, and m_dragging is still true, which causes a restoration of the points as if dragging was still occurring. Pressing the left mouse button also sets m_action back to MOVE VALUE, and releasing the left button finally calls applyDragValue.

It seems a solution could happen one of two ways:

  • m_action being set to NONE while pressing the right mouse button ONLY when left mouse button is not pressed
  • upon releasing of left mouse button applyDragValue may be called when m_action is MOVE VALUE or NONE

Edit:

Turns out, these solutions will only cancel the drag, but the point being dragged still disappears.

I keep trying to get the dragging process to continue when the right mouse button is released while still holding the left mouse button. I have not been able to figure out why it cancels the drag, even after placing applyDragValue (in mouseReleaseEvent) under the left mouse button condition.

@tecknixia
Copy link
Contributor

I have come up with a fix to cancel the dragging of an automation point by clicking right mouse button while dragging.

Should I go ahead and create a PR for it, or do we want it to function differently?

@tecknixia
Copy link
Contributor

tecknixia commented Nov 10, 2019

Here's what it looks like to me now:

After m_dragging has been set to true, while dragging...

  • m_oldTimeMap has a record of the points not being dragged from start of drag

When right button is pressed and edit mode is DRAW...

  • m_pattern->removeValue(it.key())
  • m_action = NONE

When right button is released...

  • m_action = NONE
  • applyDragValue not called

With left mouse button down in DRAW mode, and mouse move...

  • no unique commands for that condition
  • m_action = NONE
  • m_dragging is still true

When left mouse button is released...

  • m_action is still NONE

When left mouse button is pressed again... (this is when the points pop back up)

  • m_pattern->addJournalCheckPoint()
  • m_action = MOVE_VALUE

After that, when mouse is moved, left button held, and in draw mode...

  • drawLine is called
  • m_pattern->setDragValue() is called
  • m_dragging is still true
  • m_timeMap = m_oldTimeMap

When left mouse button is released again...

  • m_action = MOVE_VALUE
  • m_pattern->applyDragValue() is finally called
  • m_dragging set to false
  • m_action is set back to NONE

Seems that the whole time the left mouse button is being held, and the right mouse button is repeatedly clicked, neither applyDragValue nor setDragValue gets called until the left mouse button is released and pressed again.

@tecknixia
Copy link
Contributor

It seems to me that deleting while dragging is difficult to encode, due to the fact that right clicking is designed for erasure and removes the dragged value along with the mapped point. I have not been able to create a workaround for this that does not involve heavy editing. Deleting points while dragging also seems not very useful to me.

  • The bug does not seem to be affecting other scenarios.
  • It does not seem reasonable to make major changes for a rare case scenario with little value.

It seems much more likely that a user will start dragging a point, then change their mind. I am creating a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants