UNPKG

dragonbones-runtime

Version:

the tools to build dragonbones file for diffrent framework

37 lines (32 loc) 887 B
namespace egret.web { /** * @private */ export class WebDeviceOrientation extends EventDispatcher implements DeviceOrientation { /** * @private * */ start() { window.addEventListener("deviceorientation", this.onChange); } /** * @private * */ stop() { window.removeEventListener("deviceorientation", this.onChange); } /** * @private */ protected onChange = (e: DeviceOrientationEvent) => { let event = new OrientationEvent(Event.CHANGE); event.beta = e.beta; event.gamma = e.gamma; event.alpha = e.alpha; this.dispatchEvent(event); } } } egret.DeviceOrientation = egret.web.WebDeviceOrientation;