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 @@
imagesw = sSize.width;
max_imagesw = MAX(max_imagesw, imagesw);
originy = max_imagesh+IMAGE_DEFAULT_MARGIN;
max_imagesh = sSize.height;
max_imagesh += sSize.height;
originx = sSize.width;
} else {
max_imagesw = MAX(max_imagesw, imagesw);
......@@ -691,6 +691,9 @@
contentView.fileUrls = fileUrls;
[_finalAssetView addSubview:contentView];
}
CGRect imgFrame = self.finalAssetView.frame;
imgFrame.size = CGSizeMake(max_imagesw, max_imagesh);
self.finalAssetView.frame = imgFrame;
_finalImage.hidden = YES;
} else {
// Resizing Image view
......@@ -706,10 +709,8 @@
const char *utf8Text = linphone_chat_message_get_text_content(self.message);
CGRect textFrame = self.messageText.frame;
if (_contentViews.count > 0)
textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height-10);
else if (_finalImage.image)
textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height);
if (_contentViews.count > 0 || _finalImage.image)
textFrame.origin = CGPointMake(textFrame.origin.x, self.finalAssetView.frame.origin.y + self.finalAssetView.frame.size.height);
else
// When image hasn't be download
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;
if (imagesw > width) {
imagesw = sSize.width;
max_imagesw = MAX(max_imagesw, imagesw);
max_imagesh = imagesh;
max_imagesh += imagesh;
imagesh = sSize.height;
} else {
max_imagesw = MAX(max_imagesw, imagesw);
......@@ -507,22 +507,21 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44;
}
}
}
max_imagesh += imagesh;
size = CGSizeMake(max_imagesw, max_imagesh);
CGSize textSize = CGSizeMake(0, 0);
if (![messageText isEqualToString:@"🗻"]) {
textSize = [self computeBoundingBox:messageText
size:CGSizeMake(width - CELL_MESSAGE_X_MARGIN - 4, CGFLOAT_MAX)
size:CGSizeMake(max_imagesw , CGFLOAT_MAX)
font:messageFont];
size.height += textSize.height;
}
// add size for message text
size.height += textSize.height;
size.width = MAX(textSize.width, size.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;
}
......
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