Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature Widget Image Changing without user input #25

Open
eprager412 opened this issue Dec 1, 2023 · 10 comments
Open

Signature Widget Image Changing without user input #25

eprager412 opened this issue Dec 1, 2023 · 10 comments
Assignees
Milestone

Comments

@eprager412
Copy link

eprager412 commented Dec 1, 2023

Describe the bug
The signature is provided and saved. When viewed a second time the image is zoomed in.

To Reproduce
Steps to reproduce:

  1. Open for in mode /single/full/participant/ on a phone device.
    simplesignature.txt

  2. Put sketch a value, or add a ,png in the '####Signature" item

  3. Click the Subit button on the fomr

  4. Open the record created from above in mode /edit/fs/dn/c/i/ . Open on a desktop/laptop device.

  5. View the signature item on the screen and/or download the signature item file

Expected behavior
The saved png looks the same as the view seen when initial signature was provided.

Actual Behavior:
The image will be zoomed in closer than the original value shown when you sketched in step one. Most of the original canvas area will be missing.

Screenshots
Note the signature shown in the screenshots was a full name on the phone (not shown here) and now is a zoomed in version of the left hand corner of the original.
2023-11-30_14-04-03 (1)

2023-11-30_14-03-53 (1)

Browser and OS (please complete the following information):

  • Browser:chrome
@pbowen-oc pbowen-oc added this to the Next milestone Dec 1, 2023
@pbowen-oc pbowen-oc changed the title Signature Widget Image Changing Signature Widget Image Changing without user input Dec 1, 2023
@MartijnR
Copy link
Member

MartijnR commented Dec 6, 2023

I'm assuming this is an enketo-core bug.

  • send calendar invite to Krikor
  • check if image gets submitted correctly in enketo-express-oc - yes
  • check if image gets loaded correctly in enketo-express-oc - yes
  • once reproduced, check if it also occurs with the OC theme
  • is original submission correct (or zoomed in)? - cut off, see below

@MartijnR
Copy link
Member

MartijnR commented Dec 12, 2023

empty form: http://localhost:8005/single/full/participant/7e1bda1d8c268cb4426c3a4ace63a621?ecid=1

curl --user enketorules: -d \
    "server_url=http://localhost:3000&form_id=simplesignature&ecid=1&instance_id=a&instance=\
    <data xmlns:OpenClinica=\"http://openclinica.com/odm\" xmlns:enk=\"http://enketo.org/xforms\" xmlns:jr=\"http://openrosa.org/javarosa\" xmlns:oc=\"http://openclinica.org/xforms\" xmlns:orx=\"http://openrosa.org/xforms\" id=\"simplesignature\" version=\"BTest2\">\
    <group_zt8fu31_002>\
        <Patient_Signature_002_001>signature-14_12_44.png</Patient_Signature_002_001>\
    </group_zt8fu31_002>\
    <group_ar1jd35>\
        <note/>\
    </group_ar1jd35>\
    <meta>\
        <instanceID>uuid:376611b3-1506-4c11-b21a-3a246f6574f2</instanceID>\
    </meta>\
    </data>\
    &instance_attachments[signature-14_12_44.png]=http://localhost:3000/form/simplesignature/media/signature-14_12_44.png" \
http://localhost:8005/oc/api/v1/instance/edit/c

@MartijnR
Copy link
Member

MartijnR commented Dec 12, 2023

Cannot reproduce. Next step would be to check on the OC side if the first submitted image is stored unchanged (downloading the file directly, not within Enketo).

  • retry on phone

@MartijnR
Copy link
Member

I also couldn't reproduce this when creating the first signature file on a mobile phone (and then edited on a desktop), so back to y'all, to perhaps:

  • check what is stored on the OC side as discussed @kkrumlian
  • post an actual signature image file here that you can reproduce the issue with

@pbowen-oc
Copy link

@MartijnR - I tested this on my iPhone (14 Pro iOS 17.2.1) in Safari. It looks like the original image is being cropped when it is originally saved.
As originally drawn on the canvas:
IMG_8658

After exiting edit in the canvas:
IMG_8659

As saved on our server before reopening the form (cropped to top left):
AS6610-1703212616995-signature-21_36_47

Reopening on laptop form shows cropped image:
Screenshot 2023-12-21 213819

I reproduced this multiple times on my phone. Note that I was accessing the form in portrait orientation and using view /single/full/participant/.

@pbowen-oc
Copy link

@martijn - Note that I followed up on the above and opened the form in our more typical /single/fs/c/i/ view from my iPhone. The responsiveness is completely different and the form is much harder to use (perhaps because the page that the form was opened from was not responsive?), but I did not see the issue occur.

Drawing on canvas:
IMG_8660

After leaving canvas edit:
IMG_8661

File saved on our server (note that multiple incremental updates were saved prior to this):
SS_061-1703213670830-signature-21_54_30

@pbowen-oc
Copy link

In the first case (with the cropping), the raw file saved is 963 x 432. In the second case (no issue), the raw file saved is 2748 x 1236.

@MartijnR
Copy link
Member

MartijnR commented Jan 2, 2024

Thanks! Looks like this issue may not occur in fieldsubmission views which extract and submit an image as soon as its created (submission per field).

The Participate views wait until the whole form is complete and then submit everything in one submission.

If that's the case, it makes it sounds very much like some other issues that occur if the form is in Pages mode and the signature field is not on the last page. If that's the case you would not be able to reproduce it when removing the 'pages' style in the form definition.

  • I'll quickly try to reproduce and test this theory. - Yes, I can reproduce and it is related to pages mode and when the field is not on the last page. It can be reproduced on a desktop as well by making the window small enough (or simulating mobile in devtools).
  • try to reproduce with enketo/enketo
  • file bug report for enketo/enketo: new drawing on low-resolution screen is cut off in submission (pages mode, non-last page) enketo/enketo#1291
  • wait or fix in enketo/enketo
  • wait for enketo-core release with fix
  • try to merge/update in this repo

@kkrumlian
Copy link

kkrumlian commented Jan 8, 2024

@MartijnR which version do we need to go back to: https://github.com/enketo/enketo-core/commits/master/src/widget/draw ?

  • ResizableSignaturePad.js is this the actual file that's impacting our functionality?

@MartijnR
Copy link
Member

MartijnR commented Jan 9, 2024

This one: enketo/enketo-core@561d832 (December 14th, 2022)

That file was introduced in a later commit, so it shouldn't exist in the older version. Best to copy all the files in the widget folder.

You may have to revert a depency (or several) in package.json as well, in particular signaturepad.

@MartijnR MartijnR transferred this issue from OpenClinica/enketo-express-oc May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants