Pass mouseevents from Iframe to unity application (WebGL)
In my programm I have detailwindows that can be opened and that contains information such as a diagram which shows different information.
This diagramm exists in form of html-code that contains Javascript.
For the WebGL Build I have a special template that helps me to instantiate Javascript Iframes using html code.
function generateWindow(windowId, html, width, height)
{
var div = document.createElement("div");
div.id = windowId;
div.style.width = width + "px";
div.style.height = height + "px";
div.style.zIndex = "100";
div.style.position = "absolute";
document.body.appendChild(div);
var iframe = document.createElement("iframe");
iframe.id = windowId + "iframe";
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.frameBorder = 0;
div.appendChild(iframe);
iframe.src = "JavaScript:''" ;
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(html);
iframe.contentWindow.document.close();
}
The Iframe itself works fine. There are also scripts that make this Iframe follow the detailwindow (so that everything looks realistic).
The Problem that I have is that the Iframe absorbs all clicks and mouse events that it receives. As a consequence I can't move the detailwindow downwards because the drag-area (at the top of the window) is very small and the Iframe-Diagram starts right below.
As soon as I start dragging the window and hit the Iframe, the dragging stops immedietly.
How can I make the mouseevents pass through the Iframe onto the Unity Application (in WebGL)?
The best thing would be If those events would be copied instead of just being forwarded because the diagram on the Iframe is interactive and also reacts to mouseevents