Merge pull request #51 from vadimkorr/feature/#47-add-disabling-swipe-by-prop
feature/#47 Add disabling swipe by prop
This commit is contained in:
@@ -47,6 +47,7 @@ Import component
|
|||||||
| `autoplayProgressVisible` | `boolean` | `false` | Show autoplay duration progress indicator |
|
| `autoplayProgressVisible` | `boolean` | `false` | Show autoplay duration progress indicator |
|
||||||
| `dots` | `boolean` | `true` | Current page indicator dots |
|
| `dots` | `boolean` | `true` | Current page indicator dots |
|
||||||
| `timingFunction` | `string` | `'ease-in-out'` | CSS animation timing function |
|
| `timingFunction` | `string` | `'ease-in-out'` | CSS animation timing function |
|
||||||
|
| `swiping` | `boolean` | `true` | Enable swiping |
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,11 @@
|
|||||||
*/
|
*/
|
||||||
export let dots = true
|
export let dots = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable swiping
|
||||||
|
*/
|
||||||
|
export let swiping = true
|
||||||
|
|
||||||
export async function goTo(pageIndex, options) {
|
export async function goTo(pageIndex, options) {
|
||||||
const animated = get(options, 'animated', true)
|
const animated = get(options, 'animated', true)
|
||||||
if (typeof pageIndex !== 'number') {
|
if (typeof pageIndex !== 'number') {
|
||||||
@@ -281,15 +286,19 @@
|
|||||||
|
|
||||||
// gestures
|
// gestures
|
||||||
function handleSwipeStart() {
|
function handleSwipeStart() {
|
||||||
|
if (!swiping) return
|
||||||
_duration = 0
|
_duration = 0
|
||||||
}
|
}
|
||||||
async function handleThreshold(event) {
|
async function handleThreshold(event) {
|
||||||
|
if (!swiping) return
|
||||||
await directionFnDescription[event.detail.direction]()
|
await directionFnDescription[event.detail.direction]()
|
||||||
}
|
}
|
||||||
function handleSwipeMove(event) {
|
function handleSwipeMove(event) {
|
||||||
|
if (!swiping) return
|
||||||
offset += event.detail.dx
|
offset += event.detail.dx
|
||||||
}
|
}
|
||||||
function handleSwipeEnd() {
|
function handleSwipeEnd() {
|
||||||
|
if (!swiping) return
|
||||||
showPage(currentPageIndex)
|
showPage(currentPageIndex)
|
||||||
}
|
}
|
||||||
function handleFocused(event) {
|
function handleFocused(event) {
|
||||||
|
|||||||
@@ -56,6 +56,11 @@
|
|||||||
*/
|
*/
|
||||||
export let dots = true
|
export let dots = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable swiping
|
||||||
|
*/
|
||||||
|
export let swiping = true
|
||||||
|
|
||||||
const colors = [
|
const colors = [
|
||||||
{ color: '#e5f9f0', text: '0' },
|
{ color: '#e5f9f0', text: '0' },
|
||||||
{ color: '#ccf3e2', text: '1' },
|
{ color: '#ccf3e2', text: '1' },
|
||||||
@@ -89,6 +94,7 @@
|
|||||||
{pauseOnFocus}
|
{pauseOnFocus}
|
||||||
{autoplayProgressVisible}
|
{autoplayProgressVisible}
|
||||||
{dots}
|
{dots}
|
||||||
|
{swiping}
|
||||||
on:pageChange={
|
on:pageChange={
|
||||||
event => console.log(`Current page index: ${event.detail}`)
|
event => console.log(`Current page index: ${event.detail}`)
|
||||||
}
|
}
|
||||||
@@ -115,6 +121,7 @@
|
|||||||
{pauseOnFocus}
|
{pauseOnFocus}
|
||||||
{autoplayProgressVisible}
|
{autoplayProgressVisible}
|
||||||
{dots}
|
{dots}
|
||||||
|
{swiping}
|
||||||
>
|
>
|
||||||
{#each colors2 as { color, text } (color)}
|
{#each colors2 as { color, text } (color)}
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -56,6 +56,11 @@
|
|||||||
*/
|
*/
|
||||||
export let dots = true
|
export let dots = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable swiping
|
||||||
|
*/
|
||||||
|
export let swiping = true
|
||||||
|
|
||||||
const colors = [
|
const colors = [
|
||||||
'#e5f9f0',
|
'#e5f9f0',
|
||||||
'#ccf3e2',
|
'#ccf3e2',
|
||||||
@@ -83,6 +88,7 @@
|
|||||||
{pauseOnFocus}
|
{pauseOnFocus}
|
||||||
{autoplayProgressVisible}
|
{autoplayProgressVisible}
|
||||||
{dots}
|
{dots}
|
||||||
|
{swiping}
|
||||||
let:showPrevPage
|
let:showPrevPage
|
||||||
let:showNextPage
|
let:showNextPage
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -56,6 +56,11 @@
|
|||||||
*/
|
*/
|
||||||
export let dots = true
|
export let dots = true
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable swiping
|
||||||
|
*/
|
||||||
|
export let swiping = true
|
||||||
|
|
||||||
function onPageChange(event, showPage) {
|
function onPageChange(event, showPage) {
|
||||||
showPage(Number(event.target.value))
|
showPage(Number(event.target.value))
|
||||||
}
|
}
|
||||||
@@ -87,6 +92,7 @@
|
|||||||
{pauseOnFocus}
|
{pauseOnFocus}
|
||||||
{autoplayProgressVisible}
|
{autoplayProgressVisible}
|
||||||
{dots}
|
{dots}
|
||||||
|
{swiping}
|
||||||
let:currentPageIndex
|
let:currentPageIndex
|
||||||
let:pagesCount
|
let:pagesCount
|
||||||
let:showPage
|
let:showPage
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ Import component
|
|||||||
| `autoplayProgressVisible` | `boolean` | `false` | Show autoplay duration progress indicator |
|
| `autoplayProgressVisible` | `boolean` | `false` | Show autoplay duration progress indicator |
|
||||||
| `dots` | `boolean` | `true` | Current page indicator dots |
|
| `dots` | `boolean` | `true` | Current page indicator dots |
|
||||||
| `timingFunction` | `string` | `'ease-in-out'` | CSS animation timing function |
|
| `timingFunction` | `string` | `'ease-in-out'` | CSS animation timing function |
|
||||||
|
| `swiping` | `boolean` | `true` | Enable swiping |
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user