|
@@ -170,6 +170,7 @@ var draw_graph = function (graphType, obj) {
|
|
|
$("#dedit").css("z-index", 20);
|
|
|
var canDraw = false;
|
|
|
//鼠标按下获取 开始xy开始画图
|
|
|
+ var ongoingTouches = [];
|
|
|
var touchstart = function (e) {
|
|
|
$('.control-right-img').attr({
|
|
|
"data-id": "2"
|
|
@@ -177,7 +178,7 @@ var draw_graph = function (graphType, obj) {
|
|
|
$(".leftmains").css({
|
|
|
"right": "-4rem"
|
|
|
})
|
|
|
- var touchfor = e.originalEvent.touches; //for 的手指数组
|
|
|
+ var touchfor = e.originalEvent.targetTouches; //for 的手指数组
|
|
|
//是否横屏
|
|
|
for (var i = 0; i < touchfor.length; i++) {
|
|
|
var acrossWidthX = touchfor[i].pageY * (videoHeight / voheight);
|
|
@@ -185,9 +186,10 @@ var draw_graph = function (graphType, obj) {
|
|
|
var verticalWidthX = touchfor[i].pageX * (videoWidth / vowidth);
|
|
|
var verticalHeightY = touchfor[i].pageY * (videoHeight / voheight);
|
|
|
var ping = resolving == 0 ?
|
|
|
- { "data": { "action": 0, "count": touchfor.length, "id": touchfor[i].identifier, "x": acrossWidthX.toFixed(2), "y": acrossHeightY.toFixed(2) }, "type": "event" } :
|
|
|
- { "data": { "action": 0, "count": touchfor.length, "id": touchfor[i].identifier, "x": verticalWidthX.toFixed(2), "y": verticalHeightY.toFixed(2) }, "type": "event" };
|
|
|
+ { "data": { "action": 0, "count": ongoingTouches.length, "id": touchfor[i].identifier, "x": acrossWidthX.toFixed(2), "y": acrossHeightY.toFixed(2) }, "type": "event" } :
|
|
|
+ { "data": { "action": 0, "count": ongoingTouches.length, "id": touchfor[i].identifier, "x": verticalWidthX.toFixed(2), "y": verticalHeightY.toFixed(2) }, "type": "event" };
|
|
|
console.log(ping);
|
|
|
+ ongoingTouches.push(ping);
|
|
|
wsss.send(JSON.stringify(ping));
|
|
|
}
|
|
|
canDraw = true;
|
|
@@ -203,10 +205,15 @@ var draw_graph = function (graphType, obj) {
|
|
|
var verticalWidthX = touchfor[i].pageX * (videoWidth / vowidth);
|
|
|
var verticalHeightY = touchfor[i].pageY * (videoHeight / voheight);
|
|
|
var ping = resolving == 0 ?
|
|
|
- { "data": { "action": 1, "count": touchfor.length, "id": touchfor[i].identifier, "x": acrossWidthX.toFixed(2), "y": acrossHeightY.toFixed(2) }, "type": "event" } :
|
|
|
- { "data": { "action": 1, "count": touchfor.length, "id": touchfor[i].identifier, "x": verticalWidthX.toFixed(2), "y": verticalHeightY.toFixed(2) }, "type": "event" };
|
|
|
+ { "data": { "action": 1, "count": ongoingTouches.length, "id": touchfor[i].identifier, "x": acrossWidthX.toFixed(2), "y": acrossHeightY.toFixed(2) }, "type": "event" } :
|
|
|
+ { "data": { "action": 1, "count": ongoingTouches.length, "id": touchfor[i].identifier, "x": verticalWidthX.toFixed(2), "y": verticalHeightY.toFixed(2) }, "type": "event" };
|
|
|
console.log(ping);
|
|
|
wsss.send(JSON.stringify(ping));
|
|
|
+ ongoingTouches.forEach(function(item, index) {
|
|
|
+ if (item.id === touchfor[i].identifier) {
|
|
|
+ ongoingTouches.splice(index, 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
canDraw = false;
|
|
|
};
|
|
@@ -218,7 +225,7 @@ var draw_graph = function (graphType, obj) {
|
|
|
|
|
|
// 鼠标移动
|
|
|
var touchmove = function (e) {
|
|
|
- var touchfor = e.originalEvent.touches; //for 的手指数组
|
|
|
+ var touchfor = e.originalEvent.targetTouches; //for 的手指数组
|
|
|
for (var i = 0; i < touchfor.length; i++) {
|
|
|
var acrossWidthX = touchfor[i].pageY * (videoHeight / voheight);
|
|
|
var acrossHeightY = videoWidth - touchfor[i].pageX * (videoWidth / vowidth);
|