-
Notifications
You must be signed in to change notification settings - Fork 187
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
#6215 – Introducing the snap to angle and standard bond length for monomers connected via bonds #6570
Conversation
snapPosition, | ||
).length(); | ||
|
||
if (distanceToSnapPosition < 0.375) { |
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.
Maybe move 0.375 to constant and use here and I remember the same somewhere in curved bonds
SelectRectangle.calculateAngleSnap( | ||
cursorPositionInAngstroms, | ||
connectedMonomer.position, | ||
this.editor.mode.modeName === 'snake-layout-mode' ? 90 : 30, |
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.
Maybe use this.editor.mode instanceof SnakeMode?
if (isAngleSnapped && isDistanceSnapped) { | ||
snapPosition = distanceSnapPosition; | ||
} else if (isAngleSnapped) { | ||
snapPosition = angleSnapPosition; | ||
} else if (isDistanceSnapped) { | ||
snapPosition = distanceSnapPosition; | ||
} |
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.
Very clear what happens in this method. Thank you
this.topLayer.selectAll('*').remove(); | ||
this.defaultLayer.selectAll('*').remove(); |
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.
Not sure how * selector works for d3, but potentially it could be a cause of performance degradation in some cases. Let's just keep it in mind for now.
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.
Maybe it would be better to organize elements somehow to delete only group element
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.
I had this concern as well but I considered it shouldn't be a bottleneck considering each layer will hardly contain more than 5-10 elements at once, so it wouldn't be an issue. Also, according to the docs, D3 selectAll
function is quite efficient
We can surely keep it in mind if any performance drops will arise
885f752
to
250b9f1
Compare
dacf870
to
4ad7940
Compare
How the feature works? / How did you fix the issue?
(Screenshots, videos, or GIFs, if applicable)
Check list
#1234 – issue name