Compare commits

...

1 Commits

Author SHA1 Message Date
7e81ec3f69 Fix bug with matrix.mapRect (#61)
Fix a bug in the matrix transformation applied to a rect. We now use the MatrixUtils class from Flutter.
2020-05-18 12:55:53 +02:00
17 changed files with 2576 additions and 75 deletions

View File

@ -1,3 +1,6 @@
## [0.3.5]
- Fix a bug with a wrongly clipped rectangle.
## [0.3.4]
- Fix a bug with dashed path

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9
path_provider: e0848572d1d38b9a7dd099e79cf83f5b7e2cde9f
path_provider_macos: adb94ae6c253c45ef2aac146fbf1f4504d74b0f8
path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7

View File

@ -43,6 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
collection:
dependency: transitive
description:
@ -64,6 +71,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
@ -102,13 +116,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
logging:
dependency: transitive
description:
@ -143,7 +150,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
path_provider:
dependency: "direct main"
description:
@ -172,13 +179,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
@ -193,13 +193,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
@ -261,13 +254,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -34,28 +34,20 @@ extension Matrix4Extension on Matrix4 {
}
Rect mapRect(Rect rect) {
var topLeft = Vector3(rect.left, rect.top, 0.0)..applyMatrix4(this);
var topRight = Vector3(rect.right, rect.top, 0.0)..applyMatrix4(this);
var bottomLeft = Vector3(rect.left, rect.bottom, 0.0)..applyMatrix4(this);
var bottomRight = Vector3(rect.right, rect.bottom, 0.0)..applyMatrix4(this);
var newLeft = min(topLeft.x, bottomLeft.x);
var newTop = min(topLeft.y, topRight.y);
var newRight = max(topRight.x, bottomRight.x);
var newBottom = max(bottomLeft.y, bottomRight.y);
return Rect.fromLTRB(newLeft, newTop, newRight, newBottom);
return MatrixUtils.transformRect(this, rect);
}
/// Apply this matrix to the array of 2D points, and write the transformed points back into the
/// array
///
/// @param pts The array [x0, y0, x1, y1, ...] of points to transform.
void mapPoints(List<double> array, [int offset]) {
void mapPoints(List<double> array) {
for (var i = 0; i < array.length; i += 2) {
final v = Vector3(array[i], array[i + 1], 0.0)..applyMatrix4(this);
array[i] = v.storage[0];
array[i + 1] = v.storage[1];
final v =
MatrixUtils.transformPoint(this, Offset(array[i], array[i + 1]));
array[i] = v.dx;
array[i + 1] = v.dy;
}
}

View File

@ -57,6 +57,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
collection:
dependency: "direct main"
description:
@ -92,6 +99,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.6"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
@ -116,13 +130,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0+3"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
js:
dependency: transitive
description:
@ -185,7 +192,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
pedantic:
dependency: transitive
description:
@ -193,13 +200,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
pub_semver:
dependency: transitive
description:
@ -207,13 +207,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
@ -282,13 +275,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+15"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
yaml:
dependency: "direct dev"
description:

View File

@ -1,6 +1,6 @@
name: lottie
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
version: 0.3.4
version: 0.3.5
homepage: https://github.com/xvrh/lottie-flutter
environment: