@shower/core
Advanced tools
Comparing version 3.1.0 to 3.2.0
/** | ||
* Core for Shower HTML presentation engine | ||
* @shower/core v3.0.0, https://github.com/shower/core | ||
* @shower/core v3.1.0, https://github.com/shower/core | ||
* @copyright 2010–2021 Vadim Makeev, https://pepelsbey.net | ||
@@ -564,2 +564,37 @@ * @license MIT | ||
var touch = (shower) => { | ||
let exitFullScreen = false; | ||
let clickable = false; | ||
document.addEventListener('touchstart', (event) => { | ||
if (event.touches.length === 1) { | ||
const touch = event.touches[0]; | ||
const x = touch.clientX; | ||
const { target } = touch; | ||
clickable = target.tabIndex !== -1; | ||
if (!clickable) { | ||
if (shower.isFullMode) { | ||
if (event.cancelable) event.preventDefault(); | ||
if (window.innerWidth / 2 < x) { | ||
shower.next(); | ||
} else { | ||
shower.prev(); | ||
} | ||
} | ||
} | ||
} else if (event.touches.length === 3) { | ||
exitFullScreen = true; | ||
} | ||
}); | ||
shower.container.addEventListener('touchend', (event) => { | ||
if (exitFullScreen) { | ||
event.preventDefault(); | ||
exitFullScreen = false; | ||
shower.exitFullMode(); | ||
} else if (event.touches.length === 1 && !clickable && shower.isFullMode) | ||
event.preventDefault(); | ||
}); | ||
}; | ||
var installModules = (shower) => { | ||
@@ -574,2 +609,3 @@ a11y(shower); | ||
view(shower); | ||
touch(shower); | ||
@@ -576,0 +612,0 @@ // maintains invariant: active slide always exists in `full` mode |
@@ -9,2 +9,3 @@ import a11y from './a11y'; | ||
import view from './view'; | ||
import touch from './touch'; | ||
@@ -20,2 +21,3 @@ export default (shower) => { | ||
view(shower); | ||
touch(shower); | ||
@@ -22,0 +24,0 @@ // maintains invariant: active slide always exists in `full` mode |
{ | ||
"name": "@shower/core", | ||
"description": "Core for Shower HTML presentation engine", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"publishConfig": { | ||
@@ -28,16 +28,16 @@ "access": "public" | ||
"devDependencies": { | ||
"chai": "^4.3.0", | ||
"chai": "^4.3.4", | ||
"chromedriver": "^83.0.1", | ||
"eslint": "^7.21.0", | ||
"eslint": "^7.29.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"husky": "^4.3.8", | ||
"lint-staged": "^10.5.4", | ||
"mocha": "^7.2.0", | ||
"nightwatch": "^1.5.1", | ||
"prettier": "^2.2.1", | ||
"nightwatch": "^1.7.6", | ||
"prettier": "^2.3.1", | ||
"puppeteer": "^3.3.0", | ||
"rollup": "^2.40.0", | ||
"rollup": "^2.52.2", | ||
"sauce-connect-launcher": "^1.3.2", | ||
@@ -44,0 +44,0 @@ "serve": "^11.3.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49701
21
1305