Skip to content

Commit

Permalink
also respect readingDirection in pageView input
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnth committed Jan 10, 2024
1 parent 1b962ec commit 4f5b78b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/webapp/resources/js/viewer/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ function Controller(bookID, accessible_modes, canvasID, regionColors, colors, gl
if(selected && this.getIDType(selected[0]) === ElementType.TEXTLINE){
const id = selected[0];
const parentID = this.textlineRegister[id];
_gui.openTextLineContent(_segmentation[_currentPage].segments[parentID].textlines[id]);
_gui.openTextLineContent(_segmentation[_currentPage].segments[parentID].textlines[id], _segmentation[_currentPage].segments[parentID].readingDirection);
}
_gui.updateZoom();
}
Expand Down Expand Up @@ -2039,10 +2039,10 @@ function Controller(bookID, accessible_modes, canvasID, regionColors, colors, gl
if(!textline.minArea){
_communicator.minAreaRect(textline).done((minArea) => {
textline.minArea = minArea;
_gui.openTextLineContent(textline);
_gui.openTextLineContent(textline, _segmentation[_currentPage].segments[this.textlineRegister[id]].readingDirection);
});
} else {
_gui.openTextLineContent(textline);
_gui.openTextLineContent(textline, _segmentation[_currentPage].segments[this.textlineRegister[id]].readingDirection);
}
}
}
Expand Down
15 changes: 14 additions & 1 deletion src/main/webapp/resources/js/viewer/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,24 @@ function GUI(canvas, viewer, colors, accessible_modes) {
/**
* Open the textline content, ready to edit
*/
this.openTextLineContent = function (textline) {
this.openTextLineContent = function (textline, readingDirection) {
console.log(readingDirection)
this.hideTextline(false);
const $textlinecontent = $("#textline-content");
$textlinecontent.removeClass("hide");

switch(readingDirection){
case "right-to-left":
$textlinecontent.attr("dir", "rtl");
break;
case "left-to-right":
$textlinecontent.attr("dir", "ltr");
break;
default:
$textlinecontent.removeAttr("dir")
break;
}

if(!this.tempTextline || this.tempTextline.id !== textline.id){
this.tempTextline = textline ? textline : this.tempTextline;
this.updateTextLine(textline.id);
Expand Down

0 comments on commit 4f5b78b

Please sign in to comment.