Skip to content

Commit 04d7f40

Browse files
committed
TextInput should capture mouse on mouse down (microsoft#14983)
* TextInput should capture mouse on mouse down * Change files * format
1 parent b0cd6ed commit 04d7f40

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": "30809111+acoates-ms@users.noreply.github.com",
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
@@ -787,7 +787,7 @@ struct CompScrollerVisual : winrt::implements<
787787
m_horizontal ? TTypeRedirects::InteractionSourceMode::Disabled
788788
: TTypeRedirects::InteractionSourceMode::EnabledWithInertia);
789789
m_visualInteractionSource.ManipulationRedirectionMode(
790-
TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
790+
TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadOnly);
791791
} else {
792792
m_visualInteractionSource.PositionXSourceMode(TTypeRedirects::InteractionSourceMode::Disabled);
793793
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
@@ -14,6 +14,7 @@
1414
#include <winrt/Microsoft.UI.Input.h>
1515
#include <winrt/Windows.System.h>
1616
#include <winrt/Windows.UI.h>
17+
#include "../Composition.Input.h"
1718
#include "../CompositionHelpers.h"
1819
#include "../RootComponentView.h"
1920
#include "JSValueReader.h"
@@ -212,15 +213,14 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
212213

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

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

0 commit comments

Comments
 (0)