From 4bcefa13f3e2d48cd6a7ca77af32ae4f3917fbfb Mon Sep 17 00:00:00 2001
From: Lionel Han <47760119+IGoByJoe@users.noreply.github.com>
Date: Sun, 7 Jun 2020 23:45:45 -0700
Subject: added color picker (bit buggy)
---
src/mobile/MobileInterface.tsx | 177 ++++-------------------------------------
src/mobile/MobileMenu.scss | 61 +++++++++++++-
2 files changed, 74 insertions(+), 164 deletions(-)
(limited to 'src')
diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx
index 6b75ce07d..8a0432d06 100644
--- a/src/mobile/MobileInterface.tsx
+++ b/src/mobile/MobileInterface.tsx
@@ -34,6 +34,9 @@ import { InkTool } from '../fields/InkField';
import { listSpec } from '../fields/Schema';
import { nullAudio, WebField } from '../fields/URLField';
import GestureOverlay from "../client/views/GestureOverlay";
+import { SelectionManager } from "../client/util/SelectionManager";
+import { SketchPicker } from "react-color";
+import { ScriptField } from "../fields/ScriptField";
library.add(faTasks, faEdit, faTrashAlt, faPalette, faAngleRight, faBell, faTrash, faCamera, faExpand, faCaretDown, faCaretLeft, faCaretRight, faCaretSquareDown, faCaretSquareRight, faArrowsAltH, faPlus, faMinus,
faTerminal, faToggleOn, fileSolid, faExternalLinkAlt, faLocationArrow, faSearch, faFileDownload, faStop, faCalculator, faWindowMaximize, faAddressCard,
@@ -498,137 +501,6 @@ library.add(faTasks, faEdit, faTrashAlt, faPalette, faAngleRight, faBell, faTras
// // );
// // }
-// renderDefaultContent = () => {
-// let menuButtons = DocListCast(this._homeDoc.data).map((doc: Doc, index: any) => {
-// if (doc.type !== "ink") {
-// return (
-//
doc.click}>{doc.title}
-//
);
-// }
-// });
-
-// if (this._homeMenu === true) {
-// return (
-//
-//
-//
-//
-//
-//
-// {this.renderPathbar()}
-//
-//
-// );
-// }
-// const workspaces = Cast(this.userDoc.myWorkspaces, Doc) as Doc;
-// let buttons = DocListCast(workspaces.data).map((doc: Doc, index: any) => {
-// if (doc.type !== "ink") {
-// return (
-// this.handleClick(doc)}>{doc.title}
-//
{doc.type}
-//
-//
);
-// }
-// });
-
-// if (this._child) {
-// buttons = DocListCast(this._child.data).map((doc: Doc, index: any) => {
-// if (doc.type !== "ink") {
-// return (
-// this.handleClick(doc)}>{doc.title}
-//
{doc.type}
-//
-//
);
-// }
-// });
-// }
-
-// if (!this._child) {
-// return (
-//
-//
-//
-//
-//
-//
-// {this.renderPathbar()}
-//
-// {/*
-// {this.renderView}
-//
*/}
-//
-// );
-// }
-// else {
-// return (
-//
-//
-//
-//
-//
-//
-// {this.renderPathbar()}
-//
-//
-// );
-// }
-// }
-
// recordAudio = async () => {
// // upload to server with known URL
// if (this._activeDoc.title !== "mobile audio") {
@@ -1079,6 +951,7 @@ export class MobileInterface extends React.Component {
@observable private mainDoc: any = CurrentUserUtils.setupMobileMenu();
@observable private renderView?: () => JSX.Element;
@observable private audioState: any;
+ @observable private activeToolbar: boolean = false;
public _activeDoc: Doc = this.mainDoc;
public _homeDoc: Doc = this.mainDoc;
@@ -1466,7 +1339,7 @@ export class MobileInterface extends React.Component {
doc.click}>{doc.title}
+ onClick={() => doc.proto?.onClick}>{doc.title}
);
}
});
@@ -1603,48 +1476,26 @@ export class MobileInterface extends React.Component {
}
}
- toggleSelector = () => {
- console.log("toggle selector!");
- let toolbar = document.getElementById("toolbar") as HTMLElement;
- toolbar.classList.toggle('active');
- }
+
+ @action
+ toggleSelector = () => this.activeToolbar = !this.activeToolbar
+
colorTool = () => {
if (this._activeDoc._viewType === "docking") {
const color = InkingControl.Instance.selectedColor;
- console.log(color);
+ const selDoc = SelectionManager.SelectedDocuments()?.[0]?.rootDoc;
return (