Skip to content

Commit

Permalink
Merge pull request #828 from open-data-rescue/staging
Browse files Browse the repository at this point in the history
fixes for box move and resize
  • Loading branch information
balen authored Sep 5, 2024
2 parents b74ef8e + 46ce701 commit c56445c
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions app/views/shared/_transcriber_app.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
// console.debug("****** browser IS", browser.getEngineName());
if (browser.getEngineName() == 'Gecko') {
// If the agent is FF then we need to use the moz-transform
// AND not put in the zoom
// AND not put in the zoom
this.zoomContainer.find(".annotated_page").css({
'-moz-transform' : ('scale(' + zoom + ')'),
'-moz-transform-origin' : 'top left'
Expand Down Expand Up @@ -432,18 +432,8 @@
stop : function(e, ui) {
var offset = $box.offset();

let x = 0;
let y = 0;
const browser = Bowser.getParser(window.navigator.userAgent);
if (browser.getEngineName() == 'Blink') {
x = offset.left - $(document).scrollLeft() - $("#target-image").offset().left;
y = offset.top - $(document).scrollTop() - $("#target-image").offset().top;
} else {
x = (offset.left - $(document).scrollLeft() - $("#target-image").offset().left) / toolbarLayout.currentZoom;
y = (offset.top - $(document).scrollTop() - $("#target-image").offset().top) / toolbarLayout.currentZoom;
}


let x = (offset.left - $(document).scrollLeft() - $("#target-image").offset().left) / toolbarLayout.currentZoom;
let y = (offset.top - $(document).scrollTop() - $("#target-image").offset().top) / toolbarLayout.currentZoom;
var width = $box.width();
var height = $box.height();

Expand Down Expand Up @@ -505,29 +495,12 @@
}
});
},
start: function( event, ui ) {
const browser = Bowser.getParser(window.navigator.userAgent);
if (browser.getEngineName() == 'Blink') {
var x = $box.position().left; // - ($(document).scrollLeft() + $("#target-image").offset().left);
var y = $box.position().top - ($(document).scrollTop() + $("#target-image").offset().top);
ui.position = { left: x, top: y};
}
},
drag: function( event, ui ) {
var zoom = toolbarLayout.currentZoom; //getComputedStyle(this).zoom;
const browser = Bowser.getParser(window.navigator.userAgent);
if (browser.getEngineName() == 'Blink') {
var x = ui.offset.left - $(document).scrollLeft() - $("#target-image").offset().left; // / zoom; // / zoom;
var y = ui.offset.top - $(document).scrollTop() - $("#target-image").offset().top; // / zoom; // / zoom;

ui.position.left = x;
ui.position.top = y;
} else {
var x = ui.position.left / zoom;
var y = ui.position.top / zoom;
ui.position.left = x;
ui.position.top = y;
}
var zoom = toolbarLayout.currentZoom;
var x = ui.position.left / zoom;
var y = ui.position.top / zoom;
ui.position.left = x;
ui.position.top = y;
},
stop : function(e, ui) {
var zoom = toolbarLayout.currentZoom;
Expand Down

0 comments on commit c56445c

Please sign in to comment.