Skip to content
Snippets Groups Projects
Commit 7d737b82 authored by srosse's avatar srosse
Browse files

OO-2518: batch grading of drawing are shown on a the first background image

parent 2adf325c
No related branches found
No related tags found
No related merge requests found
...@@ -49,21 +49,21 @@ ...@@ -49,21 +49,21 @@
#set($widthWithBorder = $r.parseInt(${interaction.object.width}) + 2) #set($widthWithBorder = $r.parseInt(${interaction.object.width}) + 2)
#set($heightWithBorder = $r.parseInt(${interaction.object.height}) + 2) #set($heightWithBorder = $r.parseInt(${interaction.object.height}) + 2)
<div id="sketch" style="border:1px solid black; width:${widthWithBorder}px; height:${heightWithBorder}px;" draggable="false" ondragstart="return false;"> <div id="sketch_${responseIdentifier}" class="sketch" style="border:1px solid black; width:${widthWithBorder}px; height:${heightWithBorder}px;" draggable="false" ondragstart="return false;">
<canvas id="paint" width="${interaction.object.width}" height="${interaction.object.height}" style="background:url('${r.convertLinkFull($interaction.object.data)}')" draggable="false" ondragstart="return false;"></canvas> <canvas id="paint_${responseIdentifier}" width="${interaction.object.width}" height="${interaction.object.height}" style="background:url('${r.convertLinkFull($interaction.object.data)}')" draggable="false" ondragstart="return false;"></canvas>
</div> </div>
<script type='text/javascript'> <script type='text/javascript'>
jQuery(function() { jQuery(function() {
var itemOpen = $isItemSessionOpen; var itemOpen = $isItemSessionOpen;
if(itemOpen) { if(itemOpen) {
jQuery('#sketch').paint({ jQuery('#sketch_${responseIdentifier}').paint({
inputHolderId: 'op_${responseIdentifier}', inputHolderId: 'op_${responseIdentifier}',
formDispatchFieldId: '$r.formDispatchFieldId' formDispatchFieldId: '$r.formDispatchFieldId'
}); });
var val = jQuery('#op_${responseIdentifier}').val(); var val = jQuery('#op_${responseIdentifier}').val();
if(!(typeof val == "undefined") && val.length > 0) { if(!(typeof val == "undefined") && val.length > 0) {
var canvas = document.getElementById("paint"); var canvas = document.getElementById("paint_${responseIdentifier}");
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d");
var image = new Image(); var image = new Image();
image.onload = function() { image.onload = function() {
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
image.src = val; image.src = val;
} }
} else { } else {
var canvas = document.getElementById("paint"); var canvas = document.getElementById("paint_${responseIdentifier}");
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d");
var image = new Image(); var image = new Image();
image.onload = function() { image.onload = function() {
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
var canvas = this.canvas; var canvas = this.canvas;
var ctx = this.canvas.getContext('2d'); var ctx = this.canvas.getContext('2d');
var sketch = document.querySelector('#sketch'); var sketchId = jQuery(this.divPanel).attr('id');
var sketch = document.querySelector('#' + sketchId);
var sketch_style = getComputedStyle(sketch); var sketch_style = getComputedStyle(sketch);
var canvas_small = document.getElementById('brush_size'); var canvas_small = document.getElementById('brush_size');
......
...@@ -27,7 +27,7 @@ ul.sessionControl { ...@@ -27,7 +27,7 @@ ul.sessionControl {
} }
/* Drawing */ /* Drawing */
#sketch { .sketch {
position: relative; position: relative;
user-drag: none; user-drag: none;
user-select: none; user-select: none;
......
This diff is collapsed.
source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment