|
@@ -1,110 +1,40 @@
|
|
|
-//画布
|
|
|
-var canvas;
|
|
|
-var context;
|
|
|
//蒙版
|
|
|
-var canvas_bak = document.getElementById("box");;
|
|
|
-var context_bak;
|
|
|
+var canvas_bak = document.getElementById("box");
|
|
|
|
|
|
-var canvasWidth = 720;
|
|
|
-var canvasHeight = 1280;
|
|
|
+var winHeight = window.screen.height - window.innerHeight;
|
|
|
+var vowidth = window.screen.width;
|
|
|
+var topwinHeightDraw = window.screen.height - window.innerHeight + 30; // 计算title top 头部
|
|
|
+var numse = window.screen.height;
|
|
|
|
|
|
-var canvasTop;
|
|
|
-var canvasLeft;
|
|
|
-var winHeight = window.screen.height - window.innerHeight
|
|
|
-var vowidth = window.screen.width
|
|
|
-var topwinHeightDraw = window.screen.height - window.innerHeight + 30; //计算title top 头部
|
|
|
-var numse = window.screen.height //-winHeight
|
|
|
-
|
|
|
-//计算title top 头部
|
|
|
+// 计算title top 头部
|
|
|
if (numse <= 70) {
|
|
|
-
|
|
|
var voheight = window.screen.height - winHeight - 34 - 20
|
|
|
} else {
|
|
|
- console.log("numse>>>", numse)
|
|
|
var voheight = window.screen.height - topwinHeightDraw - 20
|
|
|
}
|
|
|
|
|
|
-//console.log("画笔大小>>>",window.innerHeight)
|
|
|
-//画笔大小
|
|
|
-var size = 1;
|
|
|
-var color = '#000000';
|
|
|
-var resolving
|
|
|
-//alert(winHeight)
|
|
|
-var url = window.location.href;
|
|
|
-url = url.split('/')
|
|
|
-
|
|
|
-var query = window.location.search.substring(1);
|
|
|
-// debugger
|
|
|
-// query = "clientType=3&username=WqXTc1593762177&userCardId=377"
|
|
|
-// debugger
|
|
|
-var vars = query.split("&");
|
|
|
-var data = {}
|
|
|
-var clientType = vars.find(e => {
|
|
|
- return e.startsWith('clientType')
|
|
|
-}) || ''
|
|
|
-var cardIp = vars.find(e => {
|
|
|
- return e.startsWith('cardIp')
|
|
|
-}) || ''
|
|
|
-var port = vars.find(e => {
|
|
|
- return e.startsWith('port')
|
|
|
-}) || ''
|
|
|
-
|
|
|
-var sn = vars.find(e => {
|
|
|
- return e.startsWith('sn')
|
|
|
-}) || ''
|
|
|
-var username = vars.find(e => {
|
|
|
- return e.startsWith('username')
|
|
|
-}) || ''
|
|
|
-var userCardId = vars.find(e => {
|
|
|
- return e.startsWith('userCardId')
|
|
|
-}) || ''
|
|
|
-var ip = vars.find(e => {
|
|
|
- return e.startsWith('ip')
|
|
|
-}) || ''
|
|
|
+// 画笔大小
|
|
|
+var resolving;
|
|
|
|
|
|
-var data = {}
|
|
|
-data.clientType = clientType.substring(11, clientType.length)
|
|
|
+var url = window.location.href;
|
|
|
+url = url.split('/');
|
|
|
|
|
|
-data.cardIp = cardIp.substring(7, cardIp.length)
|
|
|
+var parameters = GetRequest();
|
|
|
+var form = {};
|
|
|
|
|
|
-data.port = port.substring(5, port.length)
|
|
|
+form.clientType = parameters["clientType"];
|
|
|
+form.cardIp = parameters["cardIp"];
|
|
|
+form.port = parameters["port"];
|
|
|
+form.sn = parameters["sn"];
|
|
|
+form.username = parameters["username"];
|
|
|
+form.userCardId = parameters["userCardId"];
|
|
|
+form.ip = parameters["ip"];
|
|
|
|
|
|
-data.sn = sn.substring(3, sn.length)
|
|
|
-data.username = username.substring(9, username.length)
|
|
|
-data.userCardId = userCardId.substring(11, userCardId.length)
|
|
|
-data.ip = ip.substring(3, ip.length)
|
|
|
-// var urlss=url[2]
|
|
|
-// urlss = "14.215.128.96"
|
|
|
-urlss = '192.168.31.20'
|
|
|
-// urlss = 'test.androidscloud.com'
|
|
|
-// debugger
|
|
|
-// var cUrl = ''
|
|
|
-// cUrl = "ws://192.168.11.66:9101";
|
|
|
-// var cUrl="wss://www.ted2018.com:9101"
|
|
|
-// var cUrl = "ws://192.168.198.21:9101"
|
|
|
-var cUrl = "ws://192.168.198.82:9100/card?cardIp=" + data.ip;
|
|
|
-// if (data.clientType == 3) {
|
|
|
-// cUrl = "wss://" + urlss + "/authControlWebSocket?" + "clientType=" + data.clientType + "&username=" + data.username +
|
|
|
-// "&userCardId=" + data.userCardId
|
|
|
-// } else if (data.clientType == 2) {
|
|
|
-// // cUrl = "wss://" + urlss + "/shareWebSocket?" + "clientType=" + data.clientType + "&username=" + data.username +
|
|
|
-// // "&userCardId=" + data.userCardId + "&ip=" + data.ip
|
|
|
-// cUrl = "wss://test.androidscloud.com/videoWebSocket?clientType=1&cardIp=14.215.128.96&port=2005&sn=RK3930C2301900005";
|
|
|
-// } else {
|
|
|
-// cUrl = "wss://" + urlss + "/controlWebSocket?" + "clientType=" + data.clientType + "&cardIp=" + data.cardIp + "&port=" +
|
|
|
-// data.port + "&sn=" + data.sn
|
|
|
-// }
|
|
|
-console.log(cUrl, 'curl')
|
|
|
-// var cUrl = Number(data.clientType) === 3? "ws://"+urlss+"/authControlWebSocket?"+"clientType="+data.clientType+"&username="+data.username+"&userCardId="+data.userCardId : "ws://"+urlss+"/controlWebSocket?"+"clientType="+data.clientType+"&cardIp="+data.cardIp+"&port="+data.port+"&sn="+data.sn
|
|
|
+var cUrl = "ws://192.168.199.243/card?cardIp=" + form.ip;
|
|
|
var wsss = new WebSocket(cUrl);
|
|
|
-console.log('wsssss==============', wsss)
|
|
|
wsss.binaryType = 'arraybuffer';
|
|
|
-////
|
|
|
-// wsss = new WebSocket(
|
|
|
-// "ws://14.215.128.96/authControlWebSocket?clientType=3&username=WqXTc1593762177&userCardId=377");
|
|
|
|
|
|
-wsss.onopen = function() {
|
|
|
- console.log("onopen==============");
|
|
|
+wsss.onopen = function () {
|
|
|
var pings = {
|
|
|
"event": "getScreenStatus"
|
|
|
}
|
|
@@ -115,32 +45,21 @@ wsss.onopen = function() {
|
|
|
},
|
|
|
"event": "bitRate"
|
|
|
}
|
|
|
- // wsss.send(JSON.stringify(bitRate));
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(bitRate),data.sn))
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(bitRate), form.sn))
|
|
|
};
|
|
|
-// wsss.onmessage = function(event) {
|
|
|
-// // console.log("onMessage==============", event);
|
|
|
-// // var resets = JSON.parse(event.data)
|
|
|
-// // var resets = event.data;
|
|
|
-// // resets.errorMsg && alert(resets.errorMsg)
|
|
|
-// // resolving = resets.data.orientation
|
|
|
-// // if (resolving == 1) {} else {}
|
|
|
-// // console.log('>>>resolvingresolvingresolving', resolving)
|
|
|
|
|
|
-// };
|
|
|
-wsss.onclose = function(event) {
|
|
|
+wsss.onclose = function (event) {
|
|
|
console.log("onclose==============");
|
|
|
};
|
|
|
-wsss.onerror = function(event) {
|
|
|
+wsss.onerror = function (event) {
|
|
|
console.log("onerror==============");
|
|
|
};
|
|
|
-$('#box').on("click", function() {
|
|
|
-
|
|
|
+$('#box').on("click", function () {
|
|
|
draw_graph('pencil', this)
|
|
|
})
|
|
|
//剪切板
|
|
|
-$(".upload").on("click", function() {
|
|
|
- let texts = $(this).attr("data-text")
|
|
|
+$(".upload").on("click", function () {
|
|
|
+ var texts = $(this).attr("data-text")
|
|
|
if (texts == "uploads") {
|
|
|
$(".mainbox").css({
|
|
|
"display": "block"
|
|
@@ -148,94 +67,56 @@ $(".upload").on("click", function() {
|
|
|
$(".sbox").css({
|
|
|
"display": "none"
|
|
|
})
|
|
|
- } else if (texts == "Signout") {
|
|
|
- // alert()
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
|
|
|
//home 控制home
|
|
|
-$(".botmat1img").on("click", function() {
|
|
|
- let codes = $(this).attr("data-text")
|
|
|
- console.log(codes)
|
|
|
+$(".botmat1img").on("click", function () {
|
|
|
+ var codes = $(this).attr("data-text")
|
|
|
if (codes == "home") {
|
|
|
- // var bitRate = {
|
|
|
- // "data": {
|
|
|
- // "keyCode": 3
|
|
|
- // },
|
|
|
- // "event": "keyCode"
|
|
|
- // }
|
|
|
- // console.log("打印主页json", JSON.stringify(bitRate))
|
|
|
- wsss.send(ExexuteKeyBoard(3),data.sn);
|
|
|
- // console.log("打印主页json", wsss)
|
|
|
+ wsss.send(ExexuteKeyBoard(3), form.sn);
|
|
|
} else if (codes == "return") {
|
|
|
- // var bitRate = {
|
|
|
- // "data": {
|
|
|
- // "keyCode": "4"
|
|
|
- // },
|
|
|
- // "event": "keyCode"
|
|
|
- // }
|
|
|
- // wsss.send(JSON.stringify(bitRate));
|
|
|
- wsss.send(ExexuteKeyBoard(4),data.sn);
|
|
|
+ wsss.send(ExexuteKeyBoard(4), form.sn);
|
|
|
} else if (codes == "gengduo") {
|
|
|
- // var bitRate = {
|
|
|
- // "data": {
|
|
|
- // "keyCode": "187"
|
|
|
- // },
|
|
|
- // "event": "keyCode"
|
|
|
- // }
|
|
|
- // wsss.send(JSON.stringify(bitRate));
|
|
|
- wsss.send(ExexuteKeyBoard(187),data.sn);
|
|
|
+ wsss.send(ExexuteKeyBoard(187), form.sn);
|
|
|
}
|
|
|
|
|
|
})
|
|
|
//高清控制
|
|
|
-$(".PictureQuality").on("click", function() {
|
|
|
+$(".PictureQuality").on("click", function () {
|
|
|
$(this).addClass("avit").siblings().removeClass('avit')
|
|
|
- let id = $(this).attr("data-id")
|
|
|
+ var id = $(this).attr("data-id")
|
|
|
var bitRate = {
|
|
|
"data": {
|
|
|
"bitRate": id
|
|
|
},
|
|
|
"event": "bitRate"
|
|
|
}
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(bitRate),data.sn))
|
|
|
- console.log(id)
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(bitRate), form.sn))
|
|
|
})
|
|
|
|
|
|
//画图形
|
|
|
-var draw_graph = function(graphType, obj) {
|
|
|
- console.log('111》》》', graphType)
|
|
|
+var draw_graph = function (graphType, obj) {
|
|
|
//把蒙版放于画板上面
|
|
|
- //$("#canvas_bak").css("z-index",1);
|
|
|
$("#container").css("z-index", 30);
|
|
|
$("#dedit").css("z-index", 20);
|
|
|
- //先画在蒙版上 再复制到画布上
|
|
|
-
|
|
|
- chooseImg(obj);
|
|
|
var canDraw = false;
|
|
|
-
|
|
|
- var startX;
|
|
|
- var startY;
|
|
|
-
|
|
|
//鼠标按下获取 开始xy开始画图
|
|
|
- var touchstart = function(e) {
|
|
|
+ var touchstart = function (e) {
|
|
|
$('.control-right-img').attr({
|
|
|
"data-id": "2"
|
|
|
})
|
|
|
$(".leftmains").css({
|
|
|
"right": "-4rem"
|
|
|
})
|
|
|
- // .toFixed(2)
|
|
|
var touchfor = e.originalEvent.targetTouches; //for 的手指数组
|
|
|
- var touch = e.originalEvent.targetTouches[0];
|
|
|
- var thochlethng = e.originalEvent.targetTouches.length
|
|
|
+
|
|
|
//是否横屏
|
|
|
if (resolving == 0) {
|
|
|
- let ping
|
|
|
- for (let i = 0; i < touchfor.length; i++) {
|
|
|
- let cawidthXs = touchfor[i].pageY * (1280 / voheight)
|
|
|
- let caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
|
|
|
+ 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,
|
|
@@ -247,14 +128,12 @@ var draw_graph = function(graphType, obj) {
|
|
|
"event": "0"
|
|
|
}
|
|
|
}
|
|
|
- // wsss.send(JSON.stringify(ping));
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(ping),data.sn))
|
|
|
- console.log("鼠标按下>>>", ping)
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(ping), form.sn))
|
|
|
} else {
|
|
|
- let ping
|
|
|
- for (let i = 0; i < touchfor.length; i++) {
|
|
|
- let cawidthXs = touchfor[i].pageX * (720 / vowidth)
|
|
|
- let caheightYs = touchfor[i].pageY * (1280 / voheight)
|
|
|
+ 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,
|
|
@@ -267,27 +146,20 @@ var draw_graph = function(graphType, obj) {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- // wsss.send(JSON.stringify(ping));
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(ping),data.sn))
|
|
|
- console.log("鼠标按下>>>", ping)
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(ping), form.sn));
|
|
|
}
|
|
|
-
|
|
|
canDraw = true;
|
|
|
-
|
|
|
};
|
|
|
|
|
|
//鼠标离开 把蒙版canvas的图片生成到canvas中
|
|
|
- var touchend = function(e) {
|
|
|
+ var touchend = function (e) {
|
|
|
var touchfor = e.originalEvent.changedTouches; //for 的手指数组
|
|
|
- var touch = e.originalEvent.changedTouches[0];
|
|
|
- var thochlethng = e.originalEvent.changedTouches.length
|
|
|
- // alert(thochlethng)
|
|
|
//是否横屏 morePortionUp
|
|
|
if (resolving == 0) {
|
|
|
- let ping
|
|
|
- for (let i = 0; i < touchfor.length; i++) {
|
|
|
- let cawidthXs = touchfor[i].pageY * (1280 / voheight)
|
|
|
- let caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
|
|
|
+ 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,
|
|
@@ -299,15 +171,12 @@ var draw_graph = function(graphType, obj) {
|
|
|
"event": "1"
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // wsss.send(JSON.stringify(ping));
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(ping),data.sn))
|
|
|
-
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(ping), form.sn));
|
|
|
} else {
|
|
|
- let ping
|
|
|
- for (let i = 0; i < touchfor.length; i++) {
|
|
|
- let cawidthXs = touchfor[i].pageX * (720 / vowidth)
|
|
|
- let caheightYs = touchfor[i].pageY * (1280 / voheight)
|
|
|
+ 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,
|
|
@@ -319,35 +188,26 @@ var draw_graph = function(graphType, obj) {
|
|
|
"event": "1"
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // wsss.send(JSON.stringify(ping));
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(ping),data.sn))
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(ping), form.sn))
|
|
|
}
|
|
|
-
|
|
|
canDraw = false;
|
|
|
-
|
|
|
};
|
|
|
|
|
|
//清空层 云手机超出屏幕的开关
|
|
|
- var clearContext = function(type) {
|
|
|
+ var clearContext = function () {
|
|
|
canDraw = false;
|
|
|
}
|
|
|
|
|
|
// 鼠标移动
|
|
|
- var touchmove = function(e) {
|
|
|
-
|
|
|
+ var touchmove = function (e) {
|
|
|
e = e || window.event;
|
|
|
var touchfor = e.originalEvent.targetTouches; //for 的手指数组
|
|
|
- var touch = e.originalEvent.targetTouches[0];
|
|
|
- var thochlethng = e.originalEvent.targetTouches.length
|
|
|
- let ping
|
|
|
+ var ping;
|
|
|
//是否横屏 morePortionMove
|
|
|
if (resolving == 0) {
|
|
|
- let obj = []
|
|
|
- for (let i = 0; i < touchfor.length; i++) {
|
|
|
- let cawidthXs = touchfor[i].pageY * (1280 / voheight)
|
|
|
- let caheightYs = 720 - touchfor[i].pageX * (720 / vowidth)
|
|
|
-
|
|
|
+ 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,
|
|
@@ -360,14 +220,12 @@ var draw_graph = function(graphType, obj) {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- // wsss.send(JSON.stringify(ping));
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(ping),data.sn))
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(ping), form.sn))
|
|
|
} else {
|
|
|
- let ping
|
|
|
- for (let i = 0; i < touchfor.length; i++) {
|
|
|
- let cawidthXs = touchfor[i].pageX * (720 / vowidth)
|
|
|
- let caheightYs = touchfor[i].pageY * (1280 / voheight)
|
|
|
+ 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,
|
|
@@ -378,27 +236,15 @@ var draw_graph = function(graphType, obj) {
|
|
|
},
|
|
|
"event": "2"
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
- // wsss.send(JSON.stringify(ping));
|
|
|
- wsss.send(ExexuteMove(JSON.stringify(ping),data.sn))
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // var ping = {"data":{"action":2,"count":1,"pointerId":0,"x":cawidthX.toFixed(2),"y":caheightY.toFixed(2)},"event":"2"}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ wsss.send(ExexuteMove(JSON.stringify(ping), form.sn));
|
|
|
+ };
|
|
|
};
|
|
|
|
|
|
//鼠标离开区域以外 除了涂鸦 都清空
|
|
|
- var mouseout = function() {
|
|
|
-
|
|
|
+ var mouseout = function () {
|
|
|
if (graphType != 'handwriting') {
|
|
|
clearContext();
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -409,7 +255,17 @@ var draw_graph = function(graphType, obj) {
|
|
|
$(canvas_bak).bind('mouseout', mouseout);
|
|
|
}
|
|
|
|
|
|
-//选择功能按钮 修改样式
|
|
|
-function chooseImg(obj) {
|
|
|
-
|
|
|
+// 获取url中"?"符后的字串
|
|
|
+function GetRequest() {
|
|
|
+ var url = location.search;
|
|
|
+ var obj = new Object();
|
|
|
+ if (url.indexOf("?") != -1) {
|
|
|
+ var str = url.substr(1);
|
|
|
+ strs = str.split("&");
|
|
|
+ for (var i = 0; i < strs.length; i++) {
|
|
|
+ obj[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return obj;
|
|
|
}
|
|
|
+
|