diff --git a/assets/js/scene.js b/assets/js/scene.js index 13c7dd8..f0cc979 100644 --- a/assets/js/scene.js +++ b/assets/js/scene.js @@ -2,6 +2,10 @@ import { getScene } from "./api"; require("aframe"); +// Detect iOS devices +// There is probably a better way to handle issues there, but... +var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent); + // Define the element class QuackscapeScene extends HTMLElement { @@ -20,9 +24,9 @@ class QuackscapeScene extends HTMLElement { } } -document.addEventListener("contextmenu", function(event) { +document.addEventListener("contextmenu", function (event) { event.preventDefault(); -}) +}); customElements.define("quackscape-scene", QuackscapeScene); @@ -42,6 +46,10 @@ async function loadScene(scene_id, x = -1, y = -1, z = -1, destination = null) { var maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); + if (iOS) { + maxTextureSize = Math.min(8192, maxTextureSize); + } + // Get scene information from API getScene(scene_id).then((response) => { var scene = response.obj; @@ -119,11 +127,11 @@ async function loadScene(scene_id, x = -1, y = -1, z = -1, destination = null) { destination.appendChild(a_scene); // Dispatch a signal for the editor to pick up - const loaded_event = new CustomEvent('loadedQuackscapeScene'); + const loaded_event = new CustomEvent("loadedQuackscapeScene"); document.dispatchEvent(loaded_event); }); } window.loadScene = loadScene; -export { loadScene }; \ No newline at end of file +export { loadScene };