meixioacomponent 0.3.66 → 0.3.67
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,48 +1,52 @@
|
|
|
1
1
|
class UseResize {
|
|
2
2
|
constructor(parmas) {
|
|
3
3
|
// type 为 width/height
|
|
4
|
-
this.type = parmas.type
|
|
4
|
+
this.type = parmas.type
|
|
5
5
|
// 目标需要改变的值
|
|
6
|
-
this.value = parmas.value
|
|
6
|
+
this.value = parmas.value
|
|
7
7
|
// 移动的时候的事件
|
|
8
|
-
this.moveing = parmas.moveing
|
|
8
|
+
this.moveing = parmas.moveing
|
|
9
9
|
// 结束事件
|
|
10
|
-
this.resizeEnd = parmas.resizeEnd
|
|
11
|
-
this.x = null
|
|
12
|
-
this.sub = null
|
|
10
|
+
this.resizeEnd = parmas.resizeEnd
|
|
11
|
+
this.x = null
|
|
12
|
+
this.sub = null
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
setListen() {
|
|
16
|
-
document.onmousemove = this.onResizeing
|
|
17
|
-
document.onmouseup = this.onResizeEnd
|
|
16
|
+
document.onmousemove = this.onResizeing
|
|
17
|
+
document.onmouseup = this.onResizeEnd
|
|
18
18
|
}
|
|
19
19
|
removeListen() {
|
|
20
|
-
document.onmousemove = null
|
|
21
|
-
document.onmouseup = null
|
|
20
|
+
document.onmousemove = null
|
|
21
|
+
document.onmouseup = null
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
startResize(e) {
|
|
25
|
-
this.setListen()
|
|
26
|
-
if (this.type ==
|
|
27
|
-
this.x = e.clientX
|
|
25
|
+
this.setListen()
|
|
26
|
+
if (this.type == 'width') {
|
|
27
|
+
this.x = e.clientX
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
initValue(value) {
|
|
32
|
+
this.value = value
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
onResizeing = (e) => {
|
|
32
|
-
let type = this.type
|
|
33
|
-
if (type ==
|
|
34
|
-
const stw = this.x - e.clientX
|
|
35
|
-
this.sub = this.value + stw
|
|
36
|
-
this.moveing(this.sub)
|
|
36
|
+
let type = this.type
|
|
37
|
+
if (type == 'width') {
|
|
38
|
+
const stw = this.x - e.clientX
|
|
39
|
+
this.sub = this.value + stw
|
|
40
|
+
this.moveing(this.sub)
|
|
37
41
|
}
|
|
38
|
-
}
|
|
42
|
+
}
|
|
39
43
|
onResizeEnd = (e) => {
|
|
40
|
-
this.removeListen()
|
|
41
|
-
this.value = this.sub
|
|
44
|
+
this.removeListen()
|
|
45
|
+
this.value = this.sub
|
|
42
46
|
if (this.resizeEnd) {
|
|
43
|
-
this.resizeEnd()
|
|
47
|
+
this.resizeEnd()
|
|
44
48
|
}
|
|
45
|
-
}
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
export default UseResize
|
|
52
|
+
export default UseResize
|