Skip to content

Commit d7f66c3

Browse files
committed
compare view: image+video combo is fine
1 parent 8207763 commit d7f66c3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/wwwroot/js/genpage/gentab/currentimagehandler.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@ class ImageCompareHelper {
14501450
this.getOverlay()?.style.setProperty('--image-compare-transparency', `${this.transparencyPercent / 100}`);
14511451
});
14521452
this.updateModeControls();
1453+
this.supportedTypes = ['image', 'video'];
14531454
}
14541455

14551456
getImgOrContainer() {
@@ -2065,12 +2066,9 @@ class ImageCompareHelper {
20652066
if (items.length > 2) {
20662067
return { state: 'invalid', reason: 'Compare only supports exactly 2 selected items.' };
20672068
}
2068-
if (items[0].mediaType == 'audio' || items[1].mediaType == 'audio') {
2069+
if (!this.supportedTypes.includes(items[0].mediaType) || !this.supportedTypes.includes(items[1].mediaType)) {
20692070
return { state: 'invalid', reason: 'Compare only supports images and videos.' };
20702071
}
2071-
if (items[0].mediaType != items[1].mediaType) {
2072-
return { state: 'invalid', reason: 'Compare requires 2 items of the same media type.' };
2073-
}
20742072
return { state: 'ready', reason: 'Compare the selected items.' };
20752073
}
20762074
}

0 commit comments

Comments
 (0)