|
@@ -38,7 +38,7 @@ export default class SignatureFields extends Base {
|
|
|
this.endCircle = null
|
|
|
|
|
|
this.ratio = window.devicePixelRatio || 1
|
|
|
- this.isDigital = 0
|
|
|
+ this.isDigital = false
|
|
|
|
|
|
this.onMousedown = this.handleMouseDown.bind(this)
|
|
|
this.onMouseup = this.handleMouseUp.bind(this)
|
|
@@ -77,6 +77,7 @@ export default class SignatureFields extends Base {
|
|
|
annotationContainer.style.left = rect.left + 'px'
|
|
|
annotationContainer.style.width = rect.width + 'px'
|
|
|
annotationContainer.style.height = rect.height + 'px'
|
|
|
+ annotationContainer.style.overflow = 'hidden'
|
|
|
this.annotationContainer = annotationContainer
|
|
|
|
|
|
let shapeElement = createElement(
|
|
@@ -93,6 +94,30 @@ export default class SignatureFields extends Base {
|
|
|
)
|
|
|
this.shapeElement = shapeElement
|
|
|
|
|
|
+ if (!this.annotation.isSigned) {
|
|
|
+ let tagElement = createElement(
|
|
|
+ 'div',
|
|
|
+ {
|
|
|
+ position: 'absolute',
|
|
|
+ left: 0,
|
|
|
+ top: 0,
|
|
|
+ width: '73px',
|
|
|
+ height: '22px',
|
|
|
+ backgroundColor: '#1460F3',
|
|
|
+ fontSize: '12px',
|
|
|
+ fontWeight: '600',
|
|
|
+ color: 'white',
|
|
|
+ lineHeight: '22px',
|
|
|
+ textAlign: 'center',
|
|
|
+ transformOrigin: '0 0',
|
|
|
+ }
|
|
|
+ )
|
|
|
+ tagElement.innerText = 'SIGN HERE'
|
|
|
+ const scale = Math.min(rect.width / 73, rect.height / 22)
|
|
|
+ tagElement.style.transform = scale < 1 ? `scale(${scale})` : ''
|
|
|
+ this.tagElement = tagElement
|
|
|
+ }
|
|
|
+
|
|
|
const signature = this.layer.annotationStore.signatures.find(item => item.signaturePtr === this.annotation.signaturePtr)
|
|
|
if (signature) {
|
|
|
this.isDigital = signature.isDigital
|
|
@@ -100,6 +125,7 @@ export default class SignatureFields extends Base {
|
|
|
await this.getSignatureImage()
|
|
|
|
|
|
this.annotationContainer.append(this.shapeElement)
|
|
|
+ this.annotationContainer.append(this.tagElement)
|
|
|
this.annotationContainer.addEventListener('mousedown', this.handleClick.bind(this))
|
|
|
this.container.append(this.annotationContainer)
|
|
|
|
|
@@ -795,6 +821,8 @@ export default class SignatureFields extends Base {
|
|
|
async updateAp(annotPtr) {
|
|
|
if (this.annotation.annotPtr !== annotPtr && this.annotation.signaturePtr !== annotPtr) return
|
|
|
this.isDigital = false
|
|
|
+ this.annotation.isSigned = 1
|
|
|
+ this.tagElement.remove()
|
|
|
await this.getSignatureImage()
|
|
|
}
|
|
|
}
|