fixed #52 where click events were not detected due to the y axis beeing inverted on some graphics apis

pull/64/head
Jodok Huber 2019-11-15 14:47:29 +01:00
parent ec9712039c
commit 8588724900
1 changed files with 10 additions and 1 deletions

View File

@ -259,7 +259,16 @@ namespace Coffee.UIExtensions
}
int x = (int)((softMaskBuffer.width - 1) * Mathf.Clamp01(sp.x / Screen.width));
int y = (int)((softMaskBuffer.height - 1) * Mathf.Clamp01(sp.y / Screen.height));
int y = (int)((softMaskBuffer.height - 1) * (Mathf.Clamp01(sp.y / Screen.height)));
if ((SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11) ||
(SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4) ||
(SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan) ||
(SystemInfo.graphicsDeviceType == GraphicsDeviceType.Switch))
{
y = (int)((softMaskBuffer.height - 1) * (1 - Mathf.Clamp01(sp.y / Screen.height)));
}
return 0.5f < GetPixelValue(x, y, interactions);
}