diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/Main.tsx | 21 | ||||
-rw-r--r-- | src/server/RouteStore.ts | 1 | ||||
-rw-r--r-- | src/server/index.ts | 6 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 5ff16b8dc..63cc785e0 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -23,6 +23,7 @@ import { observer } from 'mobx-react'; import { Field, Opt } from '../../fields/Field'; import { InkingControl } from './InkingControl'; import { RouteStore } from '../../server/RouteStore'; +import { json } from 'body-parser'; @observer export class Main extends React.Component { @@ -43,6 +44,7 @@ export class Main extends React.Component { } initEventListeners = () => { + // window.addEventListener("pointermove", (e) => this.reportLocation(e)) window.addEventListener("drop", (e) => e.preventDefault(), false) // drop event handler window.addEventListener("dragover", (e) => e.preventDefault(), false) // drag event handler // click interactions for the context menu @@ -71,6 +73,24 @@ export class Main extends React.Component { }); } + // reportLocation = (e: PointerEvent) => { + // request.post(this.prepend(RouteStore.updateCursor), { + // body: { + // cursorX: e.screenX, + // cursorY: e.screenY, + // docId: this.mainContainer ? this.mainContainer.Id : undefined + // }, + // json: true + // }); + // } + + // componentWillUnmount = () => { + + // } + + // pushCursor = () => { + // } + @action createNewWorkspace = (init: boolean): void => { let mainDoc = Documents.DockDocument(JSON.stringify({ content: [{ type: 'row', content: [] }] }), { title: `Main Container ${this.userWorkspaces.length + 1}` }); @@ -108,6 +128,7 @@ export class Main extends React.Component { }); this.mainContainer = doc; this.mainContainer.GetAsync(KeyStore.ActiveFrame, field => this.mainfreeform = field as Document); + // this.pushCursor(); } toggleWorkspaces = () => { diff --git a/src/server/RouteStore.ts b/src/server/RouteStore.ts index ace2152d7..4842da51a 100644 --- a/src/server/RouteStore.ts +++ b/src/server/RouteStore.ts @@ -17,6 +17,7 @@ export enum RouteStore { getAllWorkspaces = "/getAllWorkspaceIds", getActiveWorkspace = "/getActiveWorkspaceId", setActiveWorkspace = "/setActiveWorkspaceId", + updateCursor = "/updateCursor", // AUTHENTICATION signup = "/signup", diff --git a/src/server/index.ts b/src/server/index.ts index d710ac875..70b794e35 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -39,6 +39,7 @@ import User, { DashUserModel } from './authentication/models/user_model'; import * as fs from 'fs'; import * as request from 'request' import { RouteStore } from './RouteStore'; +import * as MobileDetect from 'mobile-detect'; const download = (url: string, dest: fs.PathLike) => { request.get(url).pipe(fs.createWriteStream(dest)); @@ -144,6 +145,10 @@ addSecureRoute(Method.GET, RouteStore.root, (user, req, res) => { // YAY! SHOW THEM THEIR WORKSPACES NOW addSecureRoute(Method.GET, RouteStore.home, (user, req, res) => { + let detector = new MobileDetect(req.headers['user-agent'] || ""); + console.log("GAAAAAAHHHHH"); + console.log(detector.mobile()); + console.log(detector.is("mobile")); res.sendFile(path.join(__dirname, '../../deploy/index.html')); }); @@ -156,6 +161,7 @@ addSecureRoute(Method.GET, RouteStore.getAllWorkspaces, (user, req, res) => { }); addSecureRoute(Method.POST, RouteStore.setActiveWorkspace, (user, req) => { + req user.update({ $set: { activeWorkspaceId: req.body.target } }, () => { }); }); |