aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DragManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-01-20 18:35:58 -0500
committerbobzel <zzzman@gmail.com>2021-01-20 18:35:58 -0500
commit68785a97178d229935c0429791081d7c09312dc3 (patch)
tree8260fb1c23ad3f145146b3102cd294fb85ca1044 /src/client/util/DragManager.ts
parent8538a83baf57d7015b62b4ebc22d2bd7318f9d16 (diff)
moved PDFMenu to AnchorMenu. added AnchorMenu to formattedTextBox. Fixed following links from text box huyperlinks when there are multiple different huypertext links on the document.
Diffstat (limited to 'src/client/util/DragManager.ts')
-rw-r--r--src/client/util/DragManager.ts24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts
index 52ccfda74..7b4d43793 100644
--- a/src/client/util/DragManager.ts
+++ b/src/client/util/DragManager.ts
@@ -105,14 +105,14 @@ export namespace DragManager {
constructor(aborted: boolean, dragData: { [id: string]: any }) {
this.aborted = aborted;
this.docDragData = dragData instanceof DocumentDragData ? dragData : undefined;
- this.annoDragData = dragData instanceof PdfAnnoDragData ? dragData : undefined;
+ this.annoDragData = dragData instanceof AnchorAnnoDragData ? dragData : undefined;
this.linkDragData = dragData instanceof LinkDragData ? dragData : undefined;
this.columnDragData = dragData instanceof ColumnDragData ? dragData : undefined;
}
linkDocument?: Doc;
aborted: boolean;
docDragData?: DocumentDragData;
- annoDragData?: PdfAnnoDragData;
+ annoDragData?: AnchorAnnoDragData;
linkDragData?: LinkDragData;
columnDragData?: ColumnDragData;
}
@@ -152,19 +152,21 @@ export namespace DragManager {
}
colKey: SchemaHeaderField;
}
- // used by PDFs to conditionally (if the drop completes) create a text annotation when dragging from the PDF toolbar when a text region has been selected.
+ // used by PDFs,Text,Image,Video,Web to conditionally (if the drop completes) create a text annotation when dragging the annotate button from the AnchorMenu when a text/region selection has been made.
// this is pretty clunky and should be rethought out using linkDrag or DocumentDrag
- export class PdfAnnoDragData {
- constructor(dragDoc: Doc, annotationDoc: Doc, dropDoc: Doc) {
+ export class AnchorAnnoDragData {
+ constructor(dragDoc: Doc, annotationDocCreator: () => Doc, dropDocCreator: () => Doc) {
this.dragDocument = dragDoc;
- this.dropDocument = dropDoc;
- this.annotationDocument = annotationDoc;
+ this.dropDocCreator = dropDocCreator;
+ this.annotationDocCreator = annotationDocCreator;
this.offset = [0, 0];
}
targetContext: Doc | undefined;
dragDocument: Doc;
- annotationDocument: Doc;
- dropDocument: Doc;
+ annotationDocCreator: () => Doc;
+ dropDocCreator: () => Doc;
+ dropDocument?: Doc;
+ annotationDocument?: Doc;
offset: number[];
dropAction: dropActionType;
userDropAction: dropActionType;
@@ -250,7 +252,7 @@ export namespace DragManager {
}
// drag&drop the pdf annotation anchor which will create a text note on drop via a dropCompleted() DragOption
- export function StartPdfAnnoDrag(eles: HTMLElement[], dragData: PdfAnnoDragData, downX: number, downY: number, options?: DragOptions) {
+ export function StartAnchorAnnoDrag(eles: HTMLElement[], dragData: AnchorAnnoDragData, downX: number, downY: number, options?: DragOptions) {
StartDrag(eles, dragData, downX, downY, options);
}
@@ -353,7 +355,7 @@ export namespace DragManager {
const xs: number[] = [];
const ys: number[] = [];
- docsBeingDragged = dragData instanceof DocumentDragData ? dragData.draggedDocuments : dragData instanceof PdfAnnoDragData ? [dragData.dragDocument] : [];
+ docsBeingDragged = dragData instanceof DocumentDragData ? dragData.draggedDocuments : dragData instanceof AnchorAnnoDragData ? [dragData.dragDocument] : [];
const elesCont = {
left: Number.MAX_SAFE_INTEGER,
top: Number.MAX_SAFE_INTEGER,