fix: make move content
This commit is contained in:
@@ -51,6 +51,9 @@
|
||||
<view
|
||||
class="bubble"
|
||||
@tap="openTool('text')"
|
||||
@touchstart.stop="handleBubbleTouchStart"
|
||||
@touchmove.stop="handleBubbleTouchMove"
|
||||
@touchend.stop="handleBubbleTouchEnd"
|
||||
:style="{
|
||||
marginTop: 230 + bubbleOffsetY + 'rpx',
|
||||
maxWidth: bubbleMaxWidth + 80 + 'rpx',
|
||||
@@ -95,7 +98,7 @@
|
||||
<view class="tip-line">
|
||||
<view class="interaction-tip">
|
||||
<uni-icons type="hand-up" size="14" color="#ff3b30"></uni-icons>
|
||||
<text>点击标题或个人信息可拖动,双指可缩放标题</text>
|
||||
<text>点击标题、祝福语或个人信息可拖动,双指可缩放标题</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -510,6 +513,31 @@ const handleUserTouchMove = (e) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 祝福语触摸交互相关
|
||||
let startBubbleTouches = [];
|
||||
let initialBubbleOffsetY = 0;
|
||||
|
||||
const handleBubbleTouchStart = (e) => {
|
||||
startBubbleTouches = e.touches;
|
||||
initialBubbleOffsetY = bubbleOffsetY.value;
|
||||
};
|
||||
|
||||
const handleBubbleTouchEnd = () => {
|
||||
startBubbleTouches = [];
|
||||
};
|
||||
|
||||
const handleBubbleTouchMove = (e) => {
|
||||
if (!startBubbleTouches.length) return;
|
||||
|
||||
if (e.touches.length === 1 && startBubbleTouches.length === 1) {
|
||||
// 单指拖拽 (仅上下)
|
||||
const moveY = e.touches[0].clientY - startBubbleTouches[0].clientY;
|
||||
let newY = initialBubbleOffsetY + moveY * pxToRpx;
|
||||
// 合理范围限制,参考 slider 的 min/max
|
||||
bubbleOffsetY.value = Math.min(Math.max(newY, -200), 400);
|
||||
}
|
||||
};
|
||||
|
||||
const handleTitleTouchMove = (e) => {
|
||||
if (!currentTitle.value || !startTouches.length) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user