-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix canExtrudeSelectionItem and getSelectionType for multiple selections #3884
Fix canExtrudeSelectionItem and getSelectionType for multiple selections #3884
Conversation
used to count only same type as first selection
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
This looks like it'll work for the purposes of unblocking you so I support it, but I do think we should rethink the generic approach in future.
Instead of this getSelectionType
and canExtrudeSectionItem
stuff, I think future selection command argument configurations should pass in their own validate()
functions, which inspect the raw selection
to see if it is valid for that command.
const singleSelection = { | ||
...selection, | ||
codeBasedSelections: [selection.codeBasedSelections[i]], | ||
} |
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.
This is likely a nit, but aren't you already set up to isolate the codeBasedSelections
up within the canExtrudeSelectionItem
function itself?
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.
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.
we should rethink the generic approach in future.
@franknoirot
agree, those are good points, probably will be covered by #3837
This pr closes: #3834
It is a part of bigger project: #2606
PR Description:
This PR addresses and fixes two key issues within the selection logic in the
canExtrudeSelectionItem
andgetSelectionType
functions. The previous implementation had limitations when handling multiple selections, resulting in incorrect selection typing and behavior for mixed sets of selections:Example:
it would return:
['extrude-wall', 1]
for a selection of single edge, which is correctbut for 2 edges it would return
['other', 2]
, which is incorrect and expected to be['extrude-wall', 2]
Data Flow:
getSelectionType
usescanExtrudeSelectionItem
to determine whether a selection is anextrude-wall
or not, and passes the wholeselection
with all currently selected ranges stored in theselection.codeBasedSelections
array and theindex
of the item that shall be checked.canExtrudeSelectionItem
performs a triple check of the selected item with:isSketchPipe
,nodeHasClose
, andnodeHasExtrude
.isSketchPipe
does not have anindex
argument, onlyselection
. It checks the selection withisSingleCursorInPipe
and always returnsfalse
in the case of multiple selections. It has to be fixed.Key Changes:
Fixed
canExtrudeSelectionItem
:isSketchPipe
, which is only capable of handling single selections.isSketchPipe
, ensuring it works correctly for each item in the selection list. This fix allowscanExtrudeSelectionItem
to return the correct result for each selection, even in cases where multiple selections are made.Improved
getSelectionType
:other
, any subsequentextrude-wall
types would be ignored, and vice versa.extrude-wall
. If there’s any non-extrudable selection, the type defaults toother
, accurately reflecting the mixed nature of the selection set.These changes ensure the selection logic works as expected for both single and multiple selections.
Other Findings:
extrude-wall
, including not-extruded sketches, faces, and edges. Since it does not block me from multiple fillets and will be addressed in the PR mentioned above by @Irev-Dev - I am ignoring it.nodeHasExtrude
: Returnstrue
even if an extrude does not exist. Shall I fix it in a separate PR ?Next steps:
I am 1 step away from the multiple fillets working, only one thing left to address is:
commenting out the
focusPath
works: