mouse-drag camera and clickable umg interface

Hello, I’m programming PlayerController working in typical MMO style, kinda like in WoW. Right now I’m just binding mouse button action to set flag and hide cursor. In same way release switches cursor back on and changes input mode.

InputComponent->BindAction("Look", IE_Pressed, this, &ATPPlayerController::LookPress);
InputComponent->BindAction("Look", IE_Released, this, &ATPPlayerController::LookRelease);

void ATPPlayerController::LookPress() {
	LookDrag = true;

void ATPPlayerController::LookRelease() {
	LookDrag = false;

void ATPPlayerController::ManageCursor() {
	if (bShowMouseCursor) {
		if (LookDrag || TurnDrag) {
			bShowMouseCursor = false;
			bEnableClickEvents = false;
			bEnableMouseOverEvents = false;
	else {
		if (!LookDrag && !TurnDrag) {
			bShowMouseCursor = true;
			bEnableClickEvents = true;
			bEnableMouseOverEvents = true;

That way however requires me to somehow detect if mouse press occured over UI, otherwise I can’t interact with it.
So is there any good way to detect if mouse press occured over ui element, or maybe there is a better method for what I want to achieve?

Okay, I kinda overcomplicated trying to switch input mode to gameonly on mouse down. Keeping my input mode to Game and UI seems to be just what I needed.