docs: update comments

This commit is contained in:
Tobias Schmitz 2025-05-06 09:18:49 +02:00
parent cf146b6f4d
commit 2b54c4e86a
No known key found for this signature in database
2 changed files with 9 additions and 5 deletions

View File

@ -645,8 +645,9 @@ impl<'a> GridLayouter<'a> {
let width = self.cell_spanned_width(cell, x); let width = self.cell_spanned_width(cell, x);
let mut pos = Point::new(dx, dy); let mut pos = Point::new(dx, dy);
if self.is_rtl { if self.is_rtl {
// In RTL cells expand to the left, thus the position // In RTL cells expand to the left, thus the
// must additionally be offset by the width of the cell. // position must additionally be offset by the
// cell's width.
pos.x = self.width - (dx + width); pos.x = self.width - (dx + width);
} }
let size = Size::new(width, height); let size = Size::new(width, height);
@ -1253,7 +1254,7 @@ impl<'a> GridLayouter<'a> {
let mut pos = offset; let mut pos = offset;
if self.is_rtl { if self.is_rtl {
// In RTL cells expand to the left, thus the position // In RTL cells expand to the left, thus the position
// must additionally be offset by the width of the cell. // must additionally be offset by the cell's width.
pos.x = self.width - (pos.x + width); pos.x = self.width - (pos.x + width);
} }
output.push_frame(pos, frame); output.push_frame(pos, frame);
@ -1301,8 +1302,9 @@ impl<'a> GridLayouter<'a> {
for (output, frame) in outputs.iter_mut().zip(fragment) { for (output, frame) in outputs.iter_mut().zip(fragment) {
let mut pos = offset; let mut pos = offset;
if self.is_rtl { if self.is_rtl {
// In RTL cells expand to the left, thus the position // In RTL cells expand to the left, thus the
// must additionally be offset by the width of the cell. // position must additionally be offset by the
// cell's width.
pos.x = self.width - (offset.x + width); pos.x = self.width - (offset.x + width);
} }
output.push_frame(pos, frame); output.push_frame(pos, frame);

View File

@ -123,6 +123,8 @@ impl GridLayouter<'_> {
}; };
let cell = self.grid.cell(x, y).unwrap(); let cell = self.grid.cell(x, y).unwrap();
let width = self.cell_spanned_width(cell, x); let width = self.cell_spanned_width(cell, x);
// In RTL cells expand to the left, thus the position
// must additionally be offset by the cell's width.
let dx = if self.is_rtl { self.width - (dx + width) } else { dx }; let dx = if self.is_rtl { self.width - (dx + width) } else { dx };
// Prepare regions. // Prepare regions.