Media Viewer: Support dragging images to desktop (#1090)
This commit is contained in:
parent
8036c0dc87
commit
314831eb04
@ -399,7 +399,11 @@ const MediaViewer: FC<StateProps & DispatchProps> = ({
|
|||||||
if (avatarOwner) {
|
if (avatarOwner) {
|
||||||
return (
|
return (
|
||||||
<div key={chatId} className="media-viewer-content">
|
<div key={chatId} className="media-viewer-content">
|
||||||
{renderPhoto(fullMediaData || blobUrlPreview, calculateMediaViewerDimensions(AVATAR_FULL_DIMENSIONS, false))}
|
{renderPhoto(
|
||||||
|
fullMediaData || blobUrlPreview,
|
||||||
|
calculateMediaViewerDimensions(AVATAR_FULL_DIMENSIONS, false),
|
||||||
|
!IS_MOBILE_SCREEN && !isZoomed,
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (message) {
|
} else if (message) {
|
||||||
@ -411,6 +415,7 @@ const MediaViewer: FC<StateProps & DispatchProps> = ({
|
|||||||
{isPhoto && renderPhoto(
|
{isPhoto && renderPhoto(
|
||||||
localBlobUrl || fullMediaData || blobUrlPreview || blobUrlPictogram,
|
localBlobUrl || fullMediaData || blobUrlPreview || blobUrlPictogram,
|
||||||
message && calculateMediaViewerDimensions(photoDimensions!, hasFooter),
|
message && calculateMediaViewerDimensions(photoDimensions!, hasFooter),
|
||||||
|
!IS_MOBILE_SCREEN && !isZoomed,
|
||||||
)}
|
)}
|
||||||
{isVideo && (
|
{isVideo && (
|
||||||
<VideoPlayer
|
<VideoPlayer
|
||||||
@ -529,7 +534,7 @@ const MediaViewer: FC<StateProps & DispatchProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function renderPhoto(blobUrl?: string, imageSize?: IDimensions) {
|
function renderPhoto(blobUrl?: string, imageSize?: IDimensions, canDrag?: boolean) {
|
||||||
return blobUrl
|
return blobUrl
|
||||||
? (
|
? (
|
||||||
<img
|
<img
|
||||||
@ -537,7 +542,7 @@ function renderPhoto(blobUrl?: string, imageSize?: IDimensions) {
|
|||||||
alt=""
|
alt=""
|
||||||
// @ts-ignore teact feature
|
// @ts-ignore teact feature
|
||||||
style={imageSize ? `width: ${imageSize.width}px` : ''}
|
style={imageSize ? `width: ${imageSize.width}px` : ''}
|
||||||
draggable={false}
|
draggable={Boolean(canDrag)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
: (
|
: (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user