Fix globalToLocal and update spinning_mixed (#6035)
* globalToLocal was just broken when there was a rotation and a translation at the same time. This fixes that and adds a test. * update graphic used by spinning_mixed since the old one went 404. * simplify some of the code in the demo. * fix MatrixUtils.transformPoint to be consistent with how we transform points elsewhere. * stop transforming points elsewhere, just use MatrixUtils.transformPoint. * make the Widget binding handle not having a root element. * make the spinning_mixed demo update its widget tree.
This commit is contained in:
@@ -51,7 +51,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
new RaisedButton(
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Image.network('http://flutter.io/favicon.ico'),
|
||||
new Image.network('https://flutter.io/images/favicon.png'),
|
||||
new Text('PRESS ME'),
|
||||
]
|
||||
),
|
||||
@@ -83,9 +83,9 @@ void rotate(Duration timeStamp) {
|
||||
double delta = (timeStamp - timeBase).inMicroseconds.toDouble() / Duration.MICROSECONDS_PER_SECOND; // radians
|
||||
|
||||
transformBox.setIdentity();
|
||||
transformBox.translate(transformBox.size.width / 2.0, transformBox.size.height / 2.0);
|
||||
transformBox.rotateZ(delta);
|
||||
transformBox.translate(-transformBox.size.width / 2.0, -transformBox.size.height / 2.0);
|
||||
|
||||
owner.buildScope(element);
|
||||
}
|
||||
|
||||
void main() {
|
||||
@@ -98,7 +98,7 @@ void main() {
|
||||
flexRoot.add(proxy);
|
||||
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
|
||||
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity());
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: FractionalOffset.center);
|
||||
RenderPadding root = new RenderPadding(padding: new EdgeInsets.all(80.0), child: transformBox);
|
||||
|
||||
binding.renderView.child = root;
|
||||
|
||||
Reference in New Issue
Block a user