0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-17 14:54:30 +01:00

carousel: switch to string constants (#32393)

This commit is contained in:
XhmikosR 2020-12-11 16:12:13 +02:00 committed by GitHub
parent 62eb5a3232
commit 93ab072027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,10 +92,8 @@ const SELECTOR_INDICATORS = '.carousel-indicators'
const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'
const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'
const PointerType = {
TOUCH: 'touch',
PEN: 'pen'
}
const POINTER_TYPE_TOUCH = 'touch'
const POINTER_TYPE_PEN = 'pen'
/**
* ------------------------------------------------------------------------
@ -278,7 +276,7 @@ class Carousel extends BaseComponent {
_addTouchEventListeners() {
const start = event => {
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
this.touchStartX = event.clientX
} else if (!this._pointerEvent) {
this.touchStartX = event.touches[0].clientX
@ -295,7 +293,7 @@ class Carousel extends BaseComponent {
}
const end = event => {
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
this.touchDeltaX = event.clientX - this.touchStartX
}