voxel / voxel-webview

embed webpages in a voxel.js world using CSS 3D (voxel.js plugin)
15 stars 2 forks source link

Clicking outside of entered website to release fails, accesses obsolete interact property #10

Closed deathcap closed 9 years ago

deathcap commented 9 years ago

Load a voxel world with voxel-webview enabled, then use .web to "enter" the website (mouse interaction, GH-1). Click outside of the website in an attempt to return back to the game. Crashes on self.game.interact.request():

  window.addEventListener('click', this.onClick = function(ev) {
    // click anywhere outside of iframe to exit TODO: what if it fills the entire screen? (alternate escape hatch)
    // (we won't receive click events for the iframe here)
    // TODO: register on WebGL canvas element instead?
    //  tried this.game.view.renderer.domElement but didn't receive events

    if (document.getElementById('voxel-webview').parentElement.parentElement.style.zIndex === '0') {
      document.getElementById('voxel-webview').parentElement.parentElement.style.zIndex = '-1';
      self.game.interact.request();
    }
  });

need to replace with new alternative to relinquish control. New bug in 0.2.0, worked in 0.1.0 (three.js-based)