Skip to content

Commit

Permalink
Added redraw re-export from the highlightRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-danylchenko committed Jun 6, 2024
1 parent 58d2d1c commit 932f585
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions packages/text-annotator/src/TextAnnotator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface TextAnnotator<E extends unknown = TextAnnotation> extends Annot

setStyle(style: HighlightStyleExpression | undefined): void;

redraw(force?: boolean): void;

// Returns true if successful (or false if the annotation is not currently rendered)
scrollIntoView(annotation: TextAnnotation): boolean;

Expand Down Expand Up @@ -82,12 +84,6 @@ export const createTextAnnotator = <E extends unknown = TextAnnotation>(

const getUser = () => currentUser;

const setFilter = (filter?: Filter) =>
highlightRenderer.setFilter(filter);

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

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

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

const destroy = () => {
highlightRenderer.destroy();
selectionHandler.destroy();
Expand All @@ -124,12 +117,13 @@ export const createTextAnnotator = <E extends unknown = TextAnnotation>(
destroy,
element: container,
getUser,
setFilter,
setStyle,
setFilter: highlightRenderer.setFilter.bind(highlightRenderer),
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

0 comments on commit 932f585

Please sign in to comment.