Multi-user selection painting #641
matthew-carroll
started this conversation in
Post Mortem
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
WORK IN PROGRESS
Multi-user selection painting was filed in #631.
Remote user selections need to be painted alongside the primary user's selection.
The big picture
Multi-user selection painting was achieved with the following changes:
DocumentComposer
, which logically represents all document selections other than the primary user's selection.NonPrimarySelectionStyler
toSingleColumnLayoutSelectionStyler
, which is responsible for choosing colors for each non-primary selection.StyledSelection
s instead of a single set of selection styles:ListItemComponentViewModel
,BlockquoteComponentViewModel
,ParagraphComponentViewModel
,ImageComponentViewModel
, andHorizontalRuleComponentViewModel
.TextComponent
to accept a list ofStyledSelection
s instead of single set of selection styles. Also changeTextComponent
s widget tree to use aSuperTextWithSelection.multi()
instead ofSuperTextWithSelection.single()
.Experience with the changes
Making the changes was relatively straightforward. The only necessary re-wiring was the replacement of individual properties like
selectionColor
with a list ofStyledSelection
s, each of which includes theselectionColor
and the associatedselection
.View model changes were monotonous and nearly identical. Each of the effected view models needed to have their constructor arguments changed to replace individual properties with the list of
StyledSelection
. The same change needed to happen to the view models' properties. ThehashCode
and==
methods needed to be updated. The==
methods needed the introduction ofDeepCollectionEquality()
to check list item equality.Beta Was this translation helpful? Give feedback.
All reactions