[windows] mouse move & drag drop support

This commit is contained in:
Prome
2022-10-08 21:07:30 +08:00
parent 1f1cb7e149
commit 84c695635e
2 changed files with 12 additions and 2 deletions

View File

@@ -85,7 +85,7 @@ class WebViewController extends ValueNotifier<bool> {
}
assert(value);
return _pluginChannel
.invokeMethod('cursorMove', [position.dx, position.dy]);
.invokeMethod('cursorMove', [position.dx.round(), position.dy.round()]);
}
Future<void> _cursorDragging(Offset position) async {
@@ -94,7 +94,7 @@ class WebViewController extends ValueNotifier<bool> {
}
assert(value);
return _pluginChannel
.invokeMethod('cursorDragging', [position.dx, position.dy]);
.invokeMethod('cursorDragging', [position.dx.round(), position.dy.round()]);
}
Future<void> _cursorClickDown(Offset position) async {

View File

@@ -195,6 +195,16 @@ namespace webview_cef {
handler.get()->cursorClick(point->first, point->second, true);
result->Success();
}
else if (method_call.method_name().compare("cursorMove") == 0) {
const auto point = GetPointFromArgs(method_call.arguments());
handler.get()->cursorMove(point->first, point->second, false);
result->Success();
}
else if (method_call.method_name().compare("cursorDragging") == 0) {
const auto point = GetPointFromArgs(method_call.arguments());
handler.get()->cursorMove(point->first, point->second, true);
result->Success();
}
else if (method_call.method_name().compare("setScrollDelta") == 0) {
const flutter::EncodableList* list =
std::get_if<flutter::EncodableList>(method_call.arguments());