Skip to content

Commit 6dff1ae

Browse files
authored
TextInput should capture mouse on mouse down (#14983)
* TextInput should capture mouse on mouse down * Change files * format
1 parent 65013b9 commit 6dff1ae

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "TextInput should capture mouse on mouse down",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ struct CompScrollerVisual : winrt::implements<
811811
m_horizontal ? TTypeRedirects::InteractionSourceMode::Disabled
812812
: TTypeRedirects::InteractionSourceMode::EnabledWithInertia);
813813
m_visualInteractionSource.ManipulationRedirectionMode(
814-
TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
814+
TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadOnly);
815815
} else {
816816
m_visualInteractionSource.PositionXSourceMode(TTypeRedirects::InteractionSourceMode::Disabled);
817817
m_visualInteractionSource.PositionYSourceMode(TTypeRedirects::InteractionSourceMode::Disabled);

vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <winrt/Microsoft.UI.Input.h>
1717
#include <winrt/Windows.System.h>
1818
#include <winrt/Windows.UI.h>
19+
#include "../Composition.Input.h"
1920
#include "../CompositionHelpers.h"
2021
#include "../RootComponentView.h"
2122
#include "JSValueReader.h"
@@ -213,15 +214,14 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
213214

214215
//@cmember Get mouse capture
215216
void TxSetCapture(BOOL fCapture) override {
216-
// assert(false);
217-
// TODO capture?
218-
/*
217+
auto mousePointer = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::Pointer>(
218+
winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType::Mouse, 1 /* 1 is Mouse PointerId*/);
219+
219220
if (fCapture) {
220-
::SetCapture(m_hwndHost);
221+
m_outer->CapturePointer(mousePointer);
221222
} else {
222-
::ReleaseCapture();
223+
m_outer->ReleasePointerCapture(mousePointer);
223224
}
224-
*/
225225
}
226226

227227
//@cmember Set the focus to the text window

0 commit comments

Comments
 (0)