aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/CurrentUserUtils.ts1
-rw-r--r--src/client/util/InteractionUtils.tsx4
-rw-r--r--src/client/views/InkingStroke.tsx4
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx2
-rw-r--r--src/client/views/collections/CollectionView.tsx2
-rw-r--r--src/client/views/collections/CollectionViewChromes.tsx2
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx4
-rw-r--r--src/client/views/nodes/DocumentView.tsx44
-rw-r--r--src/mobile/ImageUpload.tsx40
-rw-r--r--src/mobile/MobileInterface.tsx84
-rw-r--r--src/pen-gestures/ndollar.ts2
11 files changed, 122 insertions, 67 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 7b867ed02..b7da4ae2f 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -469,6 +469,7 @@ export class CurrentUserUtils {
{ title: "RECORD", icon: "microphone", click: 'openMobileAudio()', backgroundColor: "#ffbfbf", info: "Use your phone to record and upload audio onto Dash Web." },
{ title: "UPLOAD", icon: "upload", click: 'uploadImageMobile()', backgroundColor: "#ff9e9e", info: "Upload images or videos from your mobile device so they can be accessed on Dash Web." },
{ title: "PRESENTATION", icon: "desktop", click: 'openMobilePresentation()', backgroundColor: "#ff8080", info: "Use your phone as a remote for you presentation." },
+ { title: "MOBILE UPLOAD", icon: "mobile", click: 'switchToMobileUploads()', backgroundColor: "#ff7373", info: "Access the collection of your mobile uploads." },
{ title: "SETTINGS", icon: "cog", click: 'openMobileSettings()', backgroundColor: "#ff5e5e", info: "Change your password, log out, or manage your account security." }
];
return docProtoData.filter(d => !buttons || !buttons.includes(d.title)).map(data =>
diff --git a/src/client/util/InteractionUtils.tsx b/src/client/util/InteractionUtils.tsx
index aeb0f670d..3b42fcaee 100644
--- a/src/client/util/InteractionUtils.tsx
+++ b/src/client/util/InteractionUtils.tsx
@@ -96,9 +96,9 @@ export namespace InteractionUtils {
}
else if (points.length > 1 && points[points.length - 1].X === points[0].X && points[points.length - 1].Y === points[0].Y) {
//pointer is up (first and last points are the same)
- points.pop();
+ //points.pop();
const newPoints = points.reduce((p, pts) => { p.push([pts.X, pts.Y]); return p; }, [] as number[][]);
-
+ newPoints.pop();
const bezierCurves = fitCurve(newPoints, parseInt(bezier));
for (var i = 0; i < bezierCurves.length; i++) {
for (var t = 0; t < 1; t += 0.01) {
diff --git a/src/client/views/InkingStroke.tsx b/src/client/views/InkingStroke.tsx
index 7e3bd1c17..5129ef65d 100644
--- a/src/client/views/InkingStroke.tsx
+++ b/src/client/views/InkingStroke.tsx
@@ -68,8 +68,8 @@ export class InkingStroke extends ViewBoxBaseComponent<FieldViewProps, InkDocume
mixBlendMode: this.layoutDoc.tool === InkTool.Highlighter ? "multiply" : "unset"
}}
onContextMenu={() => {
- ContextMenu.Instance.addItem({ description: "Analyze Stroke", event: this.analyzeStrokes, icon: "paint-brush" });
- ContextMenu.Instance.addItem({ description: "Make Mask", event: this.makeMask, icon: "paint-brush" });
+ ContextMenu.Instance?.addItem({ description: "Analyze Stroke", event: this.analyzeStrokes, icon: "paint-brush" });
+ ContextMenu.Instance?.addItem({ description: "Make Mask", event: this.makeMask, icon: "paint-brush" });
}}
><defs>
<filter id="dangerShine">
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index c2e297f61..657e2a08b 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -790,7 +790,7 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
if (this._mainCont && this._mainCont.children) {
const { translateX, translateY } = Utils.GetScreenTransform(this._mainCont.children[0].firstChild as HTMLElement);
const scale = Utils.GetScreenTransform(this._mainCont).scale;
- return CollectionDockingView.Instance.props.ScreenToLocalTransform().translate(-translateX, -translateY).scale(1 / this.contentScaling() / scale);
+ return CollectionDockingView.Instance?.props.ScreenToLocalTransform().translate(-translateX, -translateY).scale(1 / this.contentScaling() / scale);
}
return Transform.Identity();
}
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 7c5c87e3e..0a84e6f72 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -286,7 +286,7 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
const more = ContextMenu.Instance?.findByDescription("More...");
const moreItems = more && "subitems" in more ? more.subitems : [];
moreItems.push({ description: "Export Image Hierarchy", icon: "columns", event: () => ImageUtils.ExportHierarchyToFileSystem(this.props.Document) });
- !more && ContextMenu.Instance.addItem({ description: "More...", subitems: moreItems, icon: "hand-point-right" });
+ !more && ContextMenu.Instance?.addItem({ description: "More...", subitems: moreItems, icon: "hand-point-right" });
}
}
}
diff --git a/src/client/views/collections/CollectionViewChromes.tsx b/src/client/views/collections/CollectionViewChromes.tsx
index 48810f1e9..ec908f034 100644
--- a/src/client/views/collections/CollectionViewChromes.tsx
+++ b/src/client/views/collections/CollectionViewChromes.tsx
@@ -300,7 +300,7 @@ export class CollectionViewBaseChrome extends React.Component<CollectionViewChro
render() {
const collapsed = this.props.CollectionView.props.Document._chromeStatus !== "enabled";
- const scale = Math.min(1, this.props.CollectionView.props.ScreenToLocalTransform().Scale);
+ const scale = Math.min(1, this.props.CollectionView.props.ScreenToLocalTransform()?.Scale);
return (
<div className="collectionViewChrome-cont" style={{
top: collapsed ? -70 : 0, height: collapsed ? 0 : undefined,
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 327e172bb..bed871f8d 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1205,7 +1205,7 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
}), icon: this._timelineVisible ? faEyeSlash : faEye
});
- const options = ContextMenu.Instance.findByDescription("Options...");
+ const options = ContextMenu.Instance?.findByDescription("Options...");
const optionItems: ContextMenuProps[] = options && "subitems" in options ? options.subitems : [];
optionItems.push({ description: "reset view", event: () => { this.props.Document._panX = this.props.Document._panY = 0; this.props.Document[this.scaleFieldKey] = 1; }, icon: "compress-arrows-alt" });
@@ -1246,7 +1246,7 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
}
});
optionItems.push({ description: `${this.Document._LODdisable ? "Enable LOD" : "Disable LOD"}`, event: () => this.Document._LODdisable = !this.Document._LODdisable, icon: "table" });
- ContextMenu.Instance.addItem({ description: "Options...", subitems: optionItems, icon: "eye" });
+ ContextMenu.Instance?.addItem({ description: "Options...", subitems: optionItems, icon: "eye" });
}
@observable _timelineVisible = false;
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index e027b6a0f..2f868d558 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -708,40 +708,40 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
onContextMenu = async (e: React.MouseEvent | Touch): Promise<void> => {
// the touch onContextMenu is button 0, the pointer onContextMenu is button 2
if (!(e instanceof Touch)) {
- if (e.button === 0 && !e.ctrlKey) {
- e.preventDefault();
+ if (e?.button === 0 && !e.ctrlKey) {
+ e?.preventDefault();
return;
}
- e.persist();
+ e?.persist();
e?.stopPropagation();
- if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3 ||
- e.isDefaultPrevented()) {
- e.preventDefault();
+ if (Math.abs(this._downX - e?.clientX) > 3 || Math.abs(this._downY - e?.clientY) > 3 ||
+ e?.isDefaultPrevented()) {
+ e?.preventDefault();
return;
}
- e.preventDefault();
+ e?.preventDefault();
}
const cm = ContextMenu.Instance;
const customScripts = Cast(this.props.Document.contextMenuScripts, listSpec(ScriptField), []);
Cast(this.props.Document.contextMenuLabels, listSpec("string"), []).forEach((label, i) =>
- cm.addItem({ description: label, event: () => customScripts[i]?.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" }));
+ cm?.addItem({ description: label, event: () => customScripts[i]?.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" }));
this.props.contextMenuItems?.().forEach(item =>
- cm.addItem({ description: item.label, event: () => item.script.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" }));
+ cm?.addItem({ description: item.label, event: () => item.script.script.run({ this: this.layoutDoc, self: this.rootDoc }), icon: "sticky-note" }));
- let options = cm.findByDescription("Options...");
+ let options = cm?.findByDescription("Options...");
const optionItems: ContextMenuProps[] = options && "subitems" in options ? options.subitems : [];
const templateDoc = Cast(this.props.Document[StrCast(this.props.Document.layoutKey)], Doc, null);
optionItems.push({ description: "Open Fields ", event: () => this.props.addDocTab(Docs.Create.KVPDocument(this.props.Document, { _width: 300, _height: 300 }), "onRight"), icon: "layer-group" });
templateDoc && optionItems.push({ description: "Open Template ", event: () => this.props.addDocTab(templateDoc, "onRight"), icon: "eye" });
if (!options) {
options = { description: "Options...", subitems: optionItems, icon: "compass" };
- cm.addItem(options);
+ cm?.addItem(options);
}
- const existingOnClick = cm.findByDescription("OnClick...");
+ const existingOnClick = cm?.findByDescription("OnClick...");
const onClicks: ContextMenuProps[] = existingOnClick && "subitems" in existingOnClick ? existingOnClick.subitems : [];
onClicks.push({ description: "Enter Portal", event: this.makeIntoPortal, icon: "window-restore" });
onClicks.push({ description: "Toggle Detail", event: () => this.Document.onClick = ScriptField.MakeScript(`toggleDetail(self, "${this.props.Document.layoutKey}")`), icon: "window-restore" });
@@ -750,17 +750,17 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
onClicks.push({ description: this.Document.isLinkButton ? "Remove Follow Behavior" : "Follow Link on Right", event: this.toggleFollowOnRight, icon: "concierge-bell" });
onClicks.push({ description: this.Document.isLinkButton || this.Document.onClick ? "Remove Click Behavior" : "Follow Link", event: this.toggleLinkButtonBehavior, icon: "concierge-bell" });
onClicks.push({ description: "Edit onClick Script", event: () => UndoManager.RunInBatch(() => DocUtils.makeCustomViewClicked(this.props.Document, undefined, "onClick"), "edit onClick"), icon: "edit" });
- !existingOnClick && cm.addItem({ description: "OnClick...", subitems: onClicks, icon: "hand-point-right" });
+ !existingOnClick && cm?.addItem({ description: "OnClick...", subitems: onClicks, icon: "hand-point-right" });
const funcs: ContextMenuProps[] = [];
if (this.Document.onDragStart) {
funcs.push({ description: "Drag an Alias", icon: "edit", event: () => this.Document.dragFactory && (this.Document.onDragStart = ScriptField.MakeFunction('getAlias(this.dragFactory)')) });
funcs.push({ description: "Drag a Copy", icon: "edit", event: () => this.Document.dragFactory && (this.Document.onDragStart = ScriptField.MakeFunction('getCopy(this.dragFactory, true)')) });
funcs.push({ description: "Drag Document", icon: "edit", event: () => this.Document.onDragStart = undefined });
- cm.addItem({ description: "OnDrag...", subitems: funcs, icon: "asterisk" });
+ cm?.addItem({ description: "OnDrag...", subitems: funcs, icon: "asterisk" });
}
- const more = cm.findByDescription("More...");
+ const more = cm?.findByDescription("More...");
const moreItems = more && "subitems" in more ? more.subitems : [];
if (!Doc.UserDoc().noviceMode) {
moreItems.push({ description: "Make View of Metadata Field", event: () => Doc.MakeMetadataFieldTemplate(this.props.Document, this.props.DataDoc), icon: "concierge-bell" });
@@ -789,26 +789,26 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
moreItems.push({ description: "Copy ID", event: () => Utils.CopyText(Utils.prepend("/doc/" + this.props.Document[Id])), icon: "fingerprint" });
moreItems.push({ description: "Delete", event: this.deleteClicked, icon: "trash" });
moreItems.push({ description: "Share", event: () => SharingManager.Instance.open(this), icon: "external-link-alt" });
- !more && cm.addItem({ description: "More...", subitems: moreItems, icon: "hand-point-right" });
- cm.moveAfter(cm.findByDescription("More...")!, cm.findByDescription("OnClick...")!);
+ !more && cm?.addItem({ description: "More...", subitems: moreItems, icon: "hand-point-right" });
+ cm?.moveAfter(cm?.findByDescription("More...")!, cm?.findByDescription("OnClick...")!);
- const help = cm.findByDescription("Help...");
+ const help = cm?.findByDescription("Help...");
const helpItems: ContextMenuProps[] = help && "subitems" in help ? help.subitems : [];
helpItems.push({
description: "Keyboard Shortcuts Ctrl+/",
event: () => this.props.addDocTab(Docs.Create.PdfDocument("http://localhost:1050/assets/cheat-sheet.pdf", { _width: 300, _height: 300 }), "onRight"),
icon: "keyboard"
});
- cm.addItem({ description: "Help...", subitems: helpItems, icon: "question" });
+ cm?.addItem({ description: "Help...", subitems: helpItems, icon: "question" });
- const existingAcls = cm.findByDescription("Privacy...");
+ const existingAcls = cm?.findByDescription("Privacy...");
const aclItems: ContextMenuProps[] = existingAcls && "subitems" in existingAcls ? existingAcls.subitems : [];
aclItems.push({ description: "Make Add Only", event: () => this.setAcl("addOnly"), icon: "concierge-bell" });
aclItems.push({ description: "Make Read Only", event: () => this.setAcl("readOnly"), icon: "concierge-bell" });
aclItems.push({ description: "Make Private", event: () => this.setAcl("ownerOnly"), icon: "concierge-bell" });
aclItems.push({ description: "Test Private", event: () => this.testAcl("ownerOnly"), icon: "concierge-bell" });
aclItems.push({ description: "Test Readonly", event: () => this.testAcl("readOnly"), icon: "concierge-bell" });
- !existingAcls && cm.addItem({ description: "Privacy...", subitems: aclItems, icon: "question" });
+ !existingAcls && cm?.addItem({ description: "Privacy...", subitems: aclItems, icon: "question" });
// const recommender_subitems: ContextMenuProps[] = [];
@@ -869,7 +869,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
// DocumentViews should stop propagation of this event
e.stopPropagation();
}
- ContextMenu.Instance.displayMenu(e.pageX - 15, e.pageY - 15);
+ ContextMenu.Instance?.displayMenu(e.pageX - 15, e.pageY - 15);
!SelectionManager.IsSelected(this, true) && SelectionManager.SelectDoc(this, false);
});
const path = this.props.LibraryPath.reduce((p: string, d: Doc) => p + "/" + (Doc.AreProtosEqual(d, (Doc.UserDoc()["tabs-button-library"] as Doc).sourcePanel as Doc) ? "" : d.title), "");
diff --git a/src/mobile/ImageUpload.tsx b/src/mobile/ImageUpload.tsx
index 744a45507..b712d52cc 100644
--- a/src/mobile/ImageUpload.tsx
+++ b/src/mobile/ImageUpload.tsx
@@ -39,6 +39,7 @@ export class Uploader extends React.Component<ImageUploadProps> {
onClick = async () => {
try {
+ const col = this.props.Document;
await Docs.Prototypes.initialize();
const imgPrev = document.getElementById("img_preview");
// Slab 1
@@ -82,10 +83,11 @@ export class Uploader extends React.Component<ImageUploadProps> {
const field = await DocServer.GetRefField(res);
let pending: Opt<Doc>;
if (field instanceof Doc) {
- const parent = await Cast(this.props.Document.data, listSpec(Doc));
- const u = CurrentUserUtils.setupMobileUpload(this.props.Document);
- if (parent && !parent.includes(u)) parent.push(u);
- pending = await Cast(u, Doc);
+ // if (col === Cast(Doc.UserDoc().rightSidebarCollection, Doc) as Doc) {
+ // pending = await Cast(field.rightSidebarCollection, Doc);
+ // }
+ pending = col;
+ //pending = await Cast(field.col, Doc);
}
if (pending) {
const data = await Cast(pending.data, listSpec(Doc));
@@ -128,33 +130,19 @@ export class Uploader extends React.Component<ImageUploadProps> {
@action
clearUpload = () => {
const slab1 = document.getElementById("slab1");
- if (slab1) {
- slab1.style.opacity = "0.4";
- }
+ if (slab1) slab1.style.opacity = "0.4";
const slab2 = document.getElementById("slab2");
- if (slab2) {
- slab2.style.opacity = "0.4";
- }
+ if (slab2) slab2.style.opacity = "0.4";
const slab3 = document.getElementById("slab3");
- if (slab3) {
- slab3.style.opacity = "0.4";
- }
+ if (slab3) slab3.style.opacity = "0.4";
const slab4 = document.getElementById("slab4");
- if (slab4) {
- slab4.style.opacity = "0.4";
- }
+ if (slab4) slab4.style.opacity = "0.4";
const slab5 = document.getElementById("slab5");
- if (slab5) {
- slab5.style.opacity = "0.4";
- }
+ if (slab5) slab5.style.opacity = "0.4";
const slab6 = document.getElementById("slab6");
- if (slab6) {
- slab6.style.opacity = "0.4";
- }
+ if (slab6) slab6.style.opacity = "0.4";
const slab7 = document.getElementById("slab7");
- if (slab7) {
- slab7.style.opacity = "0.4";
- }
+ if (slab7) slab7.style.opacity = "0.4";
this.nm = "Choose files";
if (inputRef.current) {
@@ -212,5 +200,3 @@ export class Uploader extends React.Component<ImageUploadProps> {
}
}
-
-
diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx
index 612b112e6..84a5975cb 100644
--- a/src/mobile/MobileInterface.tsx
+++ b/src/mobile/MobileInterface.tsx
@@ -121,6 +121,13 @@ export class MobileInterface extends React.Component {
this.sidebarActive = true;
}
+ openWorkspaces = () => {
+ this._parents.push(this._activeDoc);
+ this.switchCurrentView((userDoc: Doc) => this._library);
+ this._activeDoc = this._library;
+ this._homeMenu = false;
+ }
+
/**
* Back method for navigating through items
*/
@@ -217,9 +224,9 @@ export class MobileInterface extends React.Component {
}
/**
- * Note: window.innerWidth and window.screen.width compute different values.
+ * Note: window.innerWidth and window.screen.width compute different values.
* window.screen.width is the display size, however window.innerWidth is the
- * display resolution which computes differently.
+ * display resolution which computes differently.
*/
returnWidth = () => window.innerWidth; //The windows width
returnHeight = () => (window.innerHeight - 300); //Calculating the windows height (-300 to account for topbar)
@@ -231,9 +238,8 @@ export class MobileInterface extends React.Component {
*/
handleClick = async (doc: Doc) => {
const children = DocListCast(doc.data);
- if (doc.type !== "collection" && this.sidebarActive) {
- this.openFromSidebar(doc);
- } else if (doc.type === "collection" && children.length === 0) console.log("This collection has no children");
+ if (doc.type !== "collection" && this.sidebarActive) this.openFromSidebar(doc);
+ else if (doc.type === "collection" && children.length === 0) this.openFromSidebar(doc);
else {
this._parents.push(this._activeDoc);
this._activeDoc = doc;
@@ -248,6 +254,7 @@ export class MobileInterface extends React.Component {
this._activeDoc = doc;
this.switchCurrentView((userDoc: Doc) => doc);
this._homeMenu = false;
+ this._child = doc; //?
this.toggleSidebar();
}
@@ -551,7 +558,7 @@ export class MobileInterface extends React.Component {
}
}
- // Mobile doc button for uploading
+ // Mobile doc button for uploading
upload = () => {
if (this._activeDoc.type === "collection" && this._activeDoc !== this._homeDoc) {
return (
@@ -714,12 +721,48 @@ export class MobileInterface extends React.Component {
@action
toggleAudio = () => this.audioUploadActive = !this.audioUploadActive
+ @action
+ toggleUploadInCollection = () => {
+ const button = document.getElementById("imageButton") as HTMLElement;
+ button.style.backgroundColor = this.imageUploadActive ? "white" : "black";
+ button.style.color = this.imageUploadActive ? "black" : "white";
+
+ this.imageUploadActive = !this.imageUploadActive;
+ }
+
// For closing the image upload pop up
@action
closeUpload = () => {
this.imageUploadActive = false;
}
+ // Returns the image upload pop up
+ uploadImage = () => {
+ if (this.imageUploadActive) {
+ console.log("active");
+ } else if (!this.imageUploadActive) {
+
+ }
+
+ let doc;
+ let toggle;
+ if (this._homeMenu === false) {
+ doc = this._activeDoc;
+ toggle = this.toggleUploadInCollection;
+ } else {
+ doc = Cast(Doc.UserDoc().rightSidebarCollection, Doc) as Doc;
+ toggle = this.toggleUpload;
+ }
+ return (
+ <div>
+ <div className="closeUpload" onClick={toggle}>
+ <FontAwesomeIcon icon="window-close" size={"lg"} />
+ </div>
+ <Uploader Document={doc} />
+ </div>
+ );
+ }
+
displayRadialMenu = () => {
if (this._activeDoc.type === "collection" && this._activeDoc !== this._homeDoc) {
return <RadialMenu />;
@@ -731,12 +774,35 @@ export class MobileInterface extends React.Component {
e.stopPropagation();
}
+ uploadImageButton = () => {
+ if (this._activeDoc.type === "collection" && this._activeDoc !== this._homeDoc && this._activeDoc._viewType !== "docking" && this._activeDoc.title !== "WORKSPACES") {
+ return <div className="docButton"
+ id="imageButton"
+ title={Doc.isDocPinned(this._activeDoc) ? "Pen on" : "Pen off"}
+ onClick={this.toggleUpload}>
+ <FontAwesomeIcon className="documentdecorations-icon" size="sm" icon="upload"
+ />
+ </div>;
+ }
+ }
+
+ switchToMobileUploads = () => {
+ if (this._activeDoc.title !== "Presentation") {
+ this._parents.push(this._activeDoc);
+ }
+ const mobileUpload = Cast(Doc.UserDoc().rightSidebarCollection, Doc) as Doc;
+ console.log(mobileUpload.title);
+ this._activeDoc = mobileUpload;
+ this.switchCurrentView((userDoc: Doc) => mobileUpload);
+ this._homeMenu = false;
+ }
+
render() {
return (
<div className="mobileInterface-container" onDragOver={this.onDragOver}>
<SettingsManager />
<div className={`image-upload ${this.imageUploadActive ? "active" : ""}`}>
- <Uploader Document={this._homeMenu ? this._library : this._activeDoc} />
+ {this.uploadImage()}
</div>
<div className={`audio-upload ${this.audioUploadActive ? "active" : ""}`}>
<AudioUpload />
@@ -750,6 +816,7 @@ export class MobileInterface extends React.Component {
{this.undo()}
{this.redo()}
{this.upload()}
+ {this.uploadImageButton()}
{/* {this.drawInk()} */}
{/* {this.uploadAudioButton()} */}
</div>
@@ -769,5 +836,6 @@ Scripting.addGlobal(function openMobilePresentation() { return MobileInterface.I
Scripting.addGlobal(function toggleMobileSidebar() { return MobileInterface.Instance.toggleSidebar(); });
Scripting.addGlobal(function openMobileAudio() { return MobileInterface.Instance.toggleAudio(); });
Scripting.addGlobal(function openMobileSettings() { return SettingsManager.Instance.open(); });
-Scripting.addGlobal(function switchToLibrary() { return MobileInterface.Instance.switchToLibrary(); });
+Scripting.addGlobal(function openWorkspaces() { return MobileInterface.Instance.openWorkspaces(); });
Scripting.addGlobal(function uploadImageMobile() { return MobileInterface.Instance.toggleUpload(); });
+Scripting.addGlobal(function switchToMobileUploads() { return MobileInterface.Instance.switchToMobileUploads(); });
diff --git a/src/pen-gestures/ndollar.ts b/src/pen-gestures/ndollar.ts
index 9d42035d1..ecd8df3e7 100644
--- a/src/pen-gestures/ndollar.ts
+++ b/src/pen-gestures/ndollar.ts
@@ -552,7 +552,7 @@ function Distance(p1: any, p2: any) // distance between two points
}
function CalcStartUnitVector(points: any, index: any) // start angle from points[0] to points[index] normalized as a unit vector
{
- const v = new Point(points[index].X - points[0].X, points[index].Y - points[0].Y);
+ const v = new Point(points[index]?.X - points[0]?.X, points[index]?.Y - points[0]?.Y);
const len = Math.sqrt(v.X * v.X + v.Y * v.Y);
return new Point(v.X / len, v.Y / len);
}