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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dolphin-weex-ui",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "inteligense cross platform frame",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -5,7 +5,7 @@
5
5
  border-width: 2px;
6
6
  border-style: solid;
7
7
  border-color: rgba(255,255,255,0.2); 用这种颜色表示安卓有模糊的问题 */
8
- border: 2px solid #3d3d42;
8
+ border: 2px solid #5e5f60; /* 2024.12.04 修改边框颜色规范 */
9
9
  }
10
10
  .wrap2 {
11
11
  height: 80px;
@@ -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
- this.startX = e.screenX
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.startX
71
- this.deltaY = e.screenY - this.startY
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
  }