aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/Annotation.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-10-12 11:24:19 -0400
committerbobzel <zzzman@gmail.com>2023-10-12 11:24:19 -0400
commit53d456afb43b70cc240bc6a37094fa37cfe37436 (patch)
tree1c45b91992e766da36a92ae652aa7ebe122ff664 /src/client/views/pdf/Annotation.tsx
parent54e80f26df04f1a031d1d7e4b840fe9426d4d2cf (diff)
performance fixes to reduce re-rendering : moved link brushing out of Doc's highlighting and into Annotation.tsx, stopped freeformview from rerendering whenever its invalidated by not always setting layoutElements to a new list.
Diffstat (limited to 'src/client/views/pdf/Annotation.tsx')
-rw-r--r--src/client/views/pdf/Annotation.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx
index caa72c9dc..52904b852 100644
--- a/src/client/views/pdf/Annotation.tsx
+++ b/src/client/views/pdf/Annotation.tsx
@@ -11,6 +11,7 @@ import { OpenWhere } from '../nodes/DocumentView';
import { FieldViewProps } from '../nodes/FieldView';
import { AnchorMenu } from './AnchorMenu';
import './Annotation.scss';
+import { LinkManager } from '../../util/LinkManager';
interface IAnnotationProps extends FieldViewProps {
anno: Doc;
@@ -86,6 +87,13 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
}
};
+ @computed get linkHighlighted() {
+ for (const link of LinkManager.Instance.getAllDirectLinks(this.props.document)) {
+ const a1 = LinkManager.getOppositeAnchor(link, this.props.document);
+ if (a1 && Doc.IsBrushedDegreeUnmemoized(DocCast(a1.annotationOn, this.props.document))) return true;
+ }
+ }
+
render() {
const brushed = this.annoTextRegion && Doc.isBrushedHighlightedDegree(this.annoTextRegion);
return (
@@ -108,7 +116,7 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> {
height: NumCast(this.props.document._height),
opacity: brushed === Doc.DocBrushStatus.highlighted ? 0.5 : undefined,
pointerEvents: this.props.pointerEvents?.() as any,
- outline: brushed === Doc.DocBrushStatus.linkHighlighted ? 'solid 1px lightBlue' : undefined,
+ outline: brushed === Doc.DocBrushStatus.unbrushed && this.linkHighlighted ? 'solid 1px lightBlue' : undefined,
backgroundColor: brushed === Doc.DocBrushStatus.highlighted ? 'orange' : StrCast(this.props.document.backgroundColor),
}}
/>