@@ -24,9 +24,8 @@ export const rangeToSelector = (range: Range, container: HTMLElement, offsetRefe
2424}
2525
2626export const SelectionHandler = (
27- container : HTMLElement ,
27+ container : HTMLElement ,
2828 state : TextAnnotatorState ,
29- // Experimental
3029 offsetReferenceSelector ?: string
3130) => {
3231
@@ -47,7 +46,7 @@ export const SelectionHandler = (
4746 return ;
4847
4948 // Make sure we don't listen to selection changes that
50- // were not started on the container, or which are not supposed to
49+ // were not started on the container, or which are not supposed to
5150 // be annotatable (like the popup)
5251 const annotatable = ! ( evt . target as Node ) . parentElement . closest ( '.not-annotatable' ) ;
5352 if ( annotatable ) {
@@ -72,7 +71,7 @@ export const SelectionHandler = (
7271 debounceTimer = setTimeout ( ( ) => onSelectionChange ( ) , 50 ) ;
7372 } ) ;
7473
75- const onSelectionChange = ( ) => {
74+ const onSelectionChange = ( ) => {
7675 const sel = document . getSelection ( ) ;
7776
7877 if ( ! sel . isCollapsed && isLeftClick && currentTarget ) {
@@ -89,7 +88,7 @@ export const SelectionHandler = (
8988 ...currentTarget ,
9089 selector : rangeToSelector ( ranges [ 0 ] , container , offsetReferenceSelector )
9190 } ;
92-
91+
9392 if ( store . getAnnotation ( currentTarget . annotation ) ) {
9493 store . updateTarget ( currentTarget , Origin . LOCAL ) ;
9594 } else {
@@ -129,13 +128,13 @@ export const SelectionHandler = (
129128
130129 currentTarget = null ;
131130 lastPointerEvent = undefined ;
132- } else {
131+ } else {
133132 const { x, y } = container . getBoundingClientRect ( ) ;
134-
133+
135134 const hovered = store . getAt ( evt . clientX - x , evt . clientY - y ) ;
136135 if ( hovered ) {
137136 const { selected } = selection ;
138-
137+
139138 if ( selected . length !== 1 || selected [ 0 ] . id !== hovered . id ) {
140139 selection . clickSelect ( hovered . id , evt ) ;
141140 lastPointerEvent = undefined ;
@@ -151,4 +150,4 @@ export const SelectionHandler = (
151150 setUser
152151 }
153152
154- }
153+ }
0 commit comments