|
@@ -45,18 +45,18 @@ export default class SignatureFields extends Base {
|
|
|
}
|
|
|
|
|
|
async render () {
|
|
|
+ const annotation = this.annotation
|
|
|
this.eventBus._on('setProperty', this.setProperty.bind(this))
|
|
|
this.eventBus._on('updateSignatureFieldAp', this.updateAp.bind(this))
|
|
|
|
|
|
- for (let key in this.annotation) {
|
|
|
+ for (let key in annotation) {
|
|
|
if (key === 'background-color') {
|
|
|
let newName = 'backgroundColor'
|
|
|
- this.annotation[newName] = this.annotation[key]
|
|
|
- delete this.annotation[key]
|
|
|
+ annotation[newName] = annotation[key]
|
|
|
+ delete annotation[key]
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const annotation = this.annotation
|
|
|
|
|
|
const { start, end } = this.getActualRect(
|
|
|
this.viewport,
|
|
@@ -91,7 +91,7 @@ export default class SignatureFields extends Base {
|
|
|
)
|
|
|
this.shapeElement = shapeElement
|
|
|
|
|
|
- if (!this.annotation.isSigned) {
|
|
|
+ if (!annotation.isSigned) {
|
|
|
let tagElement = createElement(
|
|
|
'div',
|
|
|
{
|
|
@@ -115,14 +115,14 @@ export default class SignatureFields extends Base {
|
|
|
this.tagElement = tagElement
|
|
|
}
|
|
|
|
|
|
- const signature = this.layer.annotationStore.signatures.find(item => item.signaturePtr === this.annotation.signaturePtr)
|
|
|
+ const signature = this.layer.annotationStore.signatures.find(item => item.signaturePtr === annotation.signaturePtr)
|
|
|
if (signature) {
|
|
|
this.isDigital = signature.isDigital
|
|
|
}
|
|
|
await this.getSignatureImage()
|
|
|
|
|
|
this.annotationContainer.append(this.shapeElement)
|
|
|
- this.annotationContainer.append(this.tagElement)
|
|
|
+ !annotation.isSigned && this.annotationContainer.append(this.tagElement)
|
|
|
this.annotationContainer.addEventListener('mousedown', this.handleClick.bind(this))
|
|
|
this.container.append(this.annotationContainer)
|
|
|
|
|
@@ -447,7 +447,12 @@ export default class SignatureFields extends Base {
|
|
|
event.stopPropagation()
|
|
|
}
|
|
|
const operatorId = event.target.getAttribute('data-id')
|
|
|
-
|
|
|
+
|
|
|
+ const documentViewer = this.layer.documentViewer
|
|
|
+ const scrollElement = documentViewer.getScrollViewElement()
|
|
|
+ this.scrollTop = scrollElement.scrollTop
|
|
|
+ this.scrollLeft = scrollElement.scrollLeft
|
|
|
+
|
|
|
const { pageX, pageY } = getClickPoint(event)
|
|
|
this.startState = {
|
|
|
operator: operatorId,
|
|
@@ -467,7 +472,15 @@ export default class SignatureFields extends Base {
|
|
|
document.querySelector('.document-container').addEventListener('scroll', event => event.preventDefault())
|
|
|
}
|
|
|
this.moving = true
|
|
|
- const { pageX, pageY } = getClickPoint(event)
|
|
|
+ let { pageX, pageY } = getClickPoint(event)
|
|
|
+
|
|
|
+ const documentViewer = this.layer.documentViewer
|
|
|
+ const scrollElement = documentViewer.getScrollViewElement()
|
|
|
+ const scrollTop = scrollElement.scrollTop
|
|
|
+ const scrollLeft = scrollElement.scrollLeft
|
|
|
+ pageX = pageX + scrollLeft - this.scrollLeft
|
|
|
+ pageY = pageY + scrollTop - this.scrollTop
|
|
|
+
|
|
|
const start = this.start
|
|
|
const end = this.end
|
|
|
const startState = this.startState
|
|
@@ -629,6 +642,7 @@ export default class SignatureFields extends Base {
|
|
|
const annotationData = {
|
|
|
type: 'delete',
|
|
|
annotation: {
|
|
|
+ type: annotation.type,
|
|
|
operate: "del-annot",
|
|
|
name: this.annotation.name,
|
|
|
pageIndex: this.page
|
|
@@ -660,7 +674,9 @@ export default class SignatureFields extends Base {
|
|
|
document.removeEventListener('mouseup', this.onMouseup)
|
|
|
document.removeEventListener('touchmove', this.onMousemove)
|
|
|
document.removeEventListener('touchend', this.onMouseup)
|
|
|
-
|
|
|
+ this.scrollLeft = 0
|
|
|
+ this.scrollTop = 0
|
|
|
+
|
|
|
const annotation = this.annotation
|
|
|
const { start, end } = this.getInitialPoint()
|
|
|
|
|
@@ -677,6 +693,7 @@ export default class SignatureFields extends Base {
|
|
|
const annotationData = {
|
|
|
type: 'delete',
|
|
|
annotation: {
|
|
|
+ type: annotation.type,
|
|
|
operate: "del-annot",
|
|
|
name: annotation.name,
|
|
|
pageIndex: annotation.pageIndex,
|
|
@@ -704,6 +721,7 @@ export default class SignatureFields extends Base {
|
|
|
type: 'modify',
|
|
|
annotation: {
|
|
|
operate: "mod-form",
|
|
|
+ type: annotation.type,
|
|
|
name: annotation.name,
|
|
|
pageIndex: this.page,
|
|
|
pagePtr: annotation.pagePtr,
|
|
@@ -781,6 +799,7 @@ export default class SignatureFields extends Base {
|
|
|
if (updatePropsNum > 0) {
|
|
|
const annotationData = {
|
|
|
operate: "mod-form",
|
|
|
+ type: annotation.type,
|
|
|
name: annotation.name,
|
|
|
pageIndex: this.page,
|
|
|
pagePtr: annotation.pagePtr,
|
|
@@ -814,6 +833,7 @@ export default class SignatureFields extends Base {
|
|
|
if (updatePropsNum > 0) {
|
|
|
const annotationData = {
|
|
|
operate: "mod-form",
|
|
|
+ type: annotation.type,
|
|
|
name: annotation.name,
|
|
|
pageIndex: this.page,
|
|
|
pagePtr: annotation.pagePtr,
|