dolphin-weex-ui 2.2.7 → 2.2.8
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.
- package/CHANGELOG.md +10 -0
- package/dist/index.native.js +60 -34
- package/dist/index.native.js.map +1 -1
- package/dist/index.web.js +63 -37
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
- package/packages/dof-status/colmo.css +1 -1
- package/packages/utils/touch.js +29 -3
package/package.json
CHANGED
package/packages/utils/touch.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Direction } from './direction.js'
|
|
2
|
+
import { Bridge } from 'dolphin-native-bridge'
|
|
2
3
|
|
|
3
4
|
export class Touch {
|
|
4
5
|
static MIN_DISTANCE = 10
|
|
@@ -10,8 +11,21 @@ export class Touch {
|
|
|
10
11
|
constructor() {
|
|
11
12
|
this.startX = 0
|
|
12
13
|
this.startY = 0
|
|
14
|
+
this.startX = 0
|
|
15
|
+
this.moveStartX = 0
|
|
16
|
+
this.moveStartY = 0
|
|
13
17
|
this.deltaX = 0
|
|
14
18
|
this.deltaY = 0
|
|
19
|
+
this.isIos = weex.config.env.platform == 'iOS' ? true : false
|
|
20
|
+
this.envConfig = weex.config.env
|
|
21
|
+
this.systemInfo = null
|
|
22
|
+
Bridge.getSystemInfo()
|
|
23
|
+
.then(res => {
|
|
24
|
+
this.systemInfo = res
|
|
25
|
+
})
|
|
26
|
+
.catch(err => {
|
|
27
|
+
// this.$toast(err)
|
|
28
|
+
})
|
|
15
29
|
|
|
16
30
|
this.direction = Direction.NONE
|
|
17
31
|
}
|
|
@@ -49,6 +63,8 @@ export class Touch {
|
|
|
49
63
|
reset() {
|
|
50
64
|
this.startX = 0
|
|
51
65
|
this.startY = 0
|
|
66
|
+
this.moveStartX = 0
|
|
67
|
+
this.moveStartY = 0
|
|
52
68
|
this.deltaX = 0
|
|
53
69
|
this.deltaY = 0
|
|
54
70
|
this.direction = Direction.NONE
|
|
@@ -61,16 +77,26 @@ export class Touch {
|
|
|
61
77
|
start(evt) {
|
|
62
78
|
const e = this.getTouchByEvent(evt)
|
|
63
79
|
this.reset()
|
|
64
|
-
|
|
80
|
+
// screenX 触摸点相对于屏幕左侧边缘的 X 轴坐标
|
|
81
|
+
// pageX 触摸点相对于文档左侧边缘的 X 轴坐标
|
|
82
|
+
this.moveStartX = e.screenX
|
|
83
|
+
this.moveStartY = e.screenY
|
|
84
|
+
// 判断为折叠机
|
|
85
|
+
let isFoldAble = this.systemInfo.screenWidth > this.envConfig.deviceWidth? true : false
|
|
86
|
+
|
|
87
|
+
// ios或正常屏机型,保持位移X用screenX
|
|
88
|
+
// 折叠机展开则用计算出实际x坐标大小
|
|
89
|
+
this.startX = (this.isIos || !isFoldAble)?e.screenX : e.screenX - (((this.systemInfo.screenWidth - this.envConfig.deviceWidth)/ this.envConfig.scale ))
|
|
65
90
|
this.startY = e.screenY
|
|
66
91
|
}
|
|
67
92
|
|
|
68
93
|
move(evt) {
|
|
69
94
|
const e = this.getTouchByEvent(evt)
|
|
70
|
-
this.deltaX = e.screenX - this.
|
|
71
|
-
this.deltaY = e.screenY - this.
|
|
95
|
+
this.deltaX = e.screenX - this.moveStartX
|
|
96
|
+
this.deltaY = e.screenY - this.moveStartY
|
|
72
97
|
if (this.isUndetermined) {
|
|
73
98
|
this.direction = this.resolveDirection(this.offsetX, this.offsetY)
|
|
74
99
|
}
|
|
75
100
|
}
|
|
101
|
+
|
|
76
102
|
}
|