Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit ca9e90b

Browse files
committed
added decelation factor for pull to refresh
1 parent c23e273 commit ca9e90b

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

_includes/dependencies-js-blog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
</script>
1717
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_SVG"></script>
1818
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
19-
<script type="text/javascript" src="/assets/js/index.blog.min.js?rev=6765c18b2245dadac96ecdf2c0786a63"></script>
19+
<script type="text/javascript" src="/assets/js/index.blog.min.js?rev=a155500f2a958119ba19c2b4b967fb7f"></script>
2020
{%include service-worker.html %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"/assets/js/index.blog.min.js?rev=6765c18b2245dadac96ecdf2c0786a63",
1+
"/assets/js/index.blog.min.js?rev=a155500f2a958119ba19c2b4b967fb7f",

_js/blog/pull-to-refresh.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const pullToRefresh = (): void => {
1919

2020
const pullToRefreshElementHeight: number = pullToRefreshElement.offsetHeight
2121
const pullToRefreshStatusRepository = createPullToRefreshStatusRepository()
22+
const decelerationFactor = 0.5
2223
let dragStartPoint = createTouchCoordinates(0, 0)
2324

2425
const dragUpdate = (dragMovement: number, pullToRefreshLoaderOpacity: number): void => {
@@ -74,7 +75,7 @@ const pullToRefresh = (): void => {
7475

7576
document.addEventListener('touchmove', (event: TouchEvent) => {
7677
const dragCurrentPoint = getTouchesCoordinatesFrom(event)
77-
const yMovement: number = dragStartPoint.y - dragCurrentPoint.y
78+
const yMovement: number = (dragStartPoint.y - dragCurrentPoint.y) * decelerationFactor
7879
const yAbsoluteMovement: number = Math.abs(yMovement)
7980

8081
if (isDraggingForPullToRefresh(yMovement) && !pullToRefreshStatusRepository.refreshStarted) {

_jsbuild/blog/pull-to-refresh.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const pullToRefresh = () => {
1919

2020
const pullToRefreshElementHeight = pullToRefreshElement.offsetHeight
2121
const pullToRefreshStatusRepository = createPullToRefreshStatusRepository()
22+
const decelerationFactor = 0.5
2223
let dragStartPoint = createTouchCoordinates(0, 0)
2324

2425
const dragUpdate = (dragMovement, pullToRefreshLoaderOpacity) => {
@@ -74,7 +75,7 @@ const pullToRefresh = () => {
7475

7576
document.addEventListener('touchmove', (event) => {
7677
const dragCurrentPoint = getTouchesCoordinatesFrom(event)
77-
const yMovement = dragStartPoint.y - dragCurrentPoint.y
78+
const yMovement = (dragStartPoint.y - dragCurrentPoint.y) * decelerationFactor
7879
const yAbsoluteMovement = Math.abs(yMovement)
7980

8081
if (isDraggingForPullToRefresh(yMovement) && !pullToRefreshStatusRepository.refreshStarted) {

assets/js/index.blog.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)