Skip to content

Commit 1031bc0

Browse files
committed
feat: улучшение распределения размеров в сетке с 3 фотками
1 parent f14c449 commit 1031bc0

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Diff for: src/components/messages/chat/Message.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,8 @@ export default {
418418
}
419419
420420
.message.flyTime.hideBubble:not(.isSticker) .message_time_wrap {
421-
right: 6px;
422-
bottom: 6px;
421+
right: 5px;
422+
bottom: 5px;
423423
}
424424
425425
.message.isSticker:not(.hideBubble).out .message_time_wrap {

Diff for: src/components/messages/chat/attachments/photosLayout.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,26 @@ export function calculatePhotosLayout({ thumbs, margin, maxWidth, maxHeight }) {
166166
} else {
167167
// [photo1][p2]
168168
// [ ][p3]
169-
const height1 = Math.min(maxHeight, thumbs[0].height);
169+
const mediumRightPhotosHeight = (thumbs[1].height + thumbs[2].height) / 2;
170+
const height1 = Math.min(
171+
maxHeight,
172+
Math.max(
173+
Math.min(thumbs[0].height, mediumRightPhotosHeight * 1.5),
174+
Math.min(mediumRightPhotosHeight, thumbs[0].height * 1.5),
175+
mediumRightPhotosHeight * .75
176+
)
177+
);
170178
// Высота p3
171179
const height2 = photoRatios[1] * (height1 - margin) / (photoRatios[2] + photoRatios[1]);
172180
// Высота p2
173181
const height3 = height1 - height2 - margin;
174182
const width1 = Math.min(height1 * photoRatios[0], (maxWidth - margin) * .75);
175183
const width2 = Math.min(
176184
maxWidth - width1 - margin,
177-
(height3 * photoRatios[1] + height2 * photoRatios[2]) / 2
185+
Math.max(
186+
(height3 * photoRatios[1] + height2 * photoRatios[2]) / 2,
187+
width1 / 3 // (3/4) / 3 = 1/4
188+
)
178189
);
179190

180191
updateThumb(thumbs[0], width1, height1, false, true);

0 commit comments

Comments
 (0)