Skip to content

Commit 6429cc8

Browse files
committed
text: Take the gutter into account when masking text
Flash Player does not render text over the gutter.
1 parent 104ee79 commit 6429cc8

File tree

6 files changed

+13
-1
lines changed

6 files changed

+13
-1
lines changed

core/src/display_object/edit_text.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2702,7 +2702,10 @@ impl<'gc> TDisplayObject<'gc> for EditText<'gc> {
27022702
}
27032703

27042704
context.commands.push_mask();
2705-
let mask = Matrix::create_box_from_rectangle(&self.0.bounds.get());
2705+
2706+
let mask_bounds = self.0.bounds.get().grow_x(-Self::GUTTER);
2707+
let mask = Matrix::create_box_from_rectangle(&mask_bounds);
2708+
27062709
context.commands.draw_rect(
27072710
Color::WHITE,
27082711
context.transform_stack.transform().matrix * mask,

swf/src/types/rectangle.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ impl<T: Coordinate> Rectangle<T> {
165165
self
166166
}
167167

168+
#[must_use]
169+
pub fn grow_x(mut self, amount: T) -> Self {
170+
if self.is_valid() {
171+
self.x_min -= amount;
172+
self.x_max += amount;
173+
}
174+
self
175+
}
176+
168177
#[must_use]
169178
pub fn is_point(&self) -> bool {
170179
self.x_min == self.x_max && self.y_min == self.y_max
-29.2 KB
Loading
-26.6 KB
Loading
65 Bytes
Loading
4 Bytes
Loading

0 commit comments

Comments
 (0)