@@ -308,26 +308,34 @@ final class PlatformViewContainer extends SliceContainer {
308308 assert (_bounds != null );
309309 if (_dirty) {
310310 final DomCSSStyleDeclaration style = container.style;
311- final double devicePixelRatio = EngineFlutterDisplay .instance.devicePixelRatio;
312- final double logicalWidth = _bounds! .width / devicePixelRatio;
313- final double logicalHeight = _bounds! .height / devicePixelRatio;
314- style.width = '${logicalWidth }px' ;
315- style.height = '${logicalHeight }px' ;
316311 style.position = 'absolute' ;
317-
318- final PlatformViewPosition position = PlatformViewPosition .combine (
319- _styling! .position,
320- PlatformViewPosition .offset (_bounds! .topLeft),
321- );
312+ final double devicePixelRatio = EngineFlutterDisplay .instance.devicePixelRatio;
313+ final PlatformViewPosition position = _styling! .position;
322314
323315 final ui.Offset offset = position.offset ?? ui.Offset .zero;
324- final double logicalLeft = offset.dx / devicePixelRatio;
325- final double logicalTop = offset.dy / devicePixelRatio;
326- style.left = '${logicalLeft }px' ;
327- style.top = '${logicalTop }px' ;
328-
329316 final Matrix4 ? transform = position.transform;
330- style.transform = transform != null ? float64ListToCssTransform3d (transform.storage) : '' ;
317+ if (transform == null ) {
318+ final ui.Offset newOffset = offset + _bounds! .topLeft;
319+ final double logicalWidth = _bounds! .width / devicePixelRatio;
320+ final double logicalHeight = _bounds! .height / devicePixelRatio;
321+ final double logicalLeft = newOffset.dx / devicePixelRatio;
322+ final double logicalTop = newOffset.dy / devicePixelRatio;
323+ style.width = '${logicalWidth }px' ;
324+ style.height = '${logicalHeight }px' ;
325+ style.left = '${logicalLeft }px' ;
326+ style.top = '${logicalTop }px' ;
327+ style.transform = '' ;
328+ } else {
329+ style.width = '${_bounds !.width }px' ;
330+ style.height = '${_bounds !.height }px' ;
331+ style.left = '0px' ;
332+ style.top = '0px' ;
333+
334+ final Matrix4 newTransform = transform.clone ();
335+ newTransform.translate (_bounds! .left, _bounds! .top);
336+ newTransform.scale (1 / devicePixelRatio);
337+ style.transform = float64ListToCssTransform3d (newTransform.storage);
338+ }
331339 style.opacity = _styling! .opacity != 1.0 ? '${_styling !.opacity }' : '' ;
332340 // TODO(jacksongardner): Implement clip styling for platform views
333341
0 commit comments