|
@@ -26,7 +26,6 @@ var cardToken = parameters["cardToken"];
|
|
|
cardToken = cardToken && cardToken.replace(/@/g,"=");
|
|
|
form.cardIp = parameters["cardIp"];
|
|
|
form.port = parameters["port"];
|
|
|
-form.sn = parameters["sn"];
|
|
|
form.username = parameters["username"];
|
|
|
form.userCardId = parameters["userCardId"];
|
|
|
form.ip = parameters["ip"];
|
|
@@ -55,29 +54,18 @@ function doConnect() {
|
|
|
wsss.binaryType = 'arraybuffer';
|
|
|
|
|
|
wsss.onopen = function () {
|
|
|
- var pings = {
|
|
|
- "event": "getScreenStatus"
|
|
|
- }
|
|
|
+ // 获取虚拟场景状态
|
|
|
+ var pings = { "type": "getVsStatus" }
|
|
|
wsss.send(JSON.stringify(pings));
|
|
|
var bitRate = {
|
|
|
"data": {
|
|
|
"bitRate": 1243000
|
|
|
},
|
|
|
- "event": "bitRate"
|
|
|
+ "type": "bitRate"
|
|
|
}
|
|
|
wsss.send(JSON.stringify(bitRate))
|
|
|
};
|
|
|
- wsss.onclose = function (evt) {
|
|
|
- wsss.close();
|
|
|
- throttle(doConnect,100);
|
|
|
- if(errorTime > 1000){
|
|
|
- wx.miniProgram.switchTab({
|
|
|
- url: '/pages/home/home'
|
|
|
- })
|
|
|
- }
|
|
|
- };
|
|
|
wsss.onerror = function (evt) {
|
|
|
- console.log(evt);
|
|
|
wsss.close();
|
|
|
throttle(doConnect,100);
|
|
|
if(errorTime > 1000){
|
|
@@ -108,11 +96,11 @@ $(".upload").on("click", function () {
|
|
|
$(".botmat1img").on("click", function () {
|
|
|
var codes = $(this).attr("data-text")
|
|
|
if (codes == "home") {
|
|
|
- wsss.send(ExexuteKeyBoard(3), form.sn);
|
|
|
+ wsss.send(ExexuteKeyBoard(3));
|
|
|
} else if (codes == "return") {
|
|
|
- wsss.send(ExexuteKeyBoard(4), form.sn);
|
|
|
+ wsss.send(ExexuteKeyBoard(4));
|
|
|
} else if (codes == "gengduo") {
|
|
|
- wsss.send(ExexuteKeyBoard(187), form.sn);
|
|
|
+ wsss.send(ExexuteKeyBoard(187));
|
|
|
}
|
|
|
|
|
|
})
|
|
@@ -124,11 +112,11 @@ $(".PictureQuality").on("click", function () {
|
|
|
"data": {
|
|
|
"bitRate": id
|
|
|
},
|
|
|
- "event": "bitRate"
|
|
|
+ "type": "bitRate"
|
|
|
}
|
|
|
wsss.send(JSON.stringify(bitRate))
|
|
|
})
|
|
|
-
|
|
|
+var ongoingTouches = [];
|
|
|
//画图形
|
|
|
var draw_graph = function (graphType, obj) {
|
|
|
//把蒙版放于画板上面
|
|
@@ -143,87 +131,33 @@ var draw_graph = function (graphType, obj) {
|
|
|
$(".leftmains").css({
|
|
|
"right": "-4rem"
|
|
|
})
|
|
|
- var touchfor = e.originalEvent.targetTouches; //for 的手指数组
|
|
|
-
|
|
|
+ var touchfor = e.originalEvent.changedTouches[0]; //for 的手指数组
|
|
|
+ ongoingTouches.push(touchfor);
|
|
|
+ var acrossWidthX = touchfor.pageY * (1280 / voheight);
|
|
|
+ var acrossHeightY = 720 - touchfor.pageX * (720 / vowidth);
|
|
|
+ var verticalWidthX = touchfor.pageX * (720 / vowidth);
|
|
|
+ var verticalHeightY = touchfor.pageY * (1280 / voheight);
|
|
|
//是否横屏
|
|
|
- if (resolving == 0) {
|
|
|
- var ping;
|
|
|
- for (var i = 0; i < touchfor.length; i++) {
|
|
|
- var cawidthXs = touchfor[i].pageY * (1280 / voheight)
|
|
|
- var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
|
|
|
- ping = {
|
|
|
- "data": {
|
|
|
- "action": 0,
|
|
|
- "count": touchfor.length,
|
|
|
- "pointerId": i,
|
|
|
- "x": cawidthXs.toFixed(2),
|
|
|
- "y": caheightYs.toFixed(2)
|
|
|
- },
|
|
|
- "event": "0"
|
|
|
- }
|
|
|
- }
|
|
|
- wsss.send(JSON.stringify(ping))
|
|
|
- } else {
|
|
|
- var ping;
|
|
|
- for (var i = 0; i < touchfor.length; i++) {
|
|
|
- var cawidthXs = touchfor[i].pageX * (720 / vowidth)
|
|
|
- var caheightYs = touchfor[i].pageY * (1280 / voheight)
|
|
|
- ping = {
|
|
|
- "data": {
|
|
|
- "action": 0,
|
|
|
- "count": touchfor.length,
|
|
|
- "pointerId": i,
|
|
|
- "x": cawidthXs.toFixed(2),
|
|
|
- "y": caheightYs.toFixed(2)
|
|
|
- },
|
|
|
- "event": "0"
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- wsss.send(JSON.stringify(ping));
|
|
|
- }
|
|
|
+ var ping = resolving == 0 ?
|
|
|
+ {"data":{"action": 0, "count": ongoingTouches.length, "id": touchfor.identifier, "x": acrossWidthX.toFixed(2), "y": acrossHeightY.toFixed(2)},"type": "event"} :
|
|
|
+ {"data":{"action": 0, "count": ongoingTouches.length, "id": touchfor.identifier, "x": verticalWidthX.toFixed(2), "y": verticalHeightY.toFixed(2)},"type": "event"};
|
|
|
+ wsss.send(JSON.stringify(ping));
|
|
|
canDraw = true;
|
|
|
};
|
|
|
|
|
|
//鼠标离开 把蒙版canvas的图片生成到canvas中
|
|
|
var touchend = function (e) {
|
|
|
- var touchfor = e.originalEvent.changedTouches; //for 的手指数组
|
|
|
- //是否横屏 morePortionUp
|
|
|
- if (resolving == 0) {
|
|
|
- var ping;
|
|
|
- for (var i = 0; i < touchfor.length; i++) {
|
|
|
- var cawidthXs = touchfor[i].pageY * (1280 / voheight);
|
|
|
- var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth);
|
|
|
- ping = {
|
|
|
- "data": {
|
|
|
- "action": 1,
|
|
|
- "count": touchfor.length,
|
|
|
- "pointerId": i,
|
|
|
- "x": cawidthXs.toFixed(2),
|
|
|
- "y": caheightYs.toFixed(2)
|
|
|
- },
|
|
|
- "event": "1"
|
|
|
- }
|
|
|
- }
|
|
|
- wsss.send(JSON.stringify(ping));
|
|
|
- } else {
|
|
|
- var ping;
|
|
|
- for (var i = 0; i < touchfor.length; i++) {
|
|
|
- var cawidthXs = touchfor[i].pageX * (720 / vowidth);
|
|
|
- var caheightYs = touchfor[i].pageY * (1280 / voheight);
|
|
|
- ping = {
|
|
|
- "data": {
|
|
|
- "action": 1,
|
|
|
- "count": touchfor.length,
|
|
|
- "pointerId": i,
|
|
|
- "x": cawidthXs.toFixed(2),
|
|
|
- "y": caheightYs.toFixed(2)
|
|
|
- },
|
|
|
- "event": "1"
|
|
|
- }
|
|
|
- }
|
|
|
- wsss.send(JSON.stringify(ping))
|
|
|
- }
|
|
|
+ var touchfor = e.originalEvent.changedTouches[0]; //for 的手指数组
|
|
|
+ var acrossWidthX = touchfor.pageY * (1280 / voheight);
|
|
|
+ var acrossHeightY = 720 - touchfor.pageX * (720 / vowidth);
|
|
|
+ var verticalWidthX = touchfor.pageX * (720 / vowidth);
|
|
|
+ var verticalHeightY = touchfor.pageY * (1280 / voheight);
|
|
|
+ //是否横屏
|
|
|
+ var ping = resolving == 0 ?
|
|
|
+ {"data":{"action": 1, "count": ongoingTouches.length, "id": touchfor.identifier, "x": acrossWidthX.toFixed(2), "y": acrossHeightY.toFixed(2)},"type": "event"} :
|
|
|
+ {"data":{"action": 1, "count": ongoingTouches.length, "id": touchfor.identifier, "x": verticalWidthX.toFixed(2), "y": verticalHeightY.toFixed(2)},"type": "event"};
|
|
|
+ wsss.send(JSON.stringify(ping));
|
|
|
+ ongoingTouches.splice(touchfor.identifier, 1);
|
|
|
canDraw = false;
|
|
|
};
|
|
|
|
|
@@ -235,44 +169,15 @@ var draw_graph = function (graphType, obj) {
|
|
|
// 鼠标移动
|
|
|
var touchmove = function (e) {
|
|
|
e = e || window.event;
|
|
|
- var touchfor = e.originalEvent.targetTouches; //for 的手指数组
|
|
|
- var ping;
|
|
|
- //是否横屏 morePortionMove
|
|
|
- if (resolving == 0) {
|
|
|
- for (var i = 0; i < touchfor.length; i++) {
|
|
|
- var cawidthXs = touchfor[i].pageY * (1280 / voheight)
|
|
|
- var caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
|
|
|
- ping = {
|
|
|
- "data": {
|
|
|
- "action": 2,
|
|
|
- "count": touchfor.length,
|
|
|
- "pointerId": i,
|
|
|
- "x": cawidthXs.toFixed(2),
|
|
|
- "y": caheightYs.toFixed(2)
|
|
|
- },
|
|
|
- "event": "2"
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- wsss.send(JSON.stringify(ping))
|
|
|
- } else {
|
|
|
- var ping;
|
|
|
- for (var i = 0; i < touchfor.length; i++) {
|
|
|
- var cawidthXs = touchfor[i].pageX * (720 / vowidth);
|
|
|
- var caheightYs = touchfor[i].pageY * (1280 / voheight);
|
|
|
- ping = {
|
|
|
- "data": {
|
|
|
- "action": 2,
|
|
|
- "count": touchfor.length,
|
|
|
- "pointerId": i,
|
|
|
- "x": cawidthXs.toFixed(2),
|
|
|
- "y": caheightYs.toFixed(2)
|
|
|
- },
|
|
|
- "event": "2"
|
|
|
- }
|
|
|
- }
|
|
|
- wsss.send(JSON.stringify(ping));
|
|
|
- };
|
|
|
+ var touchfor = e.originalEvent.changedTouches[0]; //for 的手指数组
|
|
|
+ var acrossWidthX = touchfor.pageY * (1280 / voheight);
|
|
|
+ var acrossHeightY = 720 - touchfor.pageX * (720 / vowidth);
|
|
|
+ var verticalWidthX = touchfor.pageX * (720 / vowidth);
|
|
|
+ var verticalHeightY = touchfor.pageY * (1280 / voheight);
|
|
|
+ var ping = resolving == 0 ?
|
|
|
+ {"data":{"action": 2, "count": ongoingTouches.length, "id": touchfor.identifier, "x": acrossWidthX.toFixed(2), "y": acrossHeightY.toFixed(2)},"type": "event"} :
|
|
|
+ {"data":{"action": 2, "count": ongoingTouches.length, "id": touchfor.identifier, "x": verticalWidthX.toFixed(2), "y": verticalHeightY.toFixed(2)},"type": "event"};
|
|
|
+ wsss.send(JSON.stringify(ping));
|
|
|
};
|
|
|
|
|
|
//鼠标离开区域以外 除了涂鸦 都清空
|
|
@@ -301,4 +206,4 @@ function GetRequest() {
|
|
|
}
|
|
|
}
|
|
|
return obj;
|
|
|
-}
|
|
|
+}
|