UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.05 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as n,subclass as o}from"../../../core/accessorSupport/decorators.js";const p={standard:.15,spacemouse:.025,unknown:0},r=new RegExp("^(3dconnexion|space(mouse|navigator|pilot|explorer))","i");function s(e){return"standard"===e.mapping?"standard":r.test(e.id)?"spacemouse":"unknown"}let a=class extends t{constructor(e){super(e),this._deviceType=null,this._gamepadIndex=null}get axisThreshold(){return p[this.deviceType]}get deviceType(){return this._deviceType??"unknown"}set gamepad(e){this._deviceType=s(e),this._gamepadIndex=e.index}get native(){return navigator.getGamepads()[this._gamepadIndex??-1]}};e([n()],a.prototype,"_deviceType",void 0),e([n({type:Number})],a.prototype,"axisThreshold",null),e([n({type:String})],a.prototype,"deviceType",null),e([n({constructOnly:!0})],a.prototype,"gamepad",null),a=e([o("esri.views.input.gamepad.GamepadInputDevice")],a);const i=a;export{i as default};