Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c4e3cc2

Browse files
[skwasm] Fix implementation of SkwasmPath.relativeLineTo (#57201)
Fixes flutter/flutter#157161
1 parent 0c8e1de commit c4e3cc2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/web_ui/lib/src/engine/skwasm/skwasm_impl/path.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class SkwasmPath extends SkwasmObjectWrapper<RawPath> implements ScenePath {
5050
void lineTo(double x, double y) => pathLineTo(handle, x, y);
5151

5252
@override
53-
void relativeLineTo(double x, double y) => pathRelativeMoveTo(handle, x, y);
53+
void relativeLineTo(double x, double y) => pathRelativeLineTo(handle, x, y);
5454

5555
@override
5656
void quadraticBezierTo(double x1, double y1, double x2, double y2) =>

lib/web_ui/test/ui/path_test.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,4 +239,13 @@ Future<void> testMain() async {
239239
expect(newFirstMetric.extractPath(4.0, 10.0).computeMetrics().first.length, 6.0);
240240
// TODO(hterkelsen): isClosed always returns false in the HTML renderer, https://github.com/flutter/flutter/issues/114446
241241
}, skip: isHtml);
242+
243+
test('path relativeLineTo', () {
244+
final p = Path();
245+
p.moveTo(100, 100);
246+
p.relativeLineTo(-50, -50);
247+
p.relativeLineTo(100, 0);
248+
p.relativeLineTo(-50, 50);
249+
expect(p.getBounds(), equals(const Rect.fromLTRB(50.0, 50.0, 150.0, 100.0)));
250+
});
242251
}

0 commit comments

Comments
 (0)