66 PlaitOperation ,
77 PlaitPluginKey ,
88 PlaitPointerType ,
9+ Point ,
910 RectangleClient ,
1011 SELECTION_BORDER_COLOR ,
1112 WithSelectionPluginOptions
@@ -112,7 +113,7 @@ export function setSelectedElementsWithGroup(board: PlaitBoard, elements: PlaitE
112113 if ( isShift ) {
113114 cacheSelectedElementsWithGroupOnShift ( board , elements , isSelectGroupElement , elementsInHighestGroup ) ;
114115 } else {
115- cacheSelectedElementsWithGroup ( board , elements , isSelectGroupElement , hitElementGroups ) ;
116+ cacheSelectedElementsWithGroup ( board , elements , isSelectGroupElement , hitElementGroups , board . selection . anchor ) ;
116117 }
117118 }
118119 }
@@ -154,15 +155,16 @@ export function cacheSelectedElementsWithGroup(
154155 board : PlaitBoard ,
155156 elements : PlaitElement [ ] ,
156157 isSelectGroupElement : boolean ,
157- hitElementGroups : PlaitGroup [ ]
158+ hitElementGroups : PlaitGroup [ ] ,
159+ hitPoint : Point
158160) {
159161 let newElements = [ ...elements ] ;
160162 const selectedGroups = filterSelectedGroups ( board , hitElementGroups ) ;
161163 if ( selectedGroups . length > 0 ) {
162164 if ( selectedGroups . length > 1 ) {
163165 newElements = getAllElementsInGroup ( board , selectedGroups [ selectedGroups . length - 2 ] , true ) ;
164166 } else {
165- const element = board . getOneHitElement ( elements ) ;
167+ const element = board . getOneHitElement ( elements , hitPoint ) ;
166168 if ( element ) {
167169 newElements = [ element ] ;
168170 }
@@ -172,7 +174,7 @@ export function cacheSelectedElementsWithGroup(
172174 if ( ! isSelectGroupElement ) {
173175 newElements = elementsInGroup ;
174176 } else {
175- const element = board . getOneHitElement ( elements ) ;
177+ const element = board . getOneHitElement ( elements , hitPoint ) ;
176178 if ( element ) {
177179 newElements = [ element ] ;
178180 }
0 commit comments