-
Notifications
You must be signed in to change notification settings - Fork 176
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
#1990: Functional group does not connect with another functional group on click&drag #2208
#1990: Functional group does not connect with another functional group on click&drag #2208
Conversation
…th-another-functional-group-on-clickdrag
…up on click&drag
…oup-does-not-connect-with-another-functional-group-on-clickdrag
941319b
to
5d7b2a3
Compare
8211e49
to
3bed375
Compare
…th-another-functional-group-on-clickdrag
@@ -403,7 +354,7 @@ class TemplateTool { | |||
let action | |||
let pasteItems = null | |||
|
|||
if (SGroup.isSaltOrSolvent(this.template.molecule.name)) { | |||
if (this.isSaltOrSolvant) { |
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.
if (this.isSaltOrSolvant) { | |
if (this.isSaltOrSolvent) { |
xy0?: Vec2 | ||
angle0?: number | ||
} | ||
function prepareTemplateFromSingleGroup(molecule: Struct): Template | null { |
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.
May be we need to add some comment that this function calculates the position of FG and its rotation angle?
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.
Added.
|
||
constructor(editor, struct) { | ||
this.editor = editor | ||
this.editor.selection(null) | ||
this.struct = struct | ||
|
||
this.isSingleContractedGroup = | ||
struct.isSingleGroup() && !struct.functionalGroups.get(0).isExpanded |
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.
Hmm, are you sure we can rely on 0
?
I guess, in this case we need to get first FG by something like struct.functionaGroups.values().next()
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 am sure.
If id is something else than 0
, it should be treated as a bug and fixed.
This "struct" is considered to be a brand-new structure with ids different from actual canvas.
And if first (and only, as we verify beforehand) group has non-0 id, it's a clear marker of a bug.
…th-another-functional-group-on-clickdrag
…p on click&drag (#2208) * #1990 - Detect if group is attached to smth + get attachment atom * #1990 - template tool mousedown() refactor * #1990 - Functional group does not connect with another functional group on click&drag * #1990 - #2195 merge fixes * #1990 - cleanup * #1990 - hotfix * #1990 - fixes and clarifications after review --------- Co-authored-by: Stanislav Permiakov <Stanislav.Permiakov@primark.onmicrosoft.com> Co-authored-by: Stanislav Permiakov <stanislav_permiakov@epam.com>
Fixed
Added
Refactored
getGroupsIdsFromBondId
— since bond can belong to more than one group, it should return array and not single number. Previously added `getGroupIdFromBondId" left for compatibility purposes and should be removed laterfindClosestFG
extended with possibility to skip items, but for now not used (replaced with easier solution). Potentially required to get target group for hover when pasting/inserting another group (to avoid editor picking the same group you're pasting as "closest")