fix #43; Pixels out of range may be read by raycaster

pull/55/head
mob-sakai 2019-03-16 17:08:33 +09:00
parent 8d0dec19ad
commit cd7f395a07
1 changed files with 2 additions and 2 deletions

View File

@ -239,8 +239,8 @@ namespace Coffee.UIExtensions
return true;
}
int x = (int)(softMaskBuffer.width * sp.x / Screen.width);
int y = (int)(softMaskBuffer.height * sp.y / Screen.height);
int x = (int)((softMaskBuffer.width - 1) * Mathf.Clamp01(sp.x / Screen.width));
int y = (int)((softMaskBuffer.height - 1) * Mathf.Clamp01(sp.y / Screen.height));
return 0.5f < GetPixelValue(x, y, interactions);
}