Some metrics tweaks for my laptop
This commit is contained in:
@@ -6,15 +6,20 @@ private struct BubbleLayoutConstants {
|
||||
public float tail_side_offset;
|
||||
public float tail_bottom_padding;
|
||||
public float corner_radius;
|
||||
public float text_padding;
|
||||
public float text_x_padding;
|
||||
public float text_y_padding;
|
||||
|
||||
public BubbleLayoutConstants(float scale_factor) {
|
||||
// TODO: Remove this, scale factor ignored for now.
|
||||
scale_factor = 2.0f;
|
||||
|
||||
tail_width = 15.0f / scale_factor;
|
||||
tail_curve_offset = 2.5f / scale_factor;
|
||||
tail_side_offset = 0.0f / scale_factor;
|
||||
tail_bottom_padding = 4.0f / scale_factor;
|
||||
corner_radius = 24.0f / scale_factor;
|
||||
text_padding = 18.0f / scale_factor;
|
||||
corner_radius = 34.0f / scale_factor;
|
||||
text_x_padding = 31.0f / scale_factor;
|
||||
text_y_padding = 8.0f / scale_factor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ private class SenderAnnotationLayout : Object, ChatItemLayout
|
||||
|
||||
|
||||
snapshot.translate(Graphene.Point() {
|
||||
x = constants.text_padding + constants.tail_width,
|
||||
x = constants.text_x_padding + constants.tail_width,
|
||||
y = get_height() - logical_rect.height,
|
||||
});
|
||||
|
||||
|
||||
@@ -19,11 +19,10 @@ private class TextBubbleLayout : BubbleLayout
|
||||
|
||||
// Create font description from system font
|
||||
var font_desc = Pango.FontDescription.from_string(font_name);
|
||||
|
||||
var size = font_desc.get_size();
|
||||
font_desc.set_size((int)(size));
|
||||
font_desc.set_size((int)(12 * Pango.SCALE));
|
||||
layout.set_font_description(font_desc);
|
||||
layout.set_wrap(Pango.WrapMode.WORD_CHAR);
|
||||
layout.set_line_spacing(1.18f);
|
||||
|
||||
// Set max width
|
||||
layout.set_width((int)text_available_width * Pango.SCALE);
|
||||
@@ -31,20 +30,20 @@ private class TextBubbleLayout : BubbleLayout
|
||||
|
||||
private float text_available_width {
|
||||
get {
|
||||
return max_width - text_x_offset - constants.text_padding;
|
||||
return max_width - text_x_offset - constants.text_x_padding;
|
||||
}
|
||||
}
|
||||
|
||||
private float text_x_offset {
|
||||
get {
|
||||
return from_me ? constants.text_padding : constants.tail_width + constants.text_padding;
|
||||
return from_me ? constants.text_x_padding : constants.tail_width + constants.text_x_padding;
|
||||
}
|
||||
}
|
||||
|
||||
private float text_x_padding {
|
||||
get {
|
||||
// Opposite of text_x_offset
|
||||
return from_me ? constants.tail_width + constants.text_padding : constants.text_padding;
|
||||
return from_me ? constants.tail_width + constants.text_x_padding : constants.text_x_padding;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ private class TextBubbleLayout : BubbleLayout
|
||||
Pango.Rectangle ink_rect, logical_rect;
|
||||
layout.get_pixel_extents(out ink_rect, out logical_rect);
|
||||
|
||||
return logical_rect.height + constants.corner_radius + constants.tail_bottom_padding;
|
||||
return logical_rect.height + constants.corner_radius + constants.tail_bottom_padding + constants.text_y_padding;
|
||||
}
|
||||
|
||||
public override float get_width() {
|
||||
@@ -78,6 +77,7 @@ private class TextBubbleLayout : BubbleLayout
|
||||
|
||||
Pango.Rectangle ink_rect, logical_rect;
|
||||
layout.get_pixel_extents(out ink_rect, out logical_rect);
|
||||
|
||||
snapshot.translate(Graphene.Point() {
|
||||
x = text_x_offset,
|
||||
y = ((get_height() - constants.tail_bottom_padding) - logical_rect.height) / 2
|
||||
|
||||
@@ -106,7 +106,7 @@ private class TranscriptDrawingArea : Widget
|
||||
// Text Bubble
|
||||
if (message.text.length > 0 && !message.is_attachment_marker) {
|
||||
var text_bubble = new TextBubbleLayout(message, this, max_width);
|
||||
text_bubble.vertical_padding = (last_sender == message.sender) ? 0.0f : 10.0f;
|
||||
text_bubble.vertical_padding = (last_sender == message.sender) ? 4.0f : 10.0f;
|
||||
items.add(text_bubble);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user