aboutsummaryrefslogtreecommitdiff
path: root/src/client/DocServer.ts
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2020-01-15 16:08:48 -0500
committerFawn <fangrui_tong@brown.edu>2020-01-15 16:08:48 -0500
commit65e164eaec42d1850de7f5e1eba1d4302c3e8230 (patch)
tree322cbc215c9921c5153d512643d1332c0c1fdffc /src/client/DocServer.ts
parent3cca58612cde96a3082ca8e190fe2166d531d556 (diff)
mobile interface emits events when switched to inking view and when strokes are drawn, currently with dummy callbacks
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r--src/client/DocServer.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index ed7fbd7ba..cfd9612ed 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -1,10 +1,11 @@
import * as OpenSocket from 'socket.io-client';
-import { MessageStore, YoutubeQueryTypes } from "./../server/Message";
+import { MessageStore, YoutubeQueryTypes, GestureContent } from "./../server/Message";
import { Opt, Doc } from '../new_fields/Doc';
import { Utils, emptyFunction } from '../Utils';
import { SerializationHelper } from './util/SerializationHelper';
import { RefField } from '../new_fields/RefField';
import { Id, HandleUpdate } from '../new_fields/FieldSymbols';
+import GestureOverlay from './views/GestureOverlay';
/**
* This class encapsulates the transfer and cross-client synchronization of
@@ -64,6 +65,19 @@ export namespace DocServer {
}
}
+ export namespace Mobile {
+
+ export function dispatchGesturePoints(content: GestureContent) {
+ Utils.Emit(_socket, MessageStore.GesturePoints, content);
+ }
+
+ export function dispatchBoxTrigger(enableBox: boolean) {
+ // _socket.emit("dispatchBoxTrigger");
+ Utils.Emit(_socket, MessageStore.MobileInkBoxTrigger, enableBox);
+ }
+
+ }
+
export function init(protocol: string, hostname: string, port: number, identifier: string) {
_cache = {};
GUID = identifier;
@@ -85,6 +99,12 @@ export namespace DocServer {
Utils.AddServerHandler(_socket, MessageStore.ConnectionTerminated, () => {
alert("Your connection to the server has been terminated.");
});
+ _socket.addEventListener("receiveGesturePoints", (content: GestureContent) => {
+ GestureOverlay.Instance.manualDispatch(content);
+ });
+ _socket.addEventListener("receiveBoxTrigger", (enableBox: boolean) => {
+ GestureOverlay.Instance.showBox(enableBox);
+ });
}
function errorFunc(): never {