add mobile web compatibility
This commit is contained in:
parent
8f0457101c
commit
14a1cc3ef8
21
doric-web/dist/index.js
vendored
21
doric-web/dist/index.js
vendored
@ -4796,7 +4796,24 @@ var doric_web = (function (exports, axios, sandbox) {
|
|||||||
build() {
|
build() {
|
||||||
const ret = document.createElement('div');
|
const ret = document.createElement('div');
|
||||||
ret.ontouchstart = (event) => {
|
ret.ontouchstart = (event) => {
|
||||||
console.log("ontouchstart: " + event);
|
this.dragging = true;
|
||||||
|
this.lastX = event.targetTouches[0].clientX;
|
||||||
|
this.lastY = event.targetTouches[0].clientY;
|
||||||
|
};
|
||||||
|
ret.ontouchend = (event) => {
|
||||||
|
this.dragging = false;
|
||||||
|
};
|
||||||
|
ret.ontouchcancel = (event) => {
|
||||||
|
this.dragging = false;
|
||||||
|
};
|
||||||
|
ret.ontouchmove = (event) => {
|
||||||
|
if (this.dragging) {
|
||||||
|
this.offsetX += (event.targetTouches[0].clientX - this.lastX);
|
||||||
|
this.offsetY += (event.targetTouches[0].clientY - this.lastY);
|
||||||
|
this.callJSResponse(this.onDrag, this.offsetX, this.offsetY);
|
||||||
|
this.lastX = event.targetTouches[0].clientX;
|
||||||
|
this.lastY = event.targetTouches[0].clientY;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
ret.onmousedown = (event) => {
|
ret.onmousedown = (event) => {
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
@ -4814,8 +4831,6 @@ var doric_web = (function (exports, axios, sandbox) {
|
|||||||
};
|
};
|
||||||
ret.onmouseup = (event) => {
|
ret.onmouseup = (event) => {
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
this.lastX = event.x;
|
|
||||||
this.lastY = event.y;
|
|
||||||
};
|
};
|
||||||
ret.onmouseout = (event) => {
|
ret.onmouseout = (event) => {
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -9,8 +9,27 @@ export class DoricDraggableNode extends DoricStackNode {
|
|||||||
build() {
|
build() {
|
||||||
const ret = document.createElement('div')
|
const ret = document.createElement('div')
|
||||||
ret.ontouchstart = (event) => {
|
ret.ontouchstart = (event) => {
|
||||||
console.log("ontouchstart: " + event)
|
this.dragging = true
|
||||||
|
this.lastX = event.targetTouches[0].clientX
|
||||||
|
this.lastY = event.targetTouches[0].clientY
|
||||||
}
|
}
|
||||||
|
ret.ontouchend = (event) => {
|
||||||
|
this.dragging = false
|
||||||
|
}
|
||||||
|
ret.ontouchcancel = (event) => {
|
||||||
|
this.dragging = false
|
||||||
|
}
|
||||||
|
ret.ontouchmove = (event) => {
|
||||||
|
if (this.dragging) {
|
||||||
|
this.offsetX += (event.targetTouches[0].clientX - this.lastX)
|
||||||
|
this.offsetY += (event.targetTouches[0].clientY - this.lastY)
|
||||||
|
this.callJSResponse(this.onDrag, this.offsetX, this.offsetY)
|
||||||
|
|
||||||
|
this.lastX = event.targetTouches[0].clientX
|
||||||
|
this.lastY = event.targetTouches[0].clientY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret.onmousedown = (event) => {
|
ret.onmousedown = (event) => {
|
||||||
this.dragging = true
|
this.dragging = true
|
||||||
this.lastX = event.x
|
this.lastX = event.x
|
||||||
@ -28,9 +47,6 @@ export class DoricDraggableNode extends DoricStackNode {
|
|||||||
}
|
}
|
||||||
ret.onmouseup = (event) => {
|
ret.onmouseup = (event) => {
|
||||||
this.dragging = false
|
this.dragging = false
|
||||||
|
|
||||||
this.lastX = event.x
|
|
||||||
this.lastY = event.y
|
|
||||||
}
|
}
|
||||||
ret.onmouseout = (event) => {
|
ret.onmouseout = (event) => {
|
||||||
this.dragging = false
|
this.dragging = false
|
||||||
|
Reference in New Issue
Block a user