fix accidental checkbox addition

pull/493/head
Alex Turchyn 5 months ago committed by Pete Matsyburka
parent a7ed0b86a4
commit 38674a9fc9

@ -1279,7 +1279,7 @@ export default {
area.h = (pageMask.clientWidth / 35 / pageMask.clientWidth) area.h = (pageMask.clientWidth / 35 / pageMask.clientWidth)
} }
}, },
onDraw (area) { onDraw ({ area, isTooSmall }) {
if (this.drawField) { if (this.drawField) {
if (this.drawOption) { if (this.drawOption) {
const areaWithoutOption = this.drawField.areas?.find((a) => !a.option_uuid) const areaWithoutOption = this.drawField.areas?.find((a) => !a.option_uuid)
@ -1374,7 +1374,7 @@ export default {
area.y -= area.h / 2 area.y -= area.h / 2
} }
if (area.w) { if (area.w && (type !== 'checkbox' || this.drawFieldType || !isTooSmall)) {
this.addField(type, area) this.addField(type, area)
this.selectedAreaRef.value = area this.selectedAreaRef.value = area

@ -23,7 +23,7 @@
@drop-field="$emit('drop-field', {...$event, attachment_uuid: document.uuid })" @drop-field="$emit('drop-field', {...$event, attachment_uuid: document.uuid })"
@remove-area="$emit('remove-area', $event)" @remove-area="$emit('remove-area', $event)"
@scroll-to="scrollToArea" @scroll-to="scrollToArea"
@draw="$emit('draw', {...$event, attachment_uuid: document.uuid })" @draw="$emit('draw', { area: {...$event.area, attachment_uuid: document.uuid }, isTooSmall: $event.isTooSmall })"
/> />
</div> </div>
</template> </template>

@ -290,7 +290,12 @@ export default {
area.cell_w = this.newArea.cell_w area.cell_w = this.newArea.cell_w
} }
this.$emit('draw', area) const dx = Math.abs(e.offsetX - this.$refs.mask.clientWidth * this.newArea.initialX)
const dy = Math.abs(e.offsetY - this.$refs.mask.clientHeight * this.newArea.initialY)
const isTooSmall = dx < 8 && dy < 8
this.$emit('draw', { area, isTooSmall })
} }
this.showMask = false this.showMask = false

Loading…
Cancel
Save