Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-80473

Invalid placement of drag-and-drop items when printing with responsively scaled background images (qtype_ddmarker, qtype_ddimageortext)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1.7, 4.1.8, 4.2.4, 4.3
    • Questions
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE

      Summary

      When printing drag-and-drop questions, the drop zones and items are not correctly resized if the background image is wider than the question container, hence is scaled down. We encountered this problem while archiving quiz attempts as PDF documents.

      This affects both qtype_ddmarker and qtype_ddimageortext.

      I tested this behavior on 4.1, 4.2, and 4.3. However, it is likely to affect older versions as well. This problem was discovered by and hence affects multiple universities.

      Expected Behavior

      Question background image, drop zones and drop items are scaled correctly to fit the printed document. Drop zones and drop items are positioned and scaled correctly, based on the actual height and width of the resized background image.

      See attachments:

      • qtype_ddmarker_expected.png
      • qtype_ddimageortext_expected.png

      Actual Behavior

      The question background image is resized correctly and fits the question container. Drop zones and drop items, however, are misplaced to positions based on the natural dimensions of the background image instead of the actual, resized height and width.

      See attachments:

      • qtype_ddmarker_actual.png
      • qtype_ddimageortext_actual.png
      • Testquiz_Attempt_review_DIN_A0.pdf

      Additional Notes

      The problem vanishes when using absurdly wide paper sizes (e.g., DIN A0). Attached you can find the above included attempt report printed to DIN A0 as Testquiz_Attempt_review_DIN_A0.pdf

      Steps to reproduce

      A Moodle backup of a full test quiz to reproduce this issue is attached as example-quiz.mbz!

      1. Log in as teacher or admin
      2. Create a test course
      3. Create a test quiz inside the course
      4. Add new questions of the following types: "Drag and drop markers", "Drag and drop onto image"
        1. For each question, use a background image that is at least 2000 px wide, forcing it to be resized by the responsive CSS to fit into the question container.
      5. Start an attempt, assign drag and drop items within both questions and submit the attempt
      6. Open the attempt review page
      7. Print the attempt report as PDF using DIN A4 as paper format
        1. Note: The bug is already visible inside the print preview! 

      Related Issues

       

      Thanks!

        1. example-quiz.mbz
          545 kB
        2. page_content_is_snapshotted_when_printing.gif
          page_content_is_snapshotted_when_printing.gif
          2.34 MB
        3. qtype_ddimageortext_actual.png
          qtype_ddimageortext_actual.png
          215 kB
        4. qtype_ddimageortext_expected.png
          qtype_ddimageortext_expected.png
          137 kB
        5. qtype_ddmarker_actual.png
          qtype_ddmarker_actual.png
          220 kB
        6. qtype_ddmarker_expected.png
          qtype_ddmarker_expected.png
          153 kB
        7. Testquiz_Attempt_review_DIN_A0.pdf
          1.32 MB
        8. Testquiz_Attempt_review_DIN_A4.pdf
          1.32 MB

            Unassigned Unassigned
            ngandrass Niels Gandraß
            Votes:
            8 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.