[dart:ui] Add view ID to PointerData.toString (flutter/engine#51352)
The `view_id` is useful information as the pointer's `x` and `y` coordinates are relative to the view's origin. Part of https://github.com/flutter/flutter/issues/112205 Part of https://github.com/flutter/flutter/issues/142845 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -381,7 +381,7 @@ class PointerData {
|
||||
final double rotation;
|
||||
|
||||
@override
|
||||
String toString() => 'PointerData(x: $physicalX, y: $physicalY)';
|
||||
String toString() => 'PointerData(viewId: $viewId, x: $physicalX, y: $physicalY)';
|
||||
|
||||
/// Returns a complete textual description of the information in this object.
|
||||
String toStringFull() {
|
||||
|
||||
@@ -481,13 +481,13 @@ class PlatformConfiguration final {
|
||||
void ReportTimings(std::vector<int64_t> timings);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Retrieves the Window with the given ID managed by the
|
||||
/// `PlatformConfiguration`.
|
||||
/// @brief Retrieves the viewport metrics with the given ID managed by
|
||||
/// the `PlatformConfiguration`.
|
||||
///
|
||||
/// @param[in] window_id The id of the window to find and return.
|
||||
/// @param[in] view_id The id of the view's viewport metrics to return.
|
||||
///
|
||||
/// @return a pointer to the Window. Returns nullptr if the ID is not
|
||||
/// found.
|
||||
/// @return a pointer to the ViewportMetrics. Returns nullptr if the ID is
|
||||
/// not found.
|
||||
///
|
||||
const ViewportMetrics* GetMetrics(int view_id);
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class PointerData {
|
||||
final double rotation;
|
||||
|
||||
@override
|
||||
String toString() => 'PointerData(x: $physicalX, y: $physicalY)';
|
||||
String toString() => 'PointerData(viewId: $viewId, x: $physicalX, y: $physicalY)';
|
||||
String toStringFull() {
|
||||
return '$runtimeType('
|
||||
'embedderId: $embedderId, '
|
||||
|
||||
@@ -2700,7 +2700,7 @@ TEST_F(EmbedderTest, CanSendPointer) {
|
||||
CREATE_NATIVE_ENTRY([&message_latch](Dart_NativeArguments args) {
|
||||
auto message = tonic::DartConverter<std::string>::FromDart(
|
||||
Dart_GetNativeArgument(args, 0));
|
||||
ASSERT_EQ("PointerData(x: 123.0, y: 456.0)", message);
|
||||
ASSERT_EQ("PointerData(viewId: 0, x: 123.0, y: 456.0)", message);
|
||||
message_latch.Signal();
|
||||
}));
|
||||
|
||||
@@ -2715,6 +2715,7 @@ TEST_F(EmbedderTest, CanSendPointer) {
|
||||
pointer_event.x = 123;
|
||||
pointer_event.y = 456;
|
||||
pointer_event.timestamp = static_cast<size_t>(1234567890);
|
||||
pointer_event.view_id = 0;
|
||||
|
||||
FlutterEngineResult result =
|
||||
FlutterEngineSendPointerEvent(engine.get(), &pointer_event, 1);
|
||||
|
||||
Reference in New Issue
Block a user