Commit de332164 authored by DanmeiChen's avatar DanmeiChen
Browse files

fix multiparts alignment

parent 942db357
Pipeline #30702 passed with stage
in 12 minutes and 29 seconds
...@@ -679,7 +679,7 @@ ...@@ -679,7 +679,7 @@
imagesw = sSize.width; imagesw = sSize.width;
max_imagesw = MAX(max_imagesw, imagesw); max_imagesw = MAX(max_imagesw, imagesw);
originy = max_imagesh+IMAGE_DEFAULT_MARGIN; originy = max_imagesh+IMAGE_DEFAULT_MARGIN;
max_imagesh = sSize.height; max_imagesh += sSize.height;
originx = sSize.width; originx = sSize.width;
} else { } else {
max_imagesw = MAX(max_imagesw, imagesw); max_imagesw = MAX(max_imagesw, imagesw);
...@@ -691,6 +691,9 @@ ...@@ -691,6 +691,9 @@
contentView.fileUrls = fileUrls; contentView.fileUrls = fileUrls;
[_finalAssetView addSubview:contentView]; [_finalAssetView addSubview:contentView];
} }
CGRect imgFrame = self.finalAssetView.frame;
imgFrame.size = CGSizeMake(max_imagesw, max_imagesh);
self.finalAssetView.frame = imgFrame;
_finalImage.hidden = YES; _finalImage.hidden = YES;
} else { } else {
// Resizing Image view // Resizing Image view
...@@ -706,10 +709,8 @@ ...@@ -706,10 +709,8 @@
const char *utf8Text = linphone_chat_message_get_text_content(self.message); const char *utf8Text = linphone_chat_message_get_text_content(self.message);
CGRect textFrame = self.messageText.frame; CGRect textFrame = self.messageText.frame;
if (_contentViews.count > 0) if (_contentViews.count > 0 || _finalImage.image)
textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height-10); textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height);
else if (_finalImage.image)
textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height);
else else
// When image hasn't be download // When image hasn't be download
textFrame.origin = CGPointMake(textFrame.origin.x, _imageSubView.frame.size.height + _imageSubView.frame.origin.y - 10); textFrame.origin = CGPointMake(textFrame.origin.x, _imageSubView.frame.size.height + _imageSubView.frame.origin.y - 10);
......
...@@ -499,7 +499,7 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; ...@@ -499,7 +499,7 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44;
if (imagesw > width) { if (imagesw > width) {
imagesw = sSize.width; imagesw = sSize.width;
max_imagesw = MAX(max_imagesw, imagesw); max_imagesw = MAX(max_imagesw, imagesw);
max_imagesh = imagesh; max_imagesh += imagesh;
imagesh = sSize.height; imagesh = sSize.height;
} else { } else {
max_imagesw = MAX(max_imagesw, imagesw); max_imagesw = MAX(max_imagesw, imagesw);
...@@ -507,22 +507,21 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; ...@@ -507,22 +507,21 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44;
} }
} }
} }
max_imagesh += imagesh; max_imagesh += imagesh;
size = CGSizeMake(max_imagesw, max_imagesh); size = CGSizeMake(max_imagesw, max_imagesh);
CGSize textSize = CGSizeMake(0, 0); CGSize textSize = CGSizeMake(0, 0);
if (![messageText isEqualToString:@"🗻"]) { if (![messageText isEqualToString:@"🗻"]) {
textSize = [self computeBoundingBox:messageText textSize = [self computeBoundingBox:messageText
size:CGSizeMake(width - CELL_MESSAGE_X_MARGIN - 4, CGFLOAT_MAX) size:CGSizeMake(max_imagesw , CGFLOAT_MAX)
font:messageFont]; font:messageFont];
size.height += textSize.height;
} }
// add size for message text // add size for message text
size.height += textSize.height; size.height += textSize.height;
size.width = MAX(textSize.width, size.width); size.width = MAX(textSize.width, size.width);
size.width = MAX(size.width + CELL_MESSAGE_X_MARGIN, CELL_MIN_WIDTH); size.width = MAX(size.width + CELL_MESSAGE_X_MARGIN, CELL_MIN_WIDTH);
size.height = MAX(size.height + CELL_MESSAGE_Y_MARGIN, CELL_MIN_HEIGHT); size.height = MAX(size.height + CELL_MESSAGE_Y_MARGIN, CELL_MIN_HEIGHT) ;
return size; return size;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment