提交 c60200e2 编写于 作者: X xzs02

fix: 解决createSelectorQuery获取的top值与事件对象中Y轴坐标不一致的问题 #109

上级 4062633e
...@@ -2,6 +2,8 @@ import { ...@@ -2,6 +2,8 @@ import {
normalizeDataset normalizeDataset
} from 'uni-helpers' } from 'uni-helpers'
import getWindowOffset from 'uni-platform/helpers/get-window-offset'
function getRootInfo (fields) { function getRootInfo (fields) {
const info = {} const info = {}
if (fields.id) { if (fields.id) {
...@@ -29,6 +31,9 @@ function getRootInfo (fields) { ...@@ -29,6 +31,9 @@ function getRootInfo (fields) {
function getNodeInfo (el, fields) { function getNodeInfo (el, fields) {
const info = {} const info = {}
const {
top
} = getWindowOffset()
if (fields.id) { if (fields.id) {
info.id = el.id info.id = el.id
} }
...@@ -40,7 +45,7 @@ function getNodeInfo (el, fields) { ...@@ -40,7 +45,7 @@ function getNodeInfo (el, fields) {
if (fields.rect) { if (fields.rect) {
info.left = rect.left info.left = rect.left
info.right = rect.right info.right = rect.right
info.top = rect.top info.top = rect.top - top
info.bottom = rect.bottom info.bottom = rect.bottom
} }
if (fields.size) { if (fields.size) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册