Files
react-native/ReactCommon/react/renderer/components/view/PointerEvent.cpp
T
Vincent Riemer 92e4ed6a28 Add iOS implementation of the button property of the PointerEvent object
Summary:
Changelog: [iOS][Internal] - Add iOS implementation of the button property of the PointerEvent object

This implements the `button` property on the PointerEvent object by storing the button which caused the down event in the `ActiveTouch` and reporting that button through `pointerdown` and `pointerup` events and -1 on all others. This diff also includes a small fix to the `pressure` property which was introduced due to `button` being correctly implemented.

Reviewed By: yungsters

Differential Revision: D38632543

fbshipit-source-id: 9dbbb23a9251f2e661faf37fdf206b9f0b26bc5f
2022-08-15 12:00:15 -07:00

51 lines
2.0 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "PointerEvent.h"
namespace facebook {
namespace react {
#if RN_DEBUG_STRING_CONVERTIBLE
std::string getDebugName(PointerEvent const &pointerEvent) {
return "PointerEvent";
}
std::vector<DebugStringConvertibleObject> getDebugProps(
PointerEvent const &pointerEvent,
DebugStringConvertibleOptions options) {
return {
{"pointerId", getDebugDescription(pointerEvent.pointerId, options)},
{"pressure", getDebugDescription(pointerEvent.pressure, options)},
{"pointerType", getDebugDescription(pointerEvent.pointerType, options)},
{"clientPoint", getDebugDescription(pointerEvent.clientPoint, options)},
{"screenPoint", getDebugDescription(pointerEvent.screenPoint, options)},
{"offsetPoint", getDebugDescription(pointerEvent.offsetPoint, options)},
{"width", getDebugDescription(pointerEvent.width, options)},
{"height", getDebugDescription(pointerEvent.height, options)},
{"tiltX", getDebugDescription(pointerEvent.tiltX, options)},
{"tiltY", getDebugDescription(pointerEvent.tiltY, options)},
{"detail", getDebugDescription(pointerEvent.detail, options)},
{"buttons", getDebugDescription(pointerEvent.buttons, options)},
{"tangentialPressure",
getDebugDescription(pointerEvent.tangentialPressure, options)},
{"twist", getDebugDescription(pointerEvent.twist, options)},
{"ctrlKey", getDebugDescription(pointerEvent.ctrlKey, options)},
{"shiftKey", getDebugDescription(pointerEvent.shiftKey, options)},
{"altKey", getDebugDescription(pointerEvent.altKey, options)},
{"metaKey", getDebugDescription(pointerEvent.metaKey, options)},
{"isPrimary", getDebugDescription(pointerEvent.isPrimary, options)},
{"button", getDebugDescription(pointerEvent.button, options)},
};
}
#endif
} // namespace react
} // namespace facebook