Merge pull request #4904 from aignatov-bio/ai-sci-7822-fix-dimension-calculation

Fix label template logo dimension calculation [SCI-7822]
This commit is contained in:
aignatov-bio 2023-02-01 11:27:06 +01:00 committed by GitHub
commit e2da83ee6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -35,6 +35,7 @@
name: 'logoInsertModal',
props: {
unit: { type: String, required: true },
density: { type: Number, required: true },
dimension: { type: Array, required: true }
},
data() {
@ -49,8 +50,15 @@
$(this.$refs.modal).on('hidden.bs.modal', () => {
this.$emit('cancel');
});
this.width = this.dimension[0]
this.height = this.dimension[1]
this.width = this.dimension[0] / this.density
this.height = this.dimension[1] / this.density
if (this.unit == 'in') {
this.width = this.width / 25.4
this.height = this.height / 25.4
}
this.width = Math.round(this.width * 100) / 100
this.height = Math.round(this.height * 100) / 100
this.ratio = this.dimension[0] / this.dimension[1]
},
methods: {

View file

@ -65,6 +65,7 @@
</div>
<LogoInsertModal v-if="openLogoModal"
:unit="labelTemplate.attributes.unit"
:density="labelTemplate.attributes.density"
:dimension="logoDimension"
@insert:tag="insertTag"
@cancel="openLogoModal = false"/>
@ -138,7 +139,7 @@
value.key = this.i18n.t(`label_templates.default_columns.${value.key}`)
return value;
});
this.fields = result;
this.$nextTick(() => {
$('[data-toggle="tooltip"]').tooltip();