WebGL_0007:强制横屏的参考
1,
var gt, vt = S.a.register("OrientationManager")(dt = function() { function t(t) { var e = this; ! function(t, e, n) { e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n }(this, "onResize", (function() { setTimeout((function() { var t = window.innerWidth, n = window.innerHeight, i = window.orientation || 0, a = e.app; "forceLandscape" === e.mode && 0 === i && t < n ? (e.setOrientation(90), e.setCanvasSize(n, t)) : (e.setOrientation(0), e.setCanvasSize(t, n)), a.renderNextFrame = a.globals.renderNextFrame, a.fire("orientation:resize", { width: t, height: n }) }), 100) })), this.app = t, this.orientation = 0, this.width = window.innerWidth, this.height = window.innerHeight, this._mode = "normal", this.onResize(), window.addEventListener("resize", this.onResize, !1), window.addEventListener("orientationchange", this.onResize, !1) } var e, n, i, a = t.prototype; return a.getOptions = function() { return { mode: ["normal", "forceLandscape"] } }, a.getState = function() { return { mode: this.mode } }, a.setState = function(t) { var e = this; return new Promise((function(n) { if (x()(t)) return n("[OrientationManager] Can not find data."); e.mode = t.mode, n("[OrientationManager] setState resolve") })) //WG 相机旋转 }, a.setOrientation = function(t) { var e = this.app.camera, n = e ? e.script.orbitCamera : null, i = this.app.graphicsDevice.canvas.parentElement, a = window.innerWidth, r = window.innerHeight; i && (0 === t ? (i.style.width = a + "px", i.style.height = r + "px", i.style.top = "0px", i.style.left = "0px", i.style.webkitTransformOrigin = "0% 0%", i.style.transformOrigin = "0% 0%", i.style.webkitTransform = "none", i.style.transform = "none") : (i.style.width = r + "px", i.style.height = a + "px", i.style.top = "0px", i.style.left = a + "px", i.style.webkitTransformOrigin = "0% 0%", i.style.transformOrigin = "0% 0%", i.style.webkitTransform = "rotate(90deg)", i.style.transform = "rotate(90deg)")), n && (n.orientation = t), this.app.fire("orientation:change", t) }, a.setCanvasSize = function(t, e) { var n = this.app, i = n.camera, a = n.graphicsDevice.canvas; n.graphicsDevice.maxPixelRatio; n.resizeCanvas(t, e), n.renderNextFrame = n.globals.renderNextFrame, i && i.picker && i.picker._picker && i.picker._picker.resize(a.width, a.height) }, e = t, (n = [{ key: "mode", get: function() { return this._mode }, set: function(t) { "normal" !== t && "forceLandscape" !== t || (this._mode = t, this.onResize()) } }, { key: "useForceLandscape", get: function() { return "forceLandscape" === this._mode && window.innerWidth < window.innerHeight } }]) && mt(e.prototype, n), i && mt(e, i), t }()) || dt, bt = n(79), yt = n(167), _t = n(29);
琥珀君的博客