Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Commit 9d8a708

Browse files
committed
Merge branch 'zxw/support_editor_dragdrop' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/support_editor_dragdrop
2 parents c82648d + f3593d3 commit 9d8a708

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:74a8add2eb68589ffdde29bf411e53530415b618aaeee9a55fce80ad937aa4d9
3-
size 11260928
2+
oid sha256:31f3c8fade90589311b6ede144e1618ccfcc94e8d4692a0cdf07628b345d2aa2
3+
size 11260416

engine/src/shell/platform/unity/windows/uiwidgets_panel.cc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,32 @@ void UIWidgetsPanel::OnScroll(float x, float y, float px, float py) {
433433
}
434434
}
435435

436+
void UIWidgetsPanel::OnDragUpdateInEditor(float x, float y)
437+
{
438+
if (process_events_) {
439+
UIWidgetsPointerEvent event = {};
440+
event.x = x;
441+
event.y = y;
442+
SetEventPhaseFromCursorButtonState(&event);
443+
event.signal_kind = UIWidgetsPointerSignalKind::kUIWidgetsPointerSignalKindEditorDragUpdate;
444+
445+
SendPointerEventWithData(event);
446+
}
447+
}
448+
449+
void UIWidgetsPanel::OnDragReleaseInEditor(float x, float y)
450+
{
451+
if (process_events_) {
452+
UIWidgetsPointerEvent event = {};
453+
event.x = x;
454+
event.y = y;
455+
SetEventPhaseFromCursorButtonState(&event);
456+
event.signal_kind = UIWidgetsPointerSignalKind::kUIWidgetsPointerSignalKindEditorDragRelease;
457+
458+
SendPointerEventWithData(event);
459+
}
460+
}
461+
436462
static uint64_t ConvertToUIWidgetsButton(int button) {
437463
switch (button) {
438464
case -1:
@@ -569,4 +595,21 @@ UIWIDGETS_API(void)
569595
UIWidgetsPanel_onScroll(UIWidgetsPanel* panel, float x, float y, float px, float py) {
570596
panel->OnScroll(x, y, px, py);
571597
}
598+
599+
UIWIDGETS_API(void)
600+
UIWidgetsPanel_onDragUpdateInEditor(UIWidgetsPanel* panel, float x, float y) {
601+
if (!panel->NeedUpdateByEditorLoop()) {
602+
return;
603+
}
604+
panel->OnDragUpdateInEditor(x, y);
605+
}
606+
607+
UIWIDGETS_API(void)
608+
UIWidgetsPanel_onDragReleaseInEditor(UIWidgetsPanel* panel, float x, float y) {
609+
if (!panel->NeedUpdateByEditorLoop()) {
610+
return;
611+
}
612+
panel->OnDragReleaseInEditor(x, y);
613+
}
614+
572615
} // namespace uiwidgets

engine/src/shell/platform/unity/windows/uiwidgets_panel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ class UIWidgetsPanel : public fml::RefCountedThreadSafe<UIWidgetsPanel> {
6969

7070
void OnMouseLeave();
7171

72+
void OnDragUpdateInEditor(float x, float y);
73+
74+
void OnDragReleaseInEditor(float x, float y);
75+
76+
7277
bool NeedUpdateByPlayerLoop();
7378

7479
bool NeedUpdateByEditorLoop();

0 commit comments

Comments
 (0)