Skip to content

Commit 3b9d7a7

Browse files
authored
Merge pull request #830 from open-data-rescue/staging
Staging
2 parents c56445c + c5c8033 commit 3b9d7a7

File tree

2 files changed

+8
-29
lines changed

2 files changed

+8
-29
lines changed

app/javascript/utils/boxer-plugin.js

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,10 @@ $.widget("ui.boxer", $.ui.mouse, {
3333

3434
var offset = $(target).offset();
3535

36-
const browser = Bowser.getParser(window.navigator.userAgent);
37-
if (browser.getEngineName() == 'Blink') {
38-
// This works for Chrome, problem with zoonm down though
39-
this.startPosition = {
40-
x: (event.pageX / this.zoomLevel) - $(document).scrollLeft() - offset.left,
41-
y: (event.pageY / this.zoomLevel) - $(document).scrollTop() - offset.top
42-
};
43-
44-
} else {
45-
// This works for FF !!
46-
this.startPosition = {
47-
x: (event.pageX - $(document).scrollLeft() - offset.left) / this.zoomLevel,
48-
y: (event.pageY - $(document).scrollTop() - offset.top) / this.zoomLevel
49-
};
50-
51-
}
36+
this.startPosition = {
37+
x: (event.pageX - $(document).scrollLeft() - offset.left) / this.zoomLevel,
38+
y: (event.pageY - $(document).scrollTop() - offset.top) / this.zoomLevel
39+
};
5240

5341
if (this.options.disabled)
5442
return;
@@ -95,14 +83,8 @@ $.widget("ui.boxer", $.ui.mouse, {
9583

9684
let x = 0;
9785
let y = 0;
98-
const browser = Bowser.getParser(window.navigator.userAgent);
99-
if (browser.getEngineName() == 'Blink') {
100-
x = (pageX / this.zoomLevel) - $(document).scrollLeft() - $(target).offset().left;
101-
y = (pageY / this.zoomLevel) - $(document).scrollTop() - $(target).offset().top;
102-
} else {
103-
x = (pageX - $(document).scrollLeft() - $(target).offset().left) / this.zoomLevel;
104-
y = (pageY - $(document).scrollTop() - $(target).offset().top) / this.zoomLevel;
105-
}
86+
x = (pageX - $(document).scrollLeft() - $(target).offset().left) / this.zoomLevel;
87+
y = (pageY - $(document).scrollTop() - $(target).offset().top) / this.zoomLevel;
10688

10789
var x1 = this.startPosition.x, y1 = this.startPosition.y, x2 = x, y2 = y;
10890

app/views/shared/_transcriber_app.html.erb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@
409409
e.preventDefault();
410410
if( e.which === 27 || e.keyCode === 27 ){
411411
$box.find(".annotation-actions").show();
412-
$box.resizable("destroy");
413412
pageCanvas.enableScrolling();
414413
$(document).off("keyup.draw.resize");
415414
self.clearMsg();
@@ -418,10 +417,9 @@
418417
});
419418
$(document).on("click.draw.resize", function(e) {
420419
e.preventDefault();
421-
thing = $(e.target).closest('.annotation-marker').first().attr('id');
420+
var thing = $(e.target).closest('.annotation-marker').first().attr('id');
422421
if (thing != self.el.id) {
423422
$box.find(".annotation-actions").show();
424-
$box.resizable("destroy");
425423
pageCanvas.enableScrolling();
426424
$(document).off("keyup.draw.resize");
427425
self.clearMsg();
@@ -484,7 +482,7 @@
484482
});
485483
$(document).on("click.draw.move", function(e) {
486484
e.preventDefault();
487-
thing = $(e.target).closest('.annotation-marker').first().attr('id');
485+
var thing = $(e.target).closest('.annotation-marker').first().attr('id');
488486
if (thing != self.el.id) {
489487
$box.find(".annotation-actions").show();
490488
$box.draggable("destroy");
@@ -1050,7 +1048,6 @@
10501048

10511049
// TODO
10521050
setMsg(('<%= j t('transcriber.messages.draw-annotation-box-instructions-with-field-group').html_safe %>').replace('%{field_group}', fieldGroupName), false, "info");
1053-
10541051
var annotation = new Annotation(this.options.data);
10551052

10561053
pageCanvas.disableScrolling();

0 commit comments

Comments
 (0)