Skip to content
13 changes: 5 additions & 8 deletions packages/text-annotator/src/TextAnnotator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface TextAnnotator<I extends TextAnnotation = TextAnnotation, E exte

setStyle(style: HighlightStyleExpression | undefined): void;

redraw(force?: boolean): void;

// Returns true if successful (or false if the annotation is not currently rendered)
scrollIntoView(annotationOrId: I | string): boolean;

Expand Down Expand Up @@ -92,9 +94,6 @@ export const createTextAnnotator = <I extends TextAnnotation = TextAnnotation, E
selectionHandler.setFilter(filter);
}

const setStyle = (style: HighlightStyleExpression | undefined) =>
highlightRenderer.setStyle(style);

const setUser = (user: User) => {
currentUser = user;
selectionHandler.setUser(user);
Expand All @@ -115,9 +114,6 @@ export const createTextAnnotator = <I extends TextAnnotation = TextAnnotation, E
}
}

const setVisible = (visible: boolean) =>
highlightRenderer.setVisible(visible);

const destroy = () => {
highlightRenderer.destroy();
selectionHandler.destroy();
Expand All @@ -132,11 +128,12 @@ export const createTextAnnotator = <I extends TextAnnotation = TextAnnotation, E
element: container,
getUser,
setFilter,
setStyle,
setStyle: highlightRenderer.setStyle.bind(highlightRenderer),
redraw: highlightRenderer.redraw.bind(highlightRenderer),
setUser,
setSelected,
setPresenceProvider,
setVisible,
setVisible: highlightRenderer.setVisible.bind(highlightRenderer),
on: lifecycle.on,
off: lifecycle.off,
scrollIntoView: scrollIntoView(container, store),
Expand Down