Function getRelativeRetinaSize now decides which size to show on retina display.

This commit is contained in:
mateuswetah 2022-06-15 10:09:13 -03:00
parent 1b2b79ec23
commit 08f1d7361c
2 changed files with 37 additions and 10242 deletions

10264
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ export const ThumbnailHelperFunctions = () => {
},
getSrcSet(thumbnail, tainacanSize, documentType) {
const defaultSrc = this.getSrc(thumbnail, tainacanSize, documentType);
const retinaSrc = (thumbnail && thumbnail['full']) ? thumbnail['full'][0] : this.getEmptyThumbnailPlaceholder(documentType, 'full');
const retinaSrc = this.getSrc(thumbnail, this.getRelativeRetinaSize(tainacanSize), documentType);
return defaultSrc + ' 1x, ' + retinaSrc + ' 2x';
},
getWidth(thumbnail, tainacanSize, fallbackSizeValue) {
@ -92,7 +92,7 @@ export const ThumbnailHelperFunctions = () => {
getWordpressFallbackSize(tainacanSize) {
switch(tainacanSize) {
case 'tainacan-medium-full':
return 'medium_large';
return 'medium_large';
case 'tainacan-medium':
return 'medium';
case 'tainacan-small':
@ -100,6 +100,17 @@ export const ThumbnailHelperFunctions = () => {
default:
return 'thumbnail';
}
},
getRelativeRetinaSize(tainacanSize) {
switch(tainacanSize) {
case 'tainacan-medium-full':
case 'tainacan-medium':
return 'large';
case 'tainacan-small':
return 'tainacan-medium';
default:
return 'full';
}
}
}
}