Repository navigation
Conversation
group() makes one object of the selected objects, and ungroup() takes it apart. canGroup() and canUngroup() tell whether they can be used. A group is a class of its own (SketchGroup), so that it is saved and loaded as a group, and the group of an arrow is not taken apart. Both are one undo step. The history puts the group back as the same object, so the modifications made on it can still be undone. The group takes the place of the topmost of its objects, and the text box of a rectangle label goes into the group with its rectangle. The showcase has Group and Ungroup buttons in the selection panel, with Ctrl G and Ctrl Shift G. The buttons of the panel are small, so that the row of five fits in the panel when it scrolls.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #42 (not closed by this: the issue can be answered once it is released).
Change
The issue asks for fabric's group: select some objects and group them.
group()makes one object of the selected objects (two or more) and selects it.ungroup()takes the selected group apart and selects its objects, which stay where they are on the canvas, with the move, the scale and the turn which the group gave them.canGroup()andcanUngroup()tell whether they will do something, for example to enable a button.SketchGroup, saved with its type and loaded as one byvalue,defaultValueandfromJSON(). The group of the arrow tool is a plain group, so it is never taken apart.onChangeand notonObjectAdded.onChangenote intypes.ts, and the CHANGELOG.Verification
history/grouping.spec.tsx: can group and ungroup, the group (selected, objects kept where they are, place among the objects, order, undo, redo, no-ops,onChange), a group which is changed (move, undo and redo of it; ungroup, its undo and the undo of the move; redo of all of it), ungroup (position, move, scale and turn of the group, undo and redo, a group in a group,onChange), a group among the objects (saved and loaded as aSketchGroup, copied, removed and put back), and a rectangle with a label. Three deliberate breakages of the code (the place of the group, the text box of the label, a new group instead of the same one) each fail some of them.yarn buildpass.canGroup()andcanUngroup()say. The horizontal scrollbar of the panel was reproduced with a short window and 15 pixel scrollbars, and is gone.Notes
ungroup()takes apart one selected group, not several at once.SketchHistory.ts(the entries of the history),CHANGELOG.mdand the showcase store and actions, so the second of the two to merge needs a conflict resolution.