do not add checkbox on click

pull/133/head
Alex Turchyn 2 years ago
parent 54592e7264
commit 9bcf5aacc0

@ -391,6 +391,10 @@ export default {
this.drawField.areas.push(area) this.drawField.areas.push(area)
this.drawField = null this.drawField = null
this.selectedAreaRef.value = area
this.save()
} else { } else {
const documentRef = this.documentRefs.find((e) => e.document.uuid === area.attachment_uuid) const documentRef = this.documentRefs.find((e) => e.document.uuid === area.attachment_uuid)
const pageMask = documentRef.pageRefs[area.page].$refs.mask const pageMask = documentRef.pageRefs[area.page].$refs.mask
@ -401,33 +405,37 @@ export default {
const previousField = [...this.template.fields].reverse().find((f) => f.type === type) const previousField = [...this.template.fields].reverse().find((f) => f.type === type)
const previousArea = previousField?.areas?.[previousField.areas.length - 1] const previousArea = previousField?.areas?.[previousField.areas.length - 1]
const areaW = previousArea?.w || (30 / pageMask.clientWidth) if (previousArea || area.w) {
const areaH = previousArea?.h || (30 / pageMask.clientHeight) const areaW = previousArea?.w || (30 / pageMask.clientWidth)
const areaH = previousArea?.h || (30 / pageMask.clientHeight)
if ((pageMask.clientWidth * area.w) < 5) { if ((pageMask.clientWidth * area.w) < 5) {
area.x = area.x - (areaW / 2) area.x = area.x - (areaW / 2)
area.y = area.y - (areaH / 2) area.y = area.y - (areaH / 2)
} }
area.w = areaW area.w = areaW
area.h = areaH area.h = areaH
}
} }
const field = { if (area.w) {
name: '', const field = {
uuid: v4(), name: '',
required: type !== 'checkbox', uuid: v4(),
type, required: type !== 'checkbox',
submitter_uuid: this.selectedSubmitter.uuid, type,
areas: [area] submitter_uuid: this.selectedSubmitter.uuid,
} areas: [area]
}
this.template.fields.push(field) this.template.fields.push(field)
}
this.selectedAreaRef.value = area this.selectedAreaRef.value = area
this.save() this.save()
}
}
}, },
onDropfield (area) { onDropfield (area) {
const field = { const field = {

Loading…
Cancel
Save