Skip to content

Commit

Permalink
Merge pull request #830 from open-data-rescue/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
balen authored Sep 10, 2024
2 parents c56445c + c5c8033 commit 3b9d7a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 29 deletions.
30 changes: 6 additions & 24 deletions app/javascript/utils/boxer-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,10 @@ $.widget("ui.boxer", $.ui.mouse, {

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

const browser = Bowser.getParser(window.navigator.userAgent);
if (browser.getEngineName() == 'Blink') {
// This works for Chrome, problem with zoonm down though
this.startPosition = {
x: (event.pageX / this.zoomLevel) - $(document).scrollLeft() - offset.left,
y: (event.pageY / this.zoomLevel) - $(document).scrollTop() - offset.top
};

} else {
// This works for FF !!
this.startPosition = {
x: (event.pageX - $(document).scrollLeft() - offset.left) / this.zoomLevel,
y: (event.pageY - $(document).scrollTop() - offset.top) / this.zoomLevel
};

}
this.startPosition = {
x: (event.pageX - $(document).scrollLeft() - offset.left) / this.zoomLevel,
y: (event.pageY - $(document).scrollTop() - offset.top) / this.zoomLevel
};

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

let x = 0;
let y = 0;
const browser = Bowser.getParser(window.navigator.userAgent);
if (browser.getEngineName() == 'Blink') {
x = (pageX / this.zoomLevel) - $(document).scrollLeft() - $(target).offset().left;
y = (pageY / this.zoomLevel) - $(document).scrollTop() - $(target).offset().top;
} else {
x = (pageX - $(document).scrollLeft() - $(target).offset().left) / this.zoomLevel;
y = (pageY - $(document).scrollTop() - $(target).offset().top) / this.zoomLevel;
}
x = (pageX - $(document).scrollLeft() - $(target).offset().left) / this.zoomLevel;
y = (pageY - $(document).scrollTop() - $(target).offset().top) / this.zoomLevel;

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

Expand Down
7 changes: 2 additions & 5 deletions app/views/shared/_transcriber_app.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@
e.preventDefault();
if( e.which === 27 || e.keyCode === 27 ){
$box.find(".annotation-actions").show();
$box.resizable("destroy");
pageCanvas.enableScrolling();
$(document).off("keyup.draw.resize");
self.clearMsg();
Expand All @@ -418,10 +417,9 @@
});
$(document).on("click.draw.resize", function(e) {
e.preventDefault();
thing = $(e.target).closest('.annotation-marker').first().attr('id');
var thing = $(e.target).closest('.annotation-marker').first().attr('id');
if (thing != self.el.id) {
$box.find(".annotation-actions").show();
$box.resizable("destroy");
pageCanvas.enableScrolling();
$(document).off("keyup.draw.resize");
self.clearMsg();
Expand Down Expand Up @@ -484,7 +482,7 @@
});
$(document).on("click.draw.move", function(e) {
e.preventDefault();
thing = $(e.target).closest('.annotation-marker').first().attr('id');
var thing = $(e.target).closest('.annotation-marker').first().attr('id');
if (thing != self.el.id) {
$box.find(".annotation-actions").show();
$box.draggable("destroy");
Expand Down Expand Up @@ -1050,7 +1048,6 @@

// TODO
setMsg(('<%= j t('transcriber.messages.draw-annotation-box-instructions-with-field-group').html_safe %>').replace('%{field_group}', fieldGroupName), false, "info");

var annotation = new Annotation(this.options.data);

pageCanvas.disableScrolling();
Expand Down

0 comments on commit 3b9d7a7

Please sign in to comment.