Merge branch 'master' into fix-highlight-word

This commit is contained in:
Alexander Bigga 2021-10-19 21:30:24 +02:00 committed by GitHub
commit 3ea862b27b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 10 deletions

View File

@ -173,7 +173,7 @@ dlfAltoParser.prototype.parseFeatures = function(document) {
};
pageFeatures.push(feature);
};
}
return pageFeatures;
};

View File

@ -104,7 +104,7 @@ function DlfAnnotationControl(map, image, annotationContainers) {
// hover in case of dragging
if (event['dragging']) {
return;
};
}
var hoverSourceAnnotation = this.layers_.hoverAnnotation.getSource(),
hoverSourceAnnotationList = this.layers_.hoverAnnotationList.getSource(),

View File

@ -118,7 +118,7 @@ DlfIiifAnnotationParser.prototype.parseAnnotationList = function(annotationList,
for (var i = 0; i < listCoordinatesWithoutScale[0].length; i++) {
coordinatesRescale.push([(scale * listCoordinatesWithoutScale[0][i][0]),
0 - (scale * listCoordinatesWithoutScale[0][i][1])]);
};
}
var listGeometry = new ol.geom.Polygon([coordinatesRescale]),
listFeature = new ol.Feature(listGeometry);

View File

@ -157,7 +157,7 @@ dlfViewerImageManipulationControl = function(options) {
value = FILTERS_DEFAULT_[String(type)];
$(sliderEl).slider('value', value);
};
}
}, this)
};
};

View File

@ -164,7 +164,7 @@ dlfViewer.prototype.addCustomControls = function() {
// Adds fulltext behavior and download only if there is fulltext available and no double page
// behavior is active
if (this.fulltexts[0] !== undefined && this.fulltexts[0].length !== 0 && this.fulltexts[0].url !== '' && this.images.length === 1) {
if (dlfUtils.isFulltextDescriptor(this.fulltexts[0]) && this.images.length === 1) {
fulltextControl = new dlfViewerFullTextControl(this.map, this.images[0], this.fulltexts[0].url);
fulltextDownloadControl = new dlfViewerFullTextDownloadControl(this.map, this.images[0], this.fulltexts[0].url);
} else {
@ -331,7 +331,7 @@ dlfViewer.prototype.displayHighlightWord = function(highlightWords = null) {
}
}
if (this.fulltexts[0] !== undefined && this.fulltexts[0].url !== '' && this.images.length > 0) {
if (dlfUtils.isFulltextDescriptor(this.fulltexts[0]) && this.images.length > 0) {
var values = [],
fulltextData = dlfFullTextUtils.fetchFullTextDataFromServer(this.fulltexts[0].url, this.images[0]),
fulltextDataImageTwo = undefined;
@ -341,7 +341,7 @@ dlfViewer.prototype.displayHighlightWord = function(highlightWords = null) {
}
// check if there is another image / fulltext to look for
if (this.images.length === 2 & this.fulltexts[1] !== undefined && this.fulltexts[1].url !== '') {
if (this.images.length === 2 && dlfUtils.isFulltextDescriptor(this.fulltexts[1])) {
var image = $.extend({}, this.images[1]);
image.width = image.width + this.images[0].width;
fulltextDataImageTwo = dlfFullTextUtils.fetchFullTextDataFromServer(this.fulltexts[1].url, this.images[1], this.images[0].width);
@ -355,7 +355,7 @@ dlfViewer.prototype.displayHighlightWord = function(highlightWords = null) {
for (var i = 0; i < features.length; i++) {
this.highlightLayer.getSource().addFeatures([features[i]]);
}
};
}
}, this));
};
};

View File

@ -19,7 +19,7 @@ function nextResultPage() {
var newStart = parseInt(currentStart) + 20;
$("#tx-dlf-search-in-document-form input[id='tx-dlf-search-in-document-start']").val(newStart);
$('#tx-dlf-search-in-document-form').submit();
};
}
/**
* This function decreases the start parameter of the search form and submits
@ -32,7 +32,7 @@ function previousResultPage() {
var newStart = (parseInt(currentStart) > 20) ? (parseInt(currentStart) - 20) : 0;
$("#tx-dlf-search-in-document-form input[id='tx-dlf-search-in-document-start']").val(newStart);
$('#tx-dlf-search-in-document-form').submit();
};
}
/**
* This function resets the start parameter on new queries.

View File

@ -755,6 +755,22 @@ dlfUtils.isCorsEnabled = function (imageObjs) {
return response;
};
/**
* Checks if {@link obj} is a valid object describing the location of a
* fulltext (@see PageView::getFulltext in PageView.php).
*
* @param {any} obj The object to test.
* @return {boolean}
*/
dlfUtils.isFulltextDescriptor = function (obj) {
return (
typeof obj === 'object'
&& obj !== null
&& 'url' in obj
&& obj.url !== ''
);
};
/**
* Functions checks if WebGL is enabled in the browser
* @return {boolean}