y***@yousi.com
y***@yousi.com
  • 发布:2024-04-30 12:41
  • 更新:2024-04-30 14:38
  • 阅读:36

movable-view双指缩放并移到后如何找到正确的坐标?

分类:uni-app

我正在实现一个功能,双指缩放图片并移动图片,用户在点击图片上的点后在点击的位置会插入一个图钉,类似于在地图上加图钉的功能
现在的问题是缩放/左右拖动后点击的坐标会有偏移,请问这个该如何处理?或者有其他更好的办法

<movable-area scale-area style="width: 100%;height: 80vh;">  
        <movable-view style="width: 100%;height: 80vh;" scale="true" scale-min="1"  scale-max="4" :scale-value="scale" direction="all">  
            <view class="wrong_flex_image_box" style="" @click.stop="fnSetPos">  
                <uv-image :src="wrongLists[currentIndex-1].img" mode="widthFix" width="100%"></uv-image>  
                <tag @click.stop="deleteTags(index)" tag-type="error" :tag-info="item"  
                    v-for="(item,index) in wrongLists[currentIndex-1].errorTags"></tag>  
            </view>  
        </movable-view>  
    </movable-area>  

fnSetPos(e) {  
            this.wrongLists[this.currentIndex - 1].errorTags.push({  
                x: Math.max(e.detail.x - e.currentTarget.offsetLeft - 16, 0),  
                y: Math.max(e.detail.y - e.currentTarget.offsetTop - 16, 0),  
            })  
        },
2024-04-30 12:41 负责人:无 分享
已邀请:
y***@yousi.com

y***@yousi.com (作者)

该问题已经解决

要回复问题请先登录注册