forked from jamesshore/lets_code_javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_pointer_event.js
More file actions
30 lines (23 loc) · 801 Bytes
/
client_pointer_event.js
File metadata and controls
30 lines (23 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2016 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.
(function() {
"use strict";
var ServerPointerEvent = require("./server_pointer_event.js");
var ClientPointerEvent = module.exports = function(x, y) {
this._x = x;
this._y = y;
};
ClientPointerEvent.EVENT_NAME = "client_pointer_event";
ClientPointerEvent.prototype.name = function() { return ClientPointerEvent.EVENT_NAME; };
ClientPointerEvent.fromSerializableObject = function(obj) {
return new ClientPointerEvent(obj.x, obj.y);
};
ClientPointerEvent.prototype.toSerializableObject = function() {
return {
x: this._x,
y: this._y
};
};
ClientPointerEvent.prototype.toServerEvent = function(id) {
return new ServerPointerEvent(id, this._x, this._y);
};
}());