Use modifiers card, resize thumbs

This commit is contained in:
JeLuF
2023-08-06 21:47:39 +02:00
parent 7497870455
commit b5e3711038
4 changed files with 68 additions and 24 deletions

View File

@ -1097,6 +1097,14 @@ async function deleteKeys(keyToDelete) {
}
}
/**
* @param {String} Data URL of the image
* @param {Integer} Top left X-coordinate of the crop area
* @param {Integer} Top left Y-coordinate of the crop area
* @param {Integer} Width of the crop area
* @param {Integer} Height of the crop area
* @return {String}
*/
function cropImageDataUrl(dataUrl, x, y, width, height) {
return new Promise((resolve, reject) => {
const image = new Image()
@ -1120,6 +1128,16 @@ function cropImageDataUrl(dataUrl, x, y, width, height) {
})
}
/**
* @param {String} HTML representing a single element
* @return {Element}
*/
function htmlToElement(html) {
var template = document.createElement('template');
html = html.trim(); // Never return a text node of whitespace as the result
template.innerHTML = html;
return template.content.firstChild;
}
function modalDialogCloseOnBackdropClick(dialog) {
dialog.addEventListener('mousedown', function (event) {