提交 3624c32f 编写于 作者: S siyangy 提交者: Jiangtao Hu

Dreamview: Improve ipad frontend perf

上级 f2ccdce4
......@@ -15,9 +15,12 @@ import RoutingEditor from "renderer/routing_editor.js";
class Renderer {
constructor() {
// Disable antialias for mobile devices.
const useAntialias = !this.isMobileDevice();
this.coordinates = new Coordinates();
this.renderer = new THREE.WebGLRenderer({
preserveDrawingBuffer: true, antialias: true
antialias: useAntialias
});
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color(0x031C31);
......@@ -288,6 +291,7 @@ class Renderer {
requestAnimationFrame(() => {
this.animate();
});
this.render();
}
......@@ -310,6 +314,14 @@ class Renderer {
this.map.updateIndex(hash, elementIds, this.scene);
}
}
isMobileDevice() {
return navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i);
}
}
const RENDERER = new Renderer();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册