Skip to content

Commit

Permalink
Make redaction work in Firefox
Browse files Browse the repository at this point in the history
Closes okfde#46
  • Loading branch information
stefanw committed Apr 23, 2013
1 parent c32ff60 commit bcf6956
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions froide/foirequest/templates/foirequest/redact.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,31 @@ <h3>{% trans "How to redact" %}</h3>
var isDown = false;
canvas.addEventListener('mousedown', function annotationImageOver(e) {
isDown = true;
redactions.push([e.offsetX, e.offsetY, 0, 0]);
var x = e.offsetX == undefined ? e.layerX : e.offsetX;
var y = e.offsetY == undefined ? e.layerY : e.offsetY;
redactions.push([x, y, 0, 0]);
drawRedactions();
}, false);
canvas.addEventListener('mousemove', function annotationImageOver(e) {
if (!isDown) {
return;
}
var r = redactions[redactions.length - 1];
r[2] = e.offsetX - r[0];
r[3] = e.offsetY - r[1];
var x = e.offsetX == undefined ? e.layerX : e.offsetX;
var y = e.offsetY == undefined ? e.layerY : e.offsetY;
r[2] = x - r[0];
r[3] = y - r[1];
drawRedactions();
}, false);
canvas.addEventListener('mouseup', function annotationImageOver(e) {
if (!isDown) {
return;
}
var r = redactions[redactions.length - 1];
r[2] = e.offsetX - r[0];
r[3] = e.offsetY - r[1];
var x = e.offsetX == undefined ? e.layerX : e.offsetX;
var y = e.offsetY == undefined ? e.layerY : e.offsetY;
r[2] = x - r[0];
r[3] = y - r[1];
isDown = false;
drawRedactions();
}, false);
Expand Down

0 comments on commit bcf6956

Please sign in to comment.