|
@@ -24,6 +24,8 @@ import PaintLink from './paint/link'
|
|
|
import Link from './link.js'
|
|
|
import AddSignatureFields from '../form/add_signature_fields.js'
|
|
|
import SignatureFields from '../form/signature_fields.js'
|
|
|
+import PaintRedaction from './paint/redaction'
|
|
|
+import Redaction from './redaction.js'
|
|
|
|
|
|
// 注释的画布层
|
|
|
class ComPDFAnnotationLayer {
|
|
@@ -60,6 +62,7 @@ class ComPDFAnnotationLayer {
|
|
|
this.selectedElementName = null
|
|
|
this.addMode = false
|
|
|
this.toolMode = pageViewer.toolMode || ''
|
|
|
+ this.managerArray = ['freetextManager', 'textManager', 'textFieldManager', 'checkBoxManager', 'radioButtonManager', 'pushButtonManager', 'listBoxManager', 'comboBoxManager', 'annotateManager', 'linkManager', 'signFieldManager', 'redactionManager']
|
|
|
|
|
|
this.annotationStore = annotationStore
|
|
|
|
|
@@ -90,121 +93,26 @@ class ComPDFAnnotationLayer {
|
|
|
if (!tool || markup.includes(tool)) {
|
|
|
document.querySelector('.document').classList.remove('annotation-edit')
|
|
|
}
|
|
|
+
|
|
|
if (markup.includes(tool) || tool === 'cropPage' || tool === 'selectText') {
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers()
|
|
|
}
|
|
|
+
|
|
|
const shapes = ['line', 'arrow', 'circle', 'square', 'ink']
|
|
|
if (markup.includes(tool) && color) {
|
|
|
this.svgElement.classList.add('point-none')
|
|
|
}
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.tool = tool
|
|
|
- this.annotateManager.color = color
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.tool = tool
|
|
|
- this.freetextManager.color = color
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.tool = tool
|
|
|
- this.textManager.color = color
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.tool = tool
|
|
|
- this.textFieldManager.color = color
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.tool = tool
|
|
|
- this.checkBoxManager.color = color
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.tool = tool
|
|
|
- this.radioButtonManager.color = color
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.tool = tool
|
|
|
- this.pushButtonManager.color = color
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.tool = tool
|
|
|
- this.listBoxManager.color = color
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.tool = tool
|
|
|
- this.comboBoxManager.color = color
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.tool = tool
|
|
|
- this.linkManager.color = color
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.tool = tool
|
|
|
- this.signFieldManager.color = color
|
|
|
- }
|
|
|
+
|
|
|
+ this.managerArray.forEach(manager => {
|
|
|
+ if (this[manager]) {
|
|
|
+ this[manager].tool = this.tool
|
|
|
+ this[manager].color = this.color
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
if (shapes.includes(tool) && color) {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('annotateManager')
|
|
|
if (this.annotateManager) {
|
|
|
this.annotateManager.init()
|
|
|
return
|
|
@@ -223,36 +131,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'freetext') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('freetextManager')
|
|
|
if (this.freetextManager) {
|
|
|
this.freetextManager.init()
|
|
|
return
|
|
@@ -271,36 +150,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'text') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('textManager')
|
|
|
if (this.textManager) {
|
|
|
this.textManager.init()
|
|
|
return
|
|
@@ -319,36 +169,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'textfield') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('textFieldManager')
|
|
|
if (this.textFieldManager) {
|
|
|
this.textFieldManager.init()
|
|
|
return
|
|
@@ -367,36 +188,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'checkbox') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('checkBoxManager')
|
|
|
if (this.checkBoxManager) {
|
|
|
this.checkBoxManager.init()
|
|
|
return
|
|
@@ -415,36 +207,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'radiobutton') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('radioButtonManager')
|
|
|
if (this.radioButtonManager) {
|
|
|
this.radioButtonManager.init()
|
|
|
return
|
|
@@ -463,36 +226,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'pushbutton') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('pushButtonManager')
|
|
|
if (this.pushButtonManager) {
|
|
|
this.pushButtonManager.init()
|
|
|
return
|
|
@@ -511,36 +245,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'combobox') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('comboBoxManager')
|
|
|
if (this.comboBoxManager) {
|
|
|
this.comboBoxManager.init()
|
|
|
return
|
|
@@ -559,36 +264,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'listbox') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('listBoxManager')
|
|
|
if (this.listBoxManager) {
|
|
|
this.listBoxManager.init()
|
|
|
return
|
|
@@ -606,71 +282,10 @@ class ComPDFAnnotationLayer {
|
|
|
selectedElementName: this.selectedElementName
|
|
|
})
|
|
|
} else if (tool === 'stamp') {
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers()
|
|
|
} else if (tool === 'link') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('linkManager')
|
|
|
if (this.linkManager) {
|
|
|
this.linkManager.init()
|
|
|
return
|
|
@@ -689,36 +304,7 @@ class ComPDFAnnotationLayer {
|
|
|
})
|
|
|
} else if (tool === 'signatureFields') {
|
|
|
document.querySelector('.document').classList.add('annotation-edit')
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers('signFieldManager')
|
|
|
if (this.signFieldManager) {
|
|
|
this.signFieldManager.init()
|
|
|
return
|
|
@@ -735,9 +321,36 @@ class ComPDFAnnotationLayer {
|
|
|
eventBus: this.eventBus,
|
|
|
selectedElementName: this.selectedElementName
|
|
|
})
|
|
|
+ } else if (tool === 'redaction') {
|
|
|
+ document.querySelector('.document').classList.add('annotation-edit')
|
|
|
+ this.resetManagers('redactionManager')
|
|
|
+ if (this.redactionManager) {
|
|
|
+ this.redactionManager.init()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.redactionManager = new PaintRedaction({
|
|
|
+ tool,
|
|
|
+ color,
|
|
|
+ container: this.pageDiv,
|
|
|
+ svgElement: this.svgElement,
|
|
|
+ layer: this,
|
|
|
+ viewport: this.viewport,
|
|
|
+ scale: this.scale,
|
|
|
+ page: this.page,
|
|
|
+ eventBus: this.eventBus,
|
|
|
+ selectedElementName: this.selectedElementName
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ resetManagers(ignoreManagers = []) {
|
|
|
+ if (!Array.isArray(ignoreManagers)) ignoreManagers = [ignoreManagers]
|
|
|
+ const managers = this.managerArray.filter(item => !ignoreManagers.includes(item))
|
|
|
+ managers.forEach(manager => {
|
|
|
+ this[manager] && this[manager].reset()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
// 渲染注释
|
|
|
render(viewport) {
|
|
|
if (this._cancelled) {
|
|
@@ -754,39 +367,11 @@ class ComPDFAnnotationLayer {
|
|
|
this.viewport = clonedViewport;
|
|
|
this.scale = clonedViewport.scale
|
|
|
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.viewport = clonedViewport
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.viewport = clonedViewport
|
|
|
- }
|
|
|
+ this.managerArray.forEach(manager => {
|
|
|
+ if (this[manager]) {
|
|
|
+ this[manager].viewport = clonedViewport
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
if (!this.div) {
|
|
|
this.renderContainer()
|
|
@@ -1047,39 +632,8 @@ class ComPDFAnnotationLayer {
|
|
|
}
|
|
|
this.div?.remove()
|
|
|
this.div = null
|
|
|
- if (this.freetextManager) {
|
|
|
- this.freetextManager.reset()
|
|
|
- }
|
|
|
- if (this.textManager) {
|
|
|
- this.textManager.reset()
|
|
|
- }
|
|
|
- if (this.textFieldManager) {
|
|
|
- this.textFieldManager.reset()
|
|
|
- }
|
|
|
- if (this.checkBoxManager) {
|
|
|
- this.checkBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.radioButtonManager) {
|
|
|
- this.radioButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.pushButtonManager) {
|
|
|
- this.pushButtonManager.reset()
|
|
|
- }
|
|
|
- if (this.listBoxManager) {
|
|
|
- this.listBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.comboBoxManager) {
|
|
|
- this.comboBoxManager.reset()
|
|
|
- }
|
|
|
- if (this.annotateManager) {
|
|
|
- this.annotateManager.reset()
|
|
|
- }
|
|
|
- if (this.linkManager) {
|
|
|
- this.linkManager.reset()
|
|
|
- }
|
|
|
- if (this.signFieldManager) {
|
|
|
- this.signFieldManager.reset()
|
|
|
- }
|
|
|
+ this.resetManagers()
|
|
|
+
|
|
|
this.eventBus._off('toolChanged', this.onHandleTool)
|
|
|
this.eventBus._off('toolModeChanged', this.onHandleToolMode)
|
|
|
this.eventBus._off('setDefaultSelect', this.onHandleDefaultSelect)
|
|
@@ -1304,6 +858,19 @@ class ComPDFAnnotationLayer {
|
|
|
messageHandler: this.messageHandler
|
|
|
})
|
|
|
this.annotationsArray.push(signatureFields)
|
|
|
+ } else if (annotation.type === 'redaction' && !annotation.isDelete) {
|
|
|
+ const redaction = new Redaction({
|
|
|
+ container: this.div,
|
|
|
+ annotation,
|
|
|
+ page: this.page,
|
|
|
+ viewport: this.viewport,
|
|
|
+ scale: this.scale,
|
|
|
+ eventBus: this.eventBus,
|
|
|
+ layer: this,
|
|
|
+ show,
|
|
|
+ highlight: this.annotationStore.highlightLink
|
|
|
+ })
|
|
|
+ this.annotationsArray.push(redaction)
|
|
|
}
|
|
|
}
|
|
|
|