WM: add support for drag events

This allows for a single key to be mapped to both release and drag,
useful for pie menus to share a key with a different action.
This commit is contained in:
2018-06-07 17:05:49 +02:00
parent df4525d1d9
commit d274c64d22
4 changed files with 39 additions and 3 deletions

View File

@@ -150,8 +150,16 @@ uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, co
}
pie->layout = UI_block_layout(pie->block_radial, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style);
pie->mx = event->x;
pie->my = event->y;
/* Open from where we started dragging. */
if (event->val == KM_CLICK_DRAG) {
pie->mx = event->prevclickx;
pie->my = event->prevclicky;
}
else {
pie->mx = event->x;
pie->my = event->y;
}
/* create title button */
if (title[0]) {