Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Slider - Swipe issue by updating distance and threshold check #90

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/accordion/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
tp-accordion {
display: block;
}

tp-accordion-expand-all,
tp-accordion-collapse-all {
display: inline-block;
}

tp-accordion-item {
display: block;
}

tp-accordion-handle {
display: block;
}

tp-accordion-content {
display: block;
height: 0;
overflow: hidden;
transition-property: height;
transition-duration: 0.6s;
transition-timing-function: ease;
}
tp-accordion-item[open-by-default=yes] tp-accordion-content {
display: block;
height: auto;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/accordion/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/form/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/form/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions src/lightbox/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
:root:has(tp-lightbox dialog[open]) {
overflow: clip;
}

@keyframes show-tp-lightbox {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
tp-lightbox dialog {
border: 0;
padding: 0;
}
tp-lightbox dialog[open] {
animation-name: show-tp-lightbox;
animation-duration: 0.5s;
animation-timing-function: ease-in-out;
}
tp-lightbox dialog::backdrop {
background: rgba(0, 0, 0, 0.6);
}

tp-lightbox-content {
display: block;
position: relative;
}

tp-lightbox[loading] tp-lightbox-content::after {
position: absolute;
content: "Loading...";
z-index: 5;
top: 50px;
left: 50px;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/lightbox/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions src/modal/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
tp-modal {
display: none;
background-color: rgba(0, 0, 0, 0.5);
-webkit-backdrop-filter: blur(2px);
backdrop-filter: blur(2px);
position: fixed;
height: 100%;
width: 100%;
left: 0;
top: 0;
z-index: 99;
max-width: 100%;
overflow-y: auto;
padding: 20px;
box-sizing: border-box;
}
tp-modal[open] {
display: flex;
}
tp-modal-close {
position: absolute;
top: 20px;
right: 20px;
}
tp-modal-content {
display: block;
min-width: 0;
margin: auto;
padding: 20px;
background-color: #fff;
max-width: 80ch;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/modal/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions src/multi-select/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
tp-multi-select {
display: block;
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
tp-multi-select select {
visibility: hidden;
position: absolute;
}

tp-multi-select-field {
display: flex;
flex-wrap: wrap;
}

tp-multi-select-options {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background-color: #fff;
z-index: 2;
}
tp-multi-select[open=yes] tp-multi-select-options {
display: block;
}

tp-multi-select-option {
display: block;
}
tp-multi-select-option[hidden=yes] {
display: none;
}
tp-multi-select-option[disabled=yes] {
opacity: 0.5;
cursor: not-allowed;
}
tp-multi-select-option[disabled=yes]:active {
pointer-events: none;
}

tp-multi-select-placeholder {
display: block;
}
tp-multi-select[selected=yes] tp-multi-select-placeholder {
display: none;
}

tp-multi-select-status {
display: none;
}
tp-multi-select[selected=yes] tp-multi-select-status {
display: block;
}

tp-multi-select-search input {
box-sizing: border-box;
border: 0;
outline: none;
min-width: 3ch;
}

tp-multi-select-pills {
display: inline-block;
}

tp-multi-select-select-all {
display: block;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/multi-select/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/number-spinner/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tp-number-spinner {
display: contents;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/number-spinner/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions src/slider/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
tp-slider {
display: block;
}

tp-slider-track {
display: block;
overflow-y: visible;
overflow-x: clip;
position: relative;
}

tp-slider-slides {
position: relative;
display: flex;
align-items: flex-start;
}
tp-slider:not([resizing=yes]) tp-slider-slides {
transition-duration: 0.6s;
transition-timing-function: cubic-bezier(0.42, 0, 0.58, 1);
}

tp-slider-slide {
flex: 0 0 100%;
scroll-snap-align: start;
}
tp-slider[flexible-height=yes]:not([initialized]) tp-slider-slide:not(:first-child) {
display: none;
}

tp-slider-nav {
display: flex;
gap: 10px;
}

tp-slider[behaviour=fade] {
/**
* We are using first of type and direct child here
* so that if there is a nested slider it does not affect
* the styles for the inner slider and is only applied to the
* parent.
*/
}
tp-slider[behaviour=fade] tp-slider-slides:first-of-type {
display: block;
}
tp-slider[behaviour=fade] tp-slider-slides:first-of-type > tp-slider-slide {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: auto;
transition-property: opacity, visibility;
transition-duration: 0.6s;
transition-timing-function: ease;
visibility: hidden;
opacity: 0;
}
tp-slider[behaviour=fade] tp-slider-slides:first-of-type > tp-slider-slide[active=yes] {
visibility: visible;
opacity: 1;
z-index: 1;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/slider/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions src/slider/tp-slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,17 +616,13 @@ export class TPSliderElement extends HTMLElement {
return;
}

// Check if it's a right or left swipe.
if ( swipeDistanceX > 0 ) {
// Right-Swipe: Check if horizontal swipe distance is less than the threshold.
if ( swipeDistanceX < this.swipeThreshold ) {
this.previous();
}
} else if ( swipeDistanceX < 0 ) {
// Left-Swipe: Check if horizontal swipe distance is less than the threshold.
if ( swipeDistanceX > -this.swipeThreshold ) {
this.next();
}
// Check if the swipe distance is positive (right swipe) and exceeds the threshold.
if ( swipeDistanceX > 0 && swipeDistanceX > this.swipeThreshold ) {
// Trigger the "previous" action for a right swipe that meets the threshold.
this.previous();
} else if ( swipeDistanceX < 0 && Math.abs( swipeDistanceX ) > this.swipeThreshold ) {
// Trigger the "next" action for a left swipe that meets the threshold.
this.next();
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/tabs/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tp-tabs-tab {
display: none;
}
tp-tabs-tab[open=yes] {
display: block;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/tabs/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/toggle-attribute/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tp-toggle-attribute {
display: contents;
}/*# sourceMappingURL=style.css.map */
1 change: 1 addition & 0 deletions src/toggle-attribute/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.