@dreamworld/dw-ripple 2.4.0-development.3 → 2.4.0-development.5
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/dw-ripple.js +27 -5
- package/package.json +1 -1
package/dw-ripple.js
CHANGED
|
@@ -24,7 +24,7 @@ export class DwRipple extends Ripple {
|
|
|
24
24
|
secondary: { type: Boolean, reflect: true },
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Set to `true` to disable hover and
|
|
27
|
+
* Set to `true` to disable hover and focus in.
|
|
28
28
|
*/
|
|
29
29
|
disableHover: { type: Boolean },
|
|
30
30
|
};
|
|
@@ -49,6 +49,8 @@ export class DwRipple extends Ripple {
|
|
|
49
49
|
this.__onTouchStart = this.__onTouchStart.bind(this);
|
|
50
50
|
this.__onMouseUp = this.__onMouseUp.bind(this);
|
|
51
51
|
this.__onTouchEnd = this.__onTouchEnd.bind(this);
|
|
52
|
+
this.__onPointerMove = this.__onPointerMove.bind(this);
|
|
53
|
+
this.__onTouchMove = this.__onTouchMove.bind(this);
|
|
52
54
|
|
|
53
55
|
if (!this.disableHover) {
|
|
54
56
|
parent.addEventListener("mouseenter", this._rippleHander.startHover);
|
|
@@ -59,16 +61,34 @@ export class DwRipple extends Ripple {
|
|
|
59
61
|
|
|
60
62
|
parent.addEventListener("mousedown", this.__onMouseDown);
|
|
61
63
|
parent.addEventListener("touchstart", this.__onTouchStart);
|
|
64
|
+
window.addEventListener("pointermove", this.__onPointerMove);
|
|
65
|
+
window.addEventListener("touchmove", this.__onTouchMove);
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
__onMouseDown(e) {
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
this.delayMouseDown = setTimeout(() => {
|
|
70
|
+
window.addEventListener("mouseup", this.__onMouseUp);
|
|
71
|
+
this._rippleHander.startPress(e);
|
|
72
|
+
}, 50);
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
__onTouchStart(e) {
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
this.delayTouchStart = setTimeout(() => {
|
|
77
|
+
window.addEventListener("touchend", this.__onTouchEnd);
|
|
78
|
+
this._rippleHander.startPress(e);
|
|
79
|
+
}, 50);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
__onPointerMove() {
|
|
83
|
+
if (this.delayMouseDown) {
|
|
84
|
+
clearTimeout(this.delayMouseDown);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
__onTouchMove() {
|
|
89
|
+
if (this.delayTouchStart) {
|
|
90
|
+
clearTimeout(this.delayTouchStart);
|
|
91
|
+
}
|
|
72
92
|
}
|
|
73
93
|
|
|
74
94
|
__onMouseUp() {
|
|
@@ -105,6 +125,8 @@ export class DwRipple extends Ripple {
|
|
|
105
125
|
|
|
106
126
|
window.removeEventListener("touchend", this.__onTouchEnd);
|
|
107
127
|
window.removeEventListener("mouseup", this.__onMouseUp);
|
|
128
|
+
window.removeEventListener("pointermove", this.__onPointerMove);
|
|
129
|
+
window.removeEventListener("touchmove", this.__onTouchMove);
|
|
108
130
|
|
|
109
131
|
super.disconnectedCallback();
|
|
110
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamworld/dw-ripple",
|
|
3
|
-
"version": "2.4.0-development.
|
|
3
|
+
"version": "2.4.0-development.5",
|
|
4
4
|
"description": "Ripple element created as child-class of [`mwc-ripple`] (https://github.com/material-components/material-components-web-components/tree/master/packages/ripple)",
|
|
5
5
|
"main": "dw-ripple.js",
|
|
6
6
|
"scripts": {
|