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

Commit e878eed

Browse files
committed
[fuchsia][scenic] Use infinite hit region
fxbug.dev/118729
1 parent 87bdde8 commit e878eed

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

shell/platform/fuchsia/flutter/flatland_external_view_embedder.cc

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
namespace flutter_runner {
1414
namespace {
1515

16-
// Since the flatland hit-region can be transformed (rotated, scaled or
17-
// translated), we must ensure that the size of the hit-region will not cause
18-
// overflows on operations (like FLT_MAX would).
19-
constexpr float kMaxHitRegionSize = 1'000'000.f;
20-
2116
void AttachClipTransformChild(
2217
FlatlandConnection* flatland,
2318
FlatlandExternalViewEmbedder::ClipTransform* parent_clip_transform,
@@ -59,19 +54,13 @@ FlatlandExternalViewEmbedder::FlatlandExternalViewEmbedder(
5954
if (intercept_all_input) {
6055
input_interceptor_transform_ = flatland_->NextTransformId();
6156
flatland_->flatland()->CreateTransform(*input_interceptor_transform_);
57+
flatland_->flatland()->SetInfiniteHitRegion(
58+
*input_interceptor_transform_,
59+
fuchsia::ui::composition::HitTestInteraction::SEMANTICALLY_INVISIBLE);
6260

6361
flatland_->flatland()->AddChild(root_transform_id_,
6462
*input_interceptor_transform_);
6563
child_transforms_.emplace_back(*input_interceptor_transform_);
66-
67-
// Attach full-screen hit testing shield. Note that since the hit-region
68-
// may be transformed (translated, rotated), we do not want to set
69-
// width/height to FLT_MAX. This will cause a numeric overflow.
70-
flatland_->flatland()->SetHitRegions(
71-
*input_interceptor_transform_,
72-
{{{0, 0, kMaxHitRegionSize, kMaxHitRegionSize},
73-
fuchsia::ui::composition::HitTestInteraction::
74-
SEMANTICALLY_INVISIBLE}});
7564
}
7665
}
7766

@@ -453,9 +442,9 @@ void FlatlandExternalViewEmbedder::SubmitFrame(
453442
flatland_layer_index++;
454443
}
455444

456-
// Set up the input interceptor at the top of the
457-
// scene, if applicable. It will capture all input, and any unwanted input
458-
// will be reinjected into embedded views.
445+
// Set up the input interceptor at the top of the scene, if applicable. It
446+
// will capture all input, and any unwanted input will be reinjected into
447+
// embedded views.
459448
if (input_interceptor_transform_.has_value()) {
460449
flatland_->flatland()->AddChild(root_transform_id_,
461450
*input_interceptor_transform_);

0 commit comments

Comments
 (0)