Skip to content

Commit c56445c

Browse files
authored
Merge pull request #828 from open-data-rescue/staging
fixes for box move and resize
2 parents b74ef8e + 46ce701 commit c56445c

File tree

1 file changed

+8
-35
lines changed

1 file changed

+8
-35
lines changed

app/views/shared/_transcriber_app.html.erb

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
// console.debug("****** browser IS", browser.getEngineName());
202202
if (browser.getEngineName() == 'Gecko') {
203203
// If the agent is FF then we need to use the moz-transform
204-
// AND not put in the zoom
204+
// AND not put in the zoom
205205
this.zoomContainer.find(".annotated_page").css({
206206
'-moz-transform' : ('scale(' + zoom + ')'),
207207
'-moz-transform-origin' : 'top left'
@@ -432,18 +432,8 @@
432432
stop : function(e, ui) {
433433
var offset = $box.offset();
434434

435-
let x = 0;
436-
let y = 0;
437-
const browser = Bowser.getParser(window.navigator.userAgent);
438-
if (browser.getEngineName() == 'Blink') {
439-
x = offset.left - $(document).scrollLeft() - $("#target-image").offset().left;
440-
y = offset.top - $(document).scrollTop() - $("#target-image").offset().top;
441-
} else {
442-
x = (offset.left - $(document).scrollLeft() - $("#target-image").offset().left) / toolbarLayout.currentZoom;
443-
y = (offset.top - $(document).scrollTop() - $("#target-image").offset().top) / toolbarLayout.currentZoom;
444-
}
445-
446-
435+
let x = (offset.left - $(document).scrollLeft() - $("#target-image").offset().left) / toolbarLayout.currentZoom;
436+
let y = (offset.top - $(document).scrollTop() - $("#target-image").offset().top) / toolbarLayout.currentZoom;
447437
var width = $box.width();
448438
var height = $box.height();
449439

@@ -505,29 +495,12 @@
505495
}
506496
});
507497
},
508-
start: function( event, ui ) {
509-
const browser = Bowser.getParser(window.navigator.userAgent);
510-
if (browser.getEngineName() == 'Blink') {
511-
var x = $box.position().left; // - ($(document).scrollLeft() + $("#target-image").offset().left);
512-
var y = $box.position().top - ($(document).scrollTop() + $("#target-image").offset().top);
513-
ui.position = { left: x, top: y};
514-
}
515-
},
516498
drag: function( event, ui ) {
517-
var zoom = toolbarLayout.currentZoom; //getComputedStyle(this).zoom;
518-
const browser = Bowser.getParser(window.navigator.userAgent);
519-
if (browser.getEngineName() == 'Blink') {
520-
var x = ui.offset.left - $(document).scrollLeft() - $("#target-image").offset().left; // / zoom; // / zoom;
521-
var y = ui.offset.top - $(document).scrollTop() - $("#target-image").offset().top; // / zoom; // / zoom;
522-
523-
ui.position.left = x;
524-
ui.position.top = y;
525-
} else {
526-
var x = ui.position.left / zoom;
527-
var y = ui.position.top / zoom;
528-
ui.position.left = x;
529-
ui.position.top = y;
530-
}
499+
var zoom = toolbarLayout.currentZoom;
500+
var x = ui.position.left / zoom;
501+
var y = ui.position.top / zoom;
502+
ui.position.left = x;
503+
ui.position.top = y;
531504
},
532505
stop : function(e, ui) {
533506
var zoom = toolbarLayout.currentZoom;

0 commit comments

Comments
 (0)