1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-07-27 02:59:47 +02:00
This commit is contained in:
lxsang
2018-09-19 00:01:55 +02:00
parent c9ea224f22
commit f1bd204aff
3 changed files with 54 additions and 18 deletions

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.9.3
// Generated by CoffeeScript 1.12.7
(function() {
var APIManager, BaseObject, MarkOn, WVNC, require,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
@ -188,10 +188,18 @@
return me.socket.close();
}
});
return $("#connect").click(function(e) {
$("#connect").click(function(e) {
me.counter = 0;
return me.openSession();
});
($(me.canvas)).css("cursor", "none");
return ($(me.canvas)).mousemove(function(e) {
var rect, x, y;
rect = me.canvas.getBoundingClientRect();
x = Math.floor(e.clientX - rect.left);
y = Math.floor(e.clientY - rect.top);
return me.sendPointEvent(x, y, 0);
});
})["catch"](function(m, s) {
return console.error(m, s);
});
@ -206,9 +214,6 @@
ctx = this.buffer.getContext('2d');
data = ctx.createImageData(w, h);
ctx.putImageData(data, 0, 0);
this.callback = function() {
return me.draw();
};
return this.draw();
};
@ -253,7 +258,7 @@
if (!this.socket) {
return;
}
scale = 0.75;
scale = 1.0;
w = this.buffer.width * scale;
h = this.buffer.height * scale;
this.canvas.width = w;
@ -312,10 +317,24 @@
WVNC.prototype.initConnection = function() {
var vncserver;
vncserver = "localhost:5901";
vncserver = "192.168.1.8:5900";
return this.socket.send(this.buildCommand(0x01, vncserver));
};
WVNC.prototype.sendPointEvent = function(x, y, mask) {
var data;
if (!this.socket) {
return;
}
data = new Uint8Array(5);
data[0] = x & 0xFF;
data[1] = x >> 8;
data[2] = y & 0xFF;
data[3] = y >> 8;
data[4] = 0;
return this.socket.send(this.buildCommand(0x05, data));
};
WVNC.prototype.buildCommand = function(hex, o) {
var cmd, data;
data = void 0;
@ -348,7 +367,7 @@
return console.log("Error", dec.decode(data));
case 0x81:
console.log("Request for password");
pass = "!x$@n9";
pass = "sang";
return this.socket.send(this.buildCommand(0x02, pass));
case 0x82:
console.log("Request for login");