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

Commit 4dc017a

Browse files
committed
Delegate window metrics to engine window in html scene object.
1 parent 3c4e736 commit 4dc017a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/web_ui/lib/src/engine/html/scene.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:ui/ui.dart' as ui;
66

77
import '../dom.dart';
88
import '../vector_math.dart';
9+
import '../window.dart';
910
import 'surface.dart';
1011

1112
class SurfaceScene implements ui.Scene {
@@ -45,12 +46,10 @@ class PersistedScene extends PersistedContainerSurface {
4546
@override
4647
void recomputeTransformAndClip() {
4748
// The scene clip is the size of the entire window.
48-
// TODO(yjbanov): in the add2app scenario where we might be hosted inside
49-
// a custom element, this will be different. We will need to
50-
// update this code when we add add2app support.
51-
final double screenWidth = domWindow.innerWidth!;
52-
final double screenHeight = domWindow.innerHeight!;
53-
localClipBounds = ui.Rect.fromLTRB(0, 0, screenWidth, screenHeight);
49+
final ui.Size screen = window.physicalSize / window.devicePixelRatio;
50+
// Question: why is the above a logical size, rather than a physical size
51+
// like everywhere else in the metrics?
52+
localClipBounds = ui.Rect.fromLTRB(0, 0, screen.width, screen.height);
5453
projectedClip = null;
5554
}
5655

0 commit comments

Comments
 (0)