Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added redraw re-export from the highlightRenderer #104

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
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 @@ -93,9 +95,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 @@ -116,9 +115,6 @@ export const createTextAnnotator = <I extends TextAnnotation = TextAnnotation, E
}
}

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

const destroy = () => {
highlightRenderer.destroy();
selectionHandler.destroy();
Expand All @@ -133,11 +129,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