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