unika-components 1.1.112 → 1.1.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30808,7 +30808,6 @@ var script = defineComponent({
|
|
|
30808
30808
|
const scrollStartTime = ref(0);
|
|
30809
30809
|
const scrollStartPosition = ref(0);
|
|
30810
30810
|
const isDragging = ref(false);
|
|
30811
|
-
const isInteractingWithComponent = ref(false);
|
|
30812
30811
|
const clickStartTime = ref(0);
|
|
30813
30812
|
const clickStartY = ref(0);
|
|
30814
30813
|
const isUserPaused = ref(false);
|
|
@@ -30970,6 +30969,7 @@ var script = defineComponent({
|
|
|
30970
30969
|
// handleTouchMove = function() { ... }
|
|
30971
30970
|
// ...
|
|
30972
30971
|
handleTouchStart = (e) => {
|
|
30972
|
+
console.log('handleTouchStart');
|
|
30973
30973
|
const pageId = currentPageId.value;
|
|
30974
30974
|
if (!container.value)
|
|
30975
30975
|
return;
|
|
@@ -31004,6 +31004,7 @@ var script = defineComponent({
|
|
|
31004
31004
|
dragStartScrolls.value[pageId] = 0;
|
|
31005
31005
|
}
|
|
31006
31006
|
handleTouchMove = (e) => {
|
|
31007
|
+
console.log('handleTouchMove');
|
|
31007
31008
|
e.preventDefault();
|
|
31008
31009
|
const pageId = currentPageId.value;
|
|
31009
31010
|
if (!container.value)
|
|
@@ -31039,8 +31040,9 @@ var script = defineComponent({
|
|
|
31039
31040
|
}
|
|
31040
31041
|
};
|
|
31041
31042
|
handleTouchEnd = (e) => {
|
|
31043
|
+
console.log('handleTouchEnd');
|
|
31042
31044
|
currentPageId.value;
|
|
31043
|
-
if (!container.value
|
|
31045
|
+
if (!container.value)
|
|
31044
31046
|
return;
|
|
31045
31047
|
isDragging.value = false;
|
|
31046
31048
|
if (inertiaAnimation.value) {
|
|
@@ -31052,7 +31054,25 @@ var script = defineComponent({
|
|
|
31052
31054
|
startInertia();
|
|
31053
31055
|
}
|
|
31054
31056
|
};
|
|
31057
|
+
handleMouseDown = (e) => {
|
|
31058
|
+
console.log('handleMouseDown');
|
|
31059
|
+
const pageId = currentPageId.value;
|
|
31060
|
+
isMousePressing.value = true;
|
|
31061
|
+
if (!container.value)
|
|
31062
|
+
return;
|
|
31063
|
+
if (inertiaAnimation.value) {
|
|
31064
|
+
cancelAnimationFrame(inertiaAnimation.value);
|
|
31065
|
+
inertiaAnimation.value = undefined;
|
|
31066
|
+
}
|
|
31067
|
+
dragStartYs.value[pageId] = e.clientY;
|
|
31068
|
+
dragStartScrolls.value[pageId] = scrollPositions.value[pageId] || 0;
|
|
31069
|
+
isDragging.value = false;
|
|
31070
|
+
clickStartTime.value = Date.now();
|
|
31071
|
+
clickStartY.value = e.clientY;
|
|
31072
|
+
scrollVelocity.value = 0;
|
|
31073
|
+
};
|
|
31055
31074
|
handleMouseMove = (e) => {
|
|
31075
|
+
console.log('handleMouseMove');
|
|
31056
31076
|
e.preventDefault && e.preventDefault();
|
|
31057
31077
|
const pageId = currentPageId.value;
|
|
31058
31078
|
if (!isMousePressing.value)
|
|
@@ -31061,55 +31081,46 @@ var script = defineComponent({
|
|
|
31061
31081
|
return;
|
|
31062
31082
|
const mouseY = e.clientY;
|
|
31063
31083
|
const deltaY = (mouseY - dragStartYs.value[pageId]) * speedFactor;
|
|
31064
|
-
// 添加拖动阈值判断
|
|
31065
|
-
if (!isDragging.value && Math.abs(deltaY) < 5) {
|
|
31066
|
-
return;
|
|
31067
|
-
}
|
|
31068
31084
|
const now = Date.now();
|
|
31069
31085
|
const timeDiff = now - lastScrollTime.value;
|
|
31070
31086
|
if (timeDiff > 0) {
|
|
31071
31087
|
scrollVelocity.value = -deltaY / timeDiff;
|
|
31072
31088
|
}
|
|
31073
31089
|
lastScrollTime.value = now;
|
|
31074
|
-
if (
|
|
31090
|
+
if (Math.abs(deltaY) > 1) {
|
|
31075
31091
|
isDragging.value = true;
|
|
31076
31092
|
}
|
|
31077
31093
|
const maxScroll = maxScrollPositions.value[pageId] || 0;
|
|
31078
31094
|
let nextScroll = dragStartScrolls.value[pageId] - deltaY;
|
|
31079
|
-
//
|
|
31080
|
-
|
|
31081
|
-
if (isDragging.value) {
|
|
31082
|
-
// 在内容区域内正常滚动
|
|
31083
|
-
if (nextScroll > -edgeThreshold && nextScroll < maxScroll + edgeThreshold) {
|
|
31084
|
-
stopAutoScroll(true);
|
|
31085
|
-
scrollPositions.value[pageId] = Math.max(0, Math.min(nextScroll, maxScroll));
|
|
31086
|
-
}
|
|
31087
|
-
// 超出底部,准备翻页但不要立即触发
|
|
31088
|
-
else if (nextScroll >= maxScroll + edgeThreshold) {
|
|
31089
|
-
scrollPositions.value[pageId] = maxScroll + edgeThreshold * 0.3; // 增加一些阻力
|
|
31090
|
-
}
|
|
31091
|
-
// 超出顶部,准备翻页但不要立即触发
|
|
31092
|
-
else if (nextScroll <= -edgeThreshold) {
|
|
31093
|
-
scrollPositions.value[pageId] = -edgeThreshold * 0.3; // 增加一些阻力
|
|
31094
|
-
}
|
|
31095
|
-
}
|
|
31096
|
-
};
|
|
31097
|
-
handleMouseUp = (e) => {
|
|
31098
|
-
const pageId = currentPageId.value;
|
|
31099
|
-
const maxScroll = maxScrollPositions.value[pageId] || 0;
|
|
31100
|
-
const currentScroll = scrollPositions.value[pageId] || 0;
|
|
31101
|
-
// 检查是否需要翻页
|
|
31102
|
-
if (currentScroll >= maxScroll + 40) { // 翻页阈值比拖动时小
|
|
31095
|
+
// 超出底部,翻到下一页
|
|
31096
|
+
if ((maxScroll === 0 && deltaY < -40) || nextScroll > maxScroll + 60) {
|
|
31103
31097
|
goToNextPage();
|
|
31098
|
+
resetDragState(pageId);
|
|
31099
|
+
return;
|
|
31104
31100
|
}
|
|
31105
|
-
|
|
31101
|
+
// 超出顶部,翻到上一页
|
|
31102
|
+
if ((maxScroll === 0 && deltaY > 40) || nextScroll < -60) {
|
|
31106
31103
|
goToPrevPage();
|
|
31104
|
+
resetDragState(pageId);
|
|
31105
|
+
return;
|
|
31107
31106
|
}
|
|
31108
|
-
|
|
31109
|
-
|
|
31107
|
+
if (isDragging.value) {
|
|
31108
|
+
stopAutoScroll(true);
|
|
31109
|
+
scrollPositions.value[pageId] = Math.max(0, Math.min(nextScroll, maxScroll));
|
|
31110
31110
|
}
|
|
31111
|
+
};
|
|
31112
|
+
handleMouseUp = (e) => {
|
|
31113
|
+
console.log('handleMouseUp');
|
|
31111
31114
|
isMousePressing.value = false;
|
|
31112
31115
|
isDragging.value = false;
|
|
31116
|
+
if (inertiaAnimation.value) {
|
|
31117
|
+
cancelAnimationFrame(inertiaAnimation.value);
|
|
31118
|
+
inertiaAnimation.value = undefined;
|
|
31119
|
+
}
|
|
31120
|
+
// 惯性滚动
|
|
31121
|
+
if (Math.abs(scrollVelocity.value) > 0.1) {
|
|
31122
|
+
startInertia();
|
|
31123
|
+
}
|
|
31113
31124
|
};
|
|
31114
31125
|
handleMouseLeave = () => {
|
|
31115
31126
|
isMousePressing.value = false;
|
|
@@ -31321,39 +31332,6 @@ var script = defineComponent({
|
|
|
31321
31332
|
musicStatus.value = true;
|
|
31322
31333
|
}
|
|
31323
31334
|
};
|
|
31324
|
-
const startInertiaIframe = () => {
|
|
31325
|
-
const decay = 0.96;
|
|
31326
|
-
const minVelocity = 0.1; // 提高最小速度阈值
|
|
31327
|
-
const pageId = currentPageId.value;
|
|
31328
|
-
const maxScroll = maxScrollPositions.value[pageId] || 0;
|
|
31329
|
-
const animate = () => {
|
|
31330
|
-
if (Math.abs(scrollVelocity.value) < minVelocity) {
|
|
31331
|
-
// 检查是否接近边界
|
|
31332
|
-
if (scrollPositions.value[pageId] < 10) {
|
|
31333
|
-
scrollPositions.value[pageId] = 0;
|
|
31334
|
-
}
|
|
31335
|
-
else if (scrollPositions.value[pageId] > maxScroll - 10) {
|
|
31336
|
-
scrollPositions.value[pageId] = maxScroll;
|
|
31337
|
-
}
|
|
31338
|
-
scrollVelocity.value = 0;
|
|
31339
|
-
return;
|
|
31340
|
-
}
|
|
31341
|
-
let newPosition = scrollPositions.value[pageId] + scrollVelocity.value * 16 * speedFactor;
|
|
31342
|
-
// 增加边界弹性
|
|
31343
|
-
if (newPosition < 0) {
|
|
31344
|
-
newPosition = 0;
|
|
31345
|
-
scrollVelocity.value = -scrollVelocity.value * 0.3;
|
|
31346
|
-
}
|
|
31347
|
-
else if (newPosition > maxScroll) {
|
|
31348
|
-
newPosition = maxScroll;
|
|
31349
|
-
scrollVelocity.value = -scrollVelocity.value * 0.3;
|
|
31350
|
-
}
|
|
31351
|
-
scrollPositions.value[pageId] = newPosition;
|
|
31352
|
-
scrollVelocity.value *= decay;
|
|
31353
|
-
inertiaAnimation.value = requestAnimationFrame(animate);
|
|
31354
|
-
};
|
|
31355
|
-
inertiaAnimation.value = requestAnimationFrame(animate);
|
|
31356
|
-
};
|
|
31357
31335
|
return {
|
|
31358
31336
|
personalData,
|
|
31359
31337
|
global,
|
|
@@ -30815,7 +30815,6 @@
|
|
|
30815
30815
|
const scrollStartTime = vue.ref(0);
|
|
30816
30816
|
const scrollStartPosition = vue.ref(0);
|
|
30817
30817
|
const isDragging = vue.ref(false);
|
|
30818
|
-
const isInteractingWithComponent = vue.ref(false);
|
|
30819
30818
|
const clickStartTime = vue.ref(0);
|
|
30820
30819
|
const clickStartY = vue.ref(0);
|
|
30821
30820
|
const isUserPaused = vue.ref(false);
|
|
@@ -30977,6 +30976,7 @@
|
|
|
30977
30976
|
// handleTouchMove = function() { ... }
|
|
30978
30977
|
// ...
|
|
30979
30978
|
handleTouchStart = (e) => {
|
|
30979
|
+
console.log('handleTouchStart');
|
|
30980
30980
|
const pageId = currentPageId.value;
|
|
30981
30981
|
if (!container.value)
|
|
30982
30982
|
return;
|
|
@@ -31011,6 +31011,7 @@
|
|
|
31011
31011
|
dragStartScrolls.value[pageId] = 0;
|
|
31012
31012
|
}
|
|
31013
31013
|
handleTouchMove = (e) => {
|
|
31014
|
+
console.log('handleTouchMove');
|
|
31014
31015
|
e.preventDefault();
|
|
31015
31016
|
const pageId = currentPageId.value;
|
|
31016
31017
|
if (!container.value)
|
|
@@ -31046,8 +31047,9 @@
|
|
|
31046
31047
|
}
|
|
31047
31048
|
};
|
|
31048
31049
|
handleTouchEnd = (e) => {
|
|
31050
|
+
console.log('handleTouchEnd');
|
|
31049
31051
|
currentPageId.value;
|
|
31050
|
-
if (!container.value
|
|
31052
|
+
if (!container.value)
|
|
31051
31053
|
return;
|
|
31052
31054
|
isDragging.value = false;
|
|
31053
31055
|
if (inertiaAnimation.value) {
|
|
@@ -31059,7 +31061,25 @@
|
|
|
31059
31061
|
startInertia();
|
|
31060
31062
|
}
|
|
31061
31063
|
};
|
|
31064
|
+
handleMouseDown = (e) => {
|
|
31065
|
+
console.log('handleMouseDown');
|
|
31066
|
+
const pageId = currentPageId.value;
|
|
31067
|
+
isMousePressing.value = true;
|
|
31068
|
+
if (!container.value)
|
|
31069
|
+
return;
|
|
31070
|
+
if (inertiaAnimation.value) {
|
|
31071
|
+
cancelAnimationFrame(inertiaAnimation.value);
|
|
31072
|
+
inertiaAnimation.value = undefined;
|
|
31073
|
+
}
|
|
31074
|
+
dragStartYs.value[pageId] = e.clientY;
|
|
31075
|
+
dragStartScrolls.value[pageId] = scrollPositions.value[pageId] || 0;
|
|
31076
|
+
isDragging.value = false;
|
|
31077
|
+
clickStartTime.value = Date.now();
|
|
31078
|
+
clickStartY.value = e.clientY;
|
|
31079
|
+
scrollVelocity.value = 0;
|
|
31080
|
+
};
|
|
31062
31081
|
handleMouseMove = (e) => {
|
|
31082
|
+
console.log('handleMouseMove');
|
|
31063
31083
|
e.preventDefault && e.preventDefault();
|
|
31064
31084
|
const pageId = currentPageId.value;
|
|
31065
31085
|
if (!isMousePressing.value)
|
|
@@ -31068,55 +31088,46 @@
|
|
|
31068
31088
|
return;
|
|
31069
31089
|
const mouseY = e.clientY;
|
|
31070
31090
|
const deltaY = (mouseY - dragStartYs.value[pageId]) * speedFactor;
|
|
31071
|
-
// 添加拖动阈值判断
|
|
31072
|
-
if (!isDragging.value && Math.abs(deltaY) < 5) {
|
|
31073
|
-
return;
|
|
31074
|
-
}
|
|
31075
31091
|
const now = Date.now();
|
|
31076
31092
|
const timeDiff = now - lastScrollTime.value;
|
|
31077
31093
|
if (timeDiff > 0) {
|
|
31078
31094
|
scrollVelocity.value = -deltaY / timeDiff;
|
|
31079
31095
|
}
|
|
31080
31096
|
lastScrollTime.value = now;
|
|
31081
|
-
if (
|
|
31097
|
+
if (Math.abs(deltaY) > 1) {
|
|
31082
31098
|
isDragging.value = true;
|
|
31083
31099
|
}
|
|
31084
31100
|
const maxScroll = maxScrollPositions.value[pageId] || 0;
|
|
31085
31101
|
let nextScroll = dragStartScrolls.value[pageId] - deltaY;
|
|
31086
|
-
//
|
|
31087
|
-
|
|
31088
|
-
if (isDragging.value) {
|
|
31089
|
-
// 在内容区域内正常滚动
|
|
31090
|
-
if (nextScroll > -edgeThreshold && nextScroll < maxScroll + edgeThreshold) {
|
|
31091
|
-
stopAutoScroll(true);
|
|
31092
|
-
scrollPositions.value[pageId] = Math.max(0, Math.min(nextScroll, maxScroll));
|
|
31093
|
-
}
|
|
31094
|
-
// 超出底部,准备翻页但不要立即触发
|
|
31095
|
-
else if (nextScroll >= maxScroll + edgeThreshold) {
|
|
31096
|
-
scrollPositions.value[pageId] = maxScroll + edgeThreshold * 0.3; // 增加一些阻力
|
|
31097
|
-
}
|
|
31098
|
-
// 超出顶部,准备翻页但不要立即触发
|
|
31099
|
-
else if (nextScroll <= -edgeThreshold) {
|
|
31100
|
-
scrollPositions.value[pageId] = -edgeThreshold * 0.3; // 增加一些阻力
|
|
31101
|
-
}
|
|
31102
|
-
}
|
|
31103
|
-
};
|
|
31104
|
-
handleMouseUp = (e) => {
|
|
31105
|
-
const pageId = currentPageId.value;
|
|
31106
|
-
const maxScroll = maxScrollPositions.value[pageId] || 0;
|
|
31107
|
-
const currentScroll = scrollPositions.value[pageId] || 0;
|
|
31108
|
-
// 检查是否需要翻页
|
|
31109
|
-
if (currentScroll >= maxScroll + 40) { // 翻页阈值比拖动时小
|
|
31102
|
+
// 超出底部,翻到下一页
|
|
31103
|
+
if ((maxScroll === 0 && deltaY < -40) || nextScroll > maxScroll + 60) {
|
|
31110
31104
|
goToNextPage();
|
|
31105
|
+
resetDragState(pageId);
|
|
31106
|
+
return;
|
|
31111
31107
|
}
|
|
31112
|
-
|
|
31108
|
+
// 超出顶部,翻到上一页
|
|
31109
|
+
if ((maxScroll === 0 && deltaY > 40) || nextScroll < -60) {
|
|
31113
31110
|
goToPrevPage();
|
|
31111
|
+
resetDragState(pageId);
|
|
31112
|
+
return;
|
|
31114
31113
|
}
|
|
31115
|
-
|
|
31116
|
-
|
|
31114
|
+
if (isDragging.value) {
|
|
31115
|
+
stopAutoScroll(true);
|
|
31116
|
+
scrollPositions.value[pageId] = Math.max(0, Math.min(nextScroll, maxScroll));
|
|
31117
31117
|
}
|
|
31118
|
+
};
|
|
31119
|
+
handleMouseUp = (e) => {
|
|
31120
|
+
console.log('handleMouseUp');
|
|
31118
31121
|
isMousePressing.value = false;
|
|
31119
31122
|
isDragging.value = false;
|
|
31123
|
+
if (inertiaAnimation.value) {
|
|
31124
|
+
cancelAnimationFrame(inertiaAnimation.value);
|
|
31125
|
+
inertiaAnimation.value = undefined;
|
|
31126
|
+
}
|
|
31127
|
+
// 惯性滚动
|
|
31128
|
+
if (Math.abs(scrollVelocity.value) > 0.1) {
|
|
31129
|
+
startInertia();
|
|
31130
|
+
}
|
|
31120
31131
|
};
|
|
31121
31132
|
handleMouseLeave = () => {
|
|
31122
31133
|
isMousePressing.value = false;
|
|
@@ -31328,39 +31339,6 @@
|
|
|
31328
31339
|
musicStatus.value = true;
|
|
31329
31340
|
}
|
|
31330
31341
|
};
|
|
31331
|
-
const startInertiaIframe = () => {
|
|
31332
|
-
const decay = 0.96;
|
|
31333
|
-
const minVelocity = 0.1; // 提高最小速度阈值
|
|
31334
|
-
const pageId = currentPageId.value;
|
|
31335
|
-
const maxScroll = maxScrollPositions.value[pageId] || 0;
|
|
31336
|
-
const animate = () => {
|
|
31337
|
-
if (Math.abs(scrollVelocity.value) < minVelocity) {
|
|
31338
|
-
// 检查是否接近边界
|
|
31339
|
-
if (scrollPositions.value[pageId] < 10) {
|
|
31340
|
-
scrollPositions.value[pageId] = 0;
|
|
31341
|
-
}
|
|
31342
|
-
else if (scrollPositions.value[pageId] > maxScroll - 10) {
|
|
31343
|
-
scrollPositions.value[pageId] = maxScroll;
|
|
31344
|
-
}
|
|
31345
|
-
scrollVelocity.value = 0;
|
|
31346
|
-
return;
|
|
31347
|
-
}
|
|
31348
|
-
let newPosition = scrollPositions.value[pageId] + scrollVelocity.value * 16 * speedFactor;
|
|
31349
|
-
// 增加边界弹性
|
|
31350
|
-
if (newPosition < 0) {
|
|
31351
|
-
newPosition = 0;
|
|
31352
|
-
scrollVelocity.value = -scrollVelocity.value * 0.3;
|
|
31353
|
-
}
|
|
31354
|
-
else if (newPosition > maxScroll) {
|
|
31355
|
-
newPosition = maxScroll;
|
|
31356
|
-
scrollVelocity.value = -scrollVelocity.value * 0.3;
|
|
31357
|
-
}
|
|
31358
|
-
scrollPositions.value[pageId] = newPosition;
|
|
31359
|
-
scrollVelocity.value *= decay;
|
|
31360
|
-
inertiaAnimation.value = requestAnimationFrame(animate);
|
|
31361
|
-
};
|
|
31362
|
-
inertiaAnimation.value = requestAnimationFrame(animate);
|
|
31363
|
-
};
|
|
31364
31342
|
return {
|
|
31365
31343
|
personalData,
|
|
31366
31344
|
global,
|