Update vector_math (#4201)
The new version has an API change. Also, up our SDK requirements to be a bit more realistic.
This commit is contained in:
parent
9cfa96608c
commit
fde55a6f6a
@ -175,14 +175,14 @@ Widget buildTextSelectionHandle(
|
||||
switch (type) {
|
||||
case TextSelectionHandleType.left: // points up-right
|
||||
return new Transform(
|
||||
transform: new Matrix4.identity().rotateZ(math.PI / 2.0),
|
||||
transform: new Matrix4.rotationZ(math.PI / 2.0),
|
||||
child: handle
|
||||
);
|
||||
case TextSelectionHandleType.right: // points up-left
|
||||
return handle;
|
||||
case TextSelectionHandleType.collapsed: // points up
|
||||
return new Transform(
|
||||
transform: new Matrix4.identity().rotateZ(math.PI / 4.0),
|
||||
transform: new Matrix4.rotationZ(math.PI / 4.0),
|
||||
child: handle
|
||||
);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ class RenderViewportBase extends RenderBox {
|
||||
@override
|
||||
void applyPaintTransform(RenderBox child, Matrix4 transform) {
|
||||
final Offset effectivePaintOffset = _effectivePaintOffset;
|
||||
super.applyPaintTransform(child, transform.translate(effectivePaintOffset.dx, effectivePaintOffset.dy));
|
||||
super.applyPaintTransform(child, transform..translate(effectivePaintOffset.dx, effectivePaintOffset.dy));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -7,7 +7,7 @@ homepage: http://flutter.io
|
||||
dependencies:
|
||||
collection: '>=1.4.0 <2.0.0'
|
||||
intl: '>=0.12.4+2 <0.13.0'
|
||||
vector_math: '>=1.4.5 <2.0.0'
|
||||
vector_math: '>=2.0.3 <3.0.0'
|
||||
|
||||
# We need to pin crypto because archive can't handle larger numbers.
|
||||
crypto: 0.9.2
|
||||
@ -24,4 +24,4 @@ dev_dependencies:
|
||||
path: ../flutter_test
|
||||
|
||||
environment:
|
||||
sdk: '>=1.12.0 <2.0.0'
|
||||
sdk: '>=1.16.0 <2.0.0'
|
||||
|
@ -29,7 +29,7 @@ void main() {
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
child: new Transform(
|
||||
transform: new Matrix4.identity().scale(0.5, 0.5),
|
||||
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
|
||||
origin: new Offset(100.0, 50.0),
|
||||
child: new GestureDetector(
|
||||
onTap: () {
|
||||
@ -78,7 +78,7 @@ void main() {
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
child: new Transform(
|
||||
transform: new Matrix4.identity().scale(0.5, 0.5),
|
||||
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
|
||||
alignment: new FractionalOffset(1.0, 0.5),
|
||||
child: new GestureDetector(
|
||||
onTap: () {
|
||||
@ -127,7 +127,7 @@ void main() {
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
child: new Transform(
|
||||
transform: new Matrix4.identity().scale(0.5, 0.5),
|
||||
transform: new Matrix4.diagonal3Values(0.5, 0.5, 1.0),
|
||||
origin: new Offset(100.0, 0.0),
|
||||
alignment: new FractionalOffset(0.0, 0.5),
|
||||
child: new GestureDetector(
|
||||
|
@ -5,7 +5,7 @@ homepage: http://flutter.io
|
||||
author: Flutter Authors <flutter-dev@googlegroups.com>
|
||||
|
||||
environment:
|
||||
sdk: '>=1.12.0 <2.0.0'
|
||||
sdk: '>=1.16.0 <2.0.0'
|
||||
|
||||
dependencies:
|
||||
file: '^0.1.0'
|
||||
|
@ -413,10 +413,10 @@ class Node {
|
||||
if (_parent == null) {
|
||||
// Base case, we are at the top
|
||||
assert(this == _spriteBox.rootNode);
|
||||
_transformMatrixNodeToBox = new Matrix4.copy(_spriteBox.transformMatrix).multiply(transformMatrix);
|
||||
_transformMatrixNodeToBox = _spriteBox.transformMatrix.clone()..multiply(transformMatrix);
|
||||
}
|
||||
else {
|
||||
_transformMatrixNodeToBox = new Matrix4.copy(_parent._nodeToBoxMatrix()).multiply(transformMatrix);
|
||||
_transformMatrixNodeToBox = _parent._nodeToBoxMatrix().clone()..multiply(transformMatrix);
|
||||
}
|
||||
return _transformMatrixNodeToBox;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class Node3D extends Node {
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, -1.0/_projectionDepth,
|
||||
0.0, 0.0, 0.0, 1.0);
|
||||
matrix = matrix.multiply(projection);
|
||||
matrix.multiply(projection);
|
||||
|
||||
// Rotate around x and y axis
|
||||
matrix.rotateY(radians(_rotationY));
|
||||
|
@ -261,7 +261,7 @@ class ParticleSystem extends Node {
|
||||
// Radial acceleration
|
||||
Vector2 radial;
|
||||
if (particle.pos[0] != 0 || particle.pos[1] != 0) {
|
||||
radial = new Vector2.copy(particle.pos).normalize();
|
||||
radial = new Vector2.copy(particle.pos)..normalize();
|
||||
} else {
|
||||
radial = new Vector2.zero();
|
||||
}
|
||||
@ -275,11 +275,11 @@ class ParticleSystem extends Node {
|
||||
tangential.scale(particle.accelerations.tangentialAccel);
|
||||
|
||||
// (gravity + radial + tangential) * dt
|
||||
final Vector2 accel = (_gravity + radial + tangential).scale(dt);
|
||||
final Vector2 accel = (_gravity + radial + tangential)..scale(dt);
|
||||
particle.dir += accel;
|
||||
} else if (_gravity[0] != 0.0 || _gravity[1] != 0) {
|
||||
// gravity
|
||||
final Vector2 accel = new Vector2.copy(_gravity).scale(dt);
|
||||
final Vector2 accel = _gravity.clone()..scale(dt);
|
||||
particle.dir += accel;
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ class ParticleSystem extends Node {
|
||||
double dirRadians = convertDegrees2Radians(direction + directionVar * randomSignedDouble());
|
||||
Vector2 dirVector = new Vector2(math.cos(dirRadians), math.sin(dirRadians));
|
||||
double speedFinal = speed + speedVar * randomSignedDouble();
|
||||
particle.dir = dirVector.scale(speedFinal);
|
||||
particle.dir = dirVector..scale(speedFinal);
|
||||
|
||||
// Accelerations
|
||||
if (radialAcceleration != 0.0 || radialAccelerationVar != 0.0 ||
|
||||
|
@ -271,14 +271,12 @@ Vector2 _computeMiter(Vector2 lineA, Vector2 lineB) {
|
||||
|
||||
double dot = dot2(miter, new Vector2(-lineA[1], lineA[0]));
|
||||
if (dot.abs() < 0.1) {
|
||||
miter = _vectorNormal(lineA).normalize();
|
||||
miter = _vectorNormal(lineA)..normalize();
|
||||
return miter;
|
||||
}
|
||||
|
||||
double miterLength = 1.0 / dot;
|
||||
miter = miter.scale(miterLength);
|
||||
|
||||
return miter;
|
||||
return miter..scale(miterLength);
|
||||
}
|
||||
|
||||
Vector2 _vectorNormal(Vector2 v) {
|
||||
@ -287,7 +285,7 @@ Vector2 _vectorNormal(Vector2 v) {
|
||||
|
||||
Vector2 _vectorDirection(Vector2 a, Vector2 b) {
|
||||
Vector2 result = a - b;
|
||||
return result.normalize();
|
||||
return result..normalize();
|
||||
}
|
||||
|
||||
List<Vector2> _computeMiterList(List<Vector2> points, bool closed) {
|
||||
|
@ -5,7 +5,7 @@ author: Flutter Authors <flutter-dev@googlegroups.com>
|
||||
homepage: http://flutter.io
|
||||
|
||||
dependencies:
|
||||
box2d: '>=0.2.0 <0.3.0'
|
||||
box2d: '>=0.3.0 <0.4.0'
|
||||
flutter:
|
||||
path: ../flutter
|
||||
|
||||
|
@ -5,7 +5,7 @@ homepage: http://flutter.io
|
||||
author: Flutter Authors <flutter-dev@googlegroups.com>
|
||||
|
||||
environment:
|
||||
sdk: '>=1.12.0 <2.0.0'
|
||||
sdk: '>=1.16.0 <2.0.0'
|
||||
|
||||
dependencies:
|
||||
archive: ^1.0.20
|
||||
|
@ -10,7 +10,7 @@ dependencies:
|
||||
crypto: 0.9.2
|
||||
|
||||
environment:
|
||||
sdk: '>=1.12.0 <2.0.0'
|
||||
sdk: '>=1.16.0 <2.0.0'
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -13,4 +13,4 @@ dev_dependencies:
|
||||
path: ../flutter_test
|
||||
|
||||
environment:
|
||||
sdk: '>=1.12.0 <2.0.0'
|
||||
sdk: '>=1.16.0 <2.0.0'
|
||||
|
Loading…
x
Reference in New Issue
Block a user