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

Errors when dragging multiple lines #111

Open
DYBCyrus opened this issue May 20, 2017 · 1 comment
Open

Errors when dragging multiple lines #111

DYBCyrus opened this issue May 20, 2017 · 1 comment

Comments

@DYBCyrus
Copy link
Member

Create few points and link them by lines. Once you select some lines, if any two of them have intersection, the graph will move strangely. The standard should be the case that no matter how many lines you select, the graph should move in a whole. But now every points and lines are moving differently.

@UltimatePea
Copy link
Member

This is the bug that has been addressed in #1 , It is related to the definition of the translate function in the Line class. Basically, translate method is invoked for each of the line class, where both line segments try to move that connect point together. This creates a strange behavior. However, translate method in Line Segment class should not depend on SelectTool's selections. Trying to naively fix this bug might cause dependency problem, and difficulties in maintaining the codes in the future. It is often known as "Technology Debt".

One way to improve the whole design would be to forbid two lines to be selected at the same time, since doing so has no immediate meaning.

However, the latter approach would introduce LineSegment dependency of the SelectTool, which is not good. (still better than the first design). If you REALLY want to fix this, use the latter design.

Also, before trying to solve the problem, please lookup design patterns. Research patterns as "Strategy Pattern", "Dependency Inversion", "Observer Pattern". If you do not understand these terms, please ask Kaijie Cai @kjcai for help. He is familiar with those patterns.

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

No branches or pull requests

3 participants