private void OnMouseOver()
{
if (!WebCore.IsRunning)
return;
RaycastHit hit;
// Used for injecting a MouseMove event on a game object
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
{
int x = (int)(hit.textureCoord.x * width);
int y = (int)(hit.textureCoord.y * height);
webView.InjectMouseMove(x, height - y);
}
else // Used for injecting a MouseMove event on a GUITexture
{
GUITexture gui = GetComponent(typeof(GUITexture)) as GUITexture;
if (gui != null)
{
int x = (int)((Input.mousePosition.x) - (gui.pixelInset.x + Screen.width * transform.position.x));
int y = (int)((Input.mousePosition.y) - (gui.pixelInset.y + Screen.height * transform.position.y));
webView.InjectMouseMove(x, height - y);
}
}
}