Merge branch '317-add-zone-bug-with-zoom' into 'master'

Resolve "Lorsqu'on place manuellement une zone de signature avec le zoom actif, la zone n'est pas placée correctement sur la page"

Closes #317

See merge request Chill-Projet/chill-bundles!757
This commit is contained in:
2024-12-05 15:49:38 +00:00

View File

@@ -96,8 +96,15 @@
> >
{{ $t("cancel") }} {{ $t("cancel") }}
</button> </button>
<button v-if="userSignatureZone === null" <button
:class="{ btn: true, 'btn-sm': true, 'btn-create': canvasEvent !== 'add', 'btn-chill-green': canvasEvent === 'add', active: canvasEvent === 'add' }" v-if="userSignatureZone === null"
:class="{
btn: true,
'btn-sm': true,
'btn-create': canvasEvent !== 'add',
'btn-chill-green': canvasEvent === 'add',
active: canvasEvent === 'add',
}"
@click="toggleAddZone()" @click="toggleAddZone()"
:title="$t('add_sign_zone')" :title="$t('add_sign_zone')"
> >
@@ -200,8 +207,15 @@
> >
{{ $t("cancel") }} {{ $t("cancel") }}
</button> </button>
<button v-if="userSignatureZone === null" <button
:class="{ btn: true, 'btn-sm': true, 'btn-create': canvasEvent !== 'add', 'btn-chill-green': canvasEvent === 'add', active: canvasEvent === 'add' }" v-if="userSignatureZone === null"
:class="{
btn: true,
'btn-sm': true,
'btn-create': canvasEvent !== 'add',
'btn-chill-green': canvasEvent === 'add',
active: canvasEvent === 'add',
}"
@click="toggleAddZone()" @click="toggleAddZone()"
:title="$t('add_sign_zone')" :title="$t('add_sign_zone')"
> >
@@ -218,7 +232,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-12 col-md-12 col-lg-9 m-auto my-5 text-center" :class="{onAddZone: canvasEvent === 'add'}"> <div
class="col-xs-12 col-md-12 col-lg-9 m-auto my-5 text-center"
:class="{ onAddZone: canvasEvent === 'add' }"
>
<canvas class="m-auto" id="canvas"></canvas> <canvas class="m-auto" id="canvas"></canvas>
</div> </div>
@@ -648,11 +665,11 @@ const addZoneEvent = async (e: PointerEvent, canvas: HTMLCanvasElement) => {
scaleXToCanvas(x, canvas.width, PDFPageWidth) - scaleXToCanvas(x, canvas.width, PDFPageWidth) -
scaleXToCanvas(BOX_WIDTH / 2, canvas.width, PDFPageWidth), scaleXToCanvas(BOX_WIDTH / 2, canvas.width, PDFPageWidth),
y: y:
PDFPageHeight - PDFPageHeight * zoom.value -
scaleYToCanvas(y, canvas.height, PDFPageHeight) + scaleYToCanvas(y, canvas.height, PDFPageHeight) +
scaleYToCanvas(BOX_HEIGHT / 2, canvas.height, PDFPageHeight), scaleYToCanvas(BOX_HEIGHT / 2, canvas.height, PDFPageHeight),
width: BOX_WIDTH, width: BOX_WIDTH * zoom.value,
height: BOX_HEIGHT, height: BOX_HEIGHT * zoom.value,
PDFPage: { PDFPage: {
index: page.value - 1, index: page.value - 1,
width: PDFPageWidth, width: PDFPageWidth,