in frontend/src/common/components/hocr/hocr-preview/hocr-preview.component.tsx [62:88]
safeStyle: injectDefaultPreviewStyle(props.userStyle),
}
}
public static defaultProps: Partial<HocrPreviewProps> = {
pageIndex: 'auto',
};
private viewportRef = null;
private saveViewportRef = (node) => {
this.viewportRef = node;
}
private scrollTo = (targetPosSize: PosSize) => {
if (!this.viewportRef || !targetPosSize || !this.state.pagePosSize) return;
const shift = calculateNodeShiftInContainer(targetPosSize, this.state.pagePosSize);
if (!shift) return;
const {x, y} = shift;
const scrollLeft = this.viewportRef.scrollWidth * x - (this.viewportRef.clientWidth * 0.5);
const scrollTop = this.viewportRef.scrollHeight * y - (this.viewportRef.clientHeight * 0.3);
// Workd around Edge Bug
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15534521/
if(this.viewportRef.scrollTo) {