| 1 |
import { SUPPORT_POINTER_EVENTS,SUPPORT_ONLY_TOUCH,SUPPORT_TOUCH } from './input-consts'; |
| 2 |
import inputHandler from './input-handler'; |
| 3 |
import PointerEventInput from '../input/pointerevent'; |
| 4 |
import TouchInput from '../input/touch'; |
| 5 |
import MouseInput from '../input/mouse'; |
| 6 |
import TouchMouseInput from '../input/touchmouse'; |
| 7 |
|
| 8 |
/** |
| 9 |
* @private |
| 10 |
* create new input type manager |
| 11 |
* called by the Manager constructor |
| 12 |
* @param {Hammer} manager |
| 13 |
* @returns {Input} |
| 14 |
*/ |
| 15 |
export default function createInputInstance(manager) { |
| 16 |
let Type; |
| 17 |
// let inputClass = manager.options.inputClass; |
| 18 |
let { options:{ inputClass } } = manager; |
| 19 |
if (inputClass) { |
| 20 |
Type = inputClass; |
| 21 |
} else if (SUPPORT_POINTER_EVENTS) { |
| 22 |
Type = PointerEventInput; |
| 23 |
} else if (SUPPORT_ONLY_TOUCH) { |
| 24 |
Type = TouchInput; |
| 25 |
} else if (!SUPPORT_TOUCH) { |
| 26 |
Type = MouseInput; |
| 27 |
} else { |
| 28 |
Type = TouchMouseInput; |
| 29 |
} |
| 30 |
return new (Type)(manager, inputHandler); |
| 31 |
} |