aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-10-19 00:58:50 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2023-10-19 00:58:50 -0400
commit1efba5a6a80cba09633426fc8cb42be4bf9b2e74 (patch)
treeabd78b4818115b300fb934e343f41417ac13e19f /src/client/views/pdf
parent612f3d05927113c7b010861c17765fcead4752e5 (diff)
parentabf40af6dd617de6486a97e8b5f276db232119ed (diff)
Merge branch 'master' into sophie-ai-images
Diffstat (limited to 'src/client/views/pdf')
-rw-r--r--src/client/views/pdf/Annotation.tsx10
-rw-r--r--src/client/views/pdf/PDFViewer.tsx3
2 files changed, 11 insertions, 2 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),
}}
/>
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 23dc084ad..58a54764d 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -525,6 +525,7 @@ export class PDFViewer extends React.Component<IViewerProps> {
return this.props.styleProvider?.(doc, props, property);
};
+ childPointerEvents = () => (this.props.isContentActive() !== false ? 'all' : 'none');
renderAnnotations = (childFilters: () => string[], mixBlendMode?: any, display?: string) => (
<div
className="pdfViewerDash-overlay"
@@ -539,7 +540,7 @@ export class PDFViewer extends React.Component<IViewerProps> {
NativeHeight={returnZero}
setContentView={emptyFunction} // override setContentView to do nothing
pointerEvents={this.props.isContentActive() && (SnappingManager.GetIsDragging() || Doc.ActiveTool !== InkTool.None) ? returnAll : returnNone} // freeform view doesn't get events unless something is being dragged onto it.
- childPointerEvents={this.props.isContentActive() !== false ? 'all' : 'none'} // but freeform children need to get events to allow text editing, etc
+ childPointerEvents={this.childPointerEvents} // but freeform children need to get events to allow text editing, etc
renderDepth={this.props.renderDepth + 1}
isAnnotationOverlay={true}
fieldKey={this.props.fieldKey + '_annotations'}