refactor(annotation.js): split to regions
This commit is contained in:
parent
841cc4fd8d
commit
a1f4898c35
@ -6,7 +6,7 @@ async function createAnnotations(document) {
|
||||
const annotParams = await getAnnotationParams(element.left, element.top);
|
||||
const page = element.page - 1
|
||||
|
||||
//background
|
||||
//#region background
|
||||
if(annotParams.background){
|
||||
let background = annotParams.background;
|
||||
const id_background = PSPDFKit.generateInstantId();
|
||||
@ -33,8 +33,9 @@ async function createAnnotations(document) {
|
||||
signatures.push(annotation_background)
|
||||
signatures.push(formFieldBackground)
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//signatures
|
||||
//#region signatures
|
||||
const id = PSPDFKit.generateInstantId()
|
||||
const annotation = new PSPDFKit.Annotations.WidgetAnnotation({
|
||||
id: id,
|
||||
@ -49,8 +50,9 @@ async function createAnnotations(document) {
|
||||
name: id,
|
||||
annotationIds: PSPDFKit.Immutable.List([annotation.id]),
|
||||
})
|
||||
//#endregion
|
||||
|
||||
//position
|
||||
//#region position
|
||||
const id_position = PSPDFKit.generateInstantId()
|
||||
const annotation_position = new PSPDFKit.Annotations.WidgetAnnotation({
|
||||
id: id_position,
|
||||
@ -68,8 +70,9 @@ async function createAnnotations(document) {
|
||||
value: "",
|
||||
readOnly: false
|
||||
})
|
||||
//#endregion
|
||||
|
||||
//city
|
||||
//#region city
|
||||
const id_city = PSPDFKit.generateInstantId()
|
||||
const annotation_city = new PSPDFKit.Annotations.WidgetAnnotation({
|
||||
id: id_city,
|
||||
@ -87,8 +90,9 @@ async function createAnnotations(document) {
|
||||
value: "",
|
||||
readOnly: false
|
||||
})
|
||||
//#endregion
|
||||
|
||||
//date
|
||||
//#region date
|
||||
const id_date = PSPDFKit.generateInstantId()
|
||||
const annotation_date = new PSPDFKit.Annotations.WidgetAnnotation({
|
||||
id: id_date,
|
||||
@ -110,16 +114,13 @@ async function createAnnotations(document) {
|
||||
value: detailedCurrentDate(),
|
||||
readOnly: true
|
||||
})
|
||||
//#endregion
|
||||
|
||||
this.markFieldAsRequired(formFieldCity);
|
||||
|
||||
this.markFieldAsCity(formFieldCity);
|
||||
|
||||
/**
|
||||
* Date, post code and place label part
|
||||
*/
|
||||
|
||||
//date label
|
||||
//#region date label
|
||||
const id_date_label = PSPDFKit.generateInstantId()
|
||||
const annotation_date_label = new PSPDFKit.Annotations.WidgetAnnotation({
|
||||
id: id_date_label,
|
||||
@ -140,8 +141,9 @@ async function createAnnotations(document) {
|
||||
value: "Date",
|
||||
readOnly: true
|
||||
})
|
||||
//#endregion
|
||||
|
||||
//city label
|
||||
//#region city label
|
||||
const id_city_label = PSPDFKit.generateInstantId()
|
||||
const annotation_city_label = new PSPDFKit.Annotations.WidgetAnnotation({
|
||||
id: id_city_label,
|
||||
@ -162,8 +164,9 @@ async function createAnnotations(document) {
|
||||
readOnly: true,
|
||||
color: PSPDFKit.Color.BLACK
|
||||
})
|
||||
//#endregion
|
||||
|
||||
//position label
|
||||
//#region position label
|
||||
const id_position_label = PSPDFKit.generateInstantId()
|
||||
const annotation_position_label = new PSPDFKit.Annotations.WidgetAnnotation({
|
||||
id: id_position_label,
|
||||
@ -183,6 +186,7 @@ async function createAnnotations(document) {
|
||||
value: "Position",
|
||||
readOnly: true
|
||||
})
|
||||
//#endregion
|
||||
|
||||
signatures.push(annotation)
|
||||
signatures.push(formField)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user