aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-05-18 09:42:43 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-05-18 09:42:43 -0400
commit718269e2fa50e20227bfbb32b1a1b6ec8f78184d (patch)
treee5962ada2fca04d21527fff58040517da364d723 /src
parenta3fab7b55372dd031a19af0ae583cf6f100c0854 (diff)
fixed font error message. Improved opening summaries as either inTab or inPlace and switching with the alt-key
Diffstat (limited to 'src')
-rw-r--r--src/client/views/ContextMenu.tsx3
-rw-r--r--src/client/views/DocumentDecorations.tsx2
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx7
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx4
-rw-r--r--src/client/views/nodes/CollectionFreeFormDocumentView.tsx30
-rw-r--r--src/client/views/nodes/DocumentView.tsx4
-rw-r--r--src/client/views/nodes/FieldView.tsx2
7 files changed, 30 insertions, 22 deletions
diff --git a/src/client/views/ContextMenu.tsx b/src/client/views/ContextMenu.tsx
index 9ccbb7149..9143c012e 100644
--- a/src/client/views/ContextMenu.tsx
+++ b/src/client/views/ContextMenu.tsx
@@ -5,9 +5,10 @@ import { observer } from "mobx-react"
import "./ContextMenu.scss"
import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { faSearch } from '@fortawesome/free-solid-svg-icons';
+import { faSearch, faCircle } from '@fortawesome/free-solid-svg-icons';
library.add(faSearch);
+library.add(faCircle);
@observer
export class ContextMenu extends React.Component {
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 7083b1003..d440ed898 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -279,7 +279,7 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
iconDoc.proto!.title = selected.length > 1 ? "ICONset" : "ICON" + StrCast(doc.title);
iconDoc.labelField = selected.length > 1 ? undefined : this._fieldKey;
iconDoc.proto![this._fieldKey] = selected.length > 1 ? "collection" : undefined;
- iconDoc.isMinimized = false;
+ iconDoc.proto!.isMinimized = false;
iconDoc.width = Number(MINIMIZED_ICON_SIZE);
iconDoc.height = Number(MINIMIZED_ICON_SIZE);
iconDoc.x = NumCast(doc.x);
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 28624e020..74f8ad242 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -432,8 +432,11 @@ export class DockedFrameRenderer extends React.Component<DockedFrameProps> {
}
get previewPanelCenteringOffset() { return (this._panelWidth - this.nativeWidth() * this.contentScaling()) / 2; }
- addDocTab = (doc: Doc) => {
- CollectionDockingView.Instance.AddTab(this._stack, doc);
+ addDocTab = (doc: Doc, location: string) => {
+ if (location === "onRight")
+ CollectionDockingView.Instance.AddRightSplit(doc);
+ else
+ CollectionDockingView.Instance.AddTab(this._stack, doc);
}
get content() {
if (!this._document) {
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index c3c4115b8..6301fd27e 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -272,9 +272,9 @@ export class MarqueeView extends React.Component<MarqueeViewProps>
newCollection.proto!.summaryDoc = summary;
selected = [newCollection];
newCollection.x = bounds.left + bounds.width;
- this.props.addDocument(newCollection, false);
+ //this.props.addDocument(newCollection, false);
summary.proto!.summarizedDocs = new List<Doc>(selected.map(s => s.proto!));
- //summary.proto!.maximizeOnRight = true;
+ summary.proto!.maximizeLocation = "inTab"; // or "inPlace", or "onRight"
//summary.proto!.isButton = true;
//let scrpt = this.props.getTransform().inverse().transformPoint(bounds.left, bounds.top);
// selected.map(summarizedDoc => {
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index a0efc3154..833947ac3 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -3,7 +3,7 @@ import { observer } from "mobx-react";
import { Doc, DocListCast, DocListCastAsync } from "../../../new_fields/Doc";
import { List } from "../../../new_fields/List";
import { createSchema, listSpec, makeInterface } from "../../../new_fields/Schema";
-import { BoolCast, Cast, FieldValue, NumCast } from "../../../new_fields/Types";
+import { BoolCast, Cast, FieldValue, NumCast, StrCast } from "../../../new_fields/Types";
import { OmitKeys, Utils } from "../../../Utils";
import { DocumentManager } from "../../util/DocumentManager";
import { SelectionManager } from "../../util/SelectionManager";
@@ -139,7 +139,7 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
}
maximizedDocs.map(maximizedDoc => {
let iconAnimating = Cast(maximizedDoc.isIconAnimating, List);
- if (!iconAnimating || (Date.now() - iconAnimating[6] > 1000)) {
+ if (!iconAnimating || (Date.now() - iconAnimating[2] > 1000)) {
if (isMinimized === undefined) {
isMinimized = BoolCast(maximizedDoc.isMinimized, false);
}
@@ -179,10 +179,9 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
}
}
onPointerUp = (e: PointerEvent): void => {
-
document.removeEventListener("pointerup", this.onPointerUp);
if (Math.abs(e.clientX - this._downX) < 2 && Math.abs(e.clientY - this._downY) < 2) {
- this.props.addDocTab(this.props.Document);
+ this.props.addDocTab(this.props.Document, "inTab");
}
e.stopPropagation();
}
@@ -193,6 +192,7 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
Math.abs(e.clientY - this._downY) < Utils.DRAG_THRESHOLD) {
let isExpander = (e.target as any).id === "isExpander";
if (BoolCast(this.props.Document.isButton, false) || isExpander) {
+ SelectionManager.DeselectAll();
let subBulletDocs = await DocListCastAsync(this.props.Document.subBulletDocs);
let maximizedDocs = await DocListCastAsync(this.props.Document.maximizedDocs);
let summarizedDocs = await DocListCastAsync(this.props.Document.summarizedDocs);
@@ -202,29 +202,33 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
expandedDocs = subBulletDocs ? [...subBulletDocs, ...expandedDocs] : expandedDocs;
expandedDocs = maximizedDocs ? [...maximizedDocs, ...expandedDocs] : expandedDocs;
expandedDocs = summarizedDocs ? [...summarizedDocs, ...expandedDocs] : expandedDocs;
- // let expandedDocs = [...(subBulletDocs ? subBulletDocs : []),
- // ...(maximizedDocs ? maximizedDocs : []),
- // ...(summarizedDocs ? summarizedDocs : []),];
+ // let expandedDocs = [...(subBulletDocs ? subBulletDocs : []), ...(maximizedDocs ? maximizedDocs : []), ...(summarizedDocs ? summarizedDocs : []),];
if (expandedDocs.length) { // bcz: need a better way to associate behaviors with click events on widget-documents
let hasView = expandedDocs.length === 1 && DocumentManager.Instance.getDocumentView(expandedDocs[0], this.props.ContainingCollectionView);
- if (!hasView && ((altKey && !this.props.Document.maximizeOnRight) || (!altKey && this.props.Document.maximizeOnRight))) {
+ let maxLocation = StrCast(this.props.Document.maximizeLocation, "inPlace");
+ if (!hasView && altKey) {
+ expandedDocs.forEach(maxDoc => maxDoc.isMinimized = false);
+ hasView = expandedDocs.length === 1 && DocumentManager.Instance.getDocumentView(expandedDocs[0], this.props.ContainingCollectionView);
+ maxLocation = this.props.Document.maximizeLocation = (maxLocation === "inPlace" ? "inTab" : "inPlace");
+ if (!hasView && maxLocation === "inPlace") {
+ this.props.addDocument && expandedDocs.forEach(async maxDoc => this.props.addDocument!(Doc.MakeDelegate(maxDoc), false));
+ expandedDocs.forEach(maxDoc => maxDoc.isMinimized = true);
+ }
+ }
+ if (!hasView && maxLocation !== "inPlace") {
let dataDocs = DocListCast(CollectionDockingView.Instance.props.Document.data);
if (dataDocs) {
- SelectionManager.DeselectAll();
expandedDocs.forEach(maxDoc => {
- maxDoc.isMinimized = false;
if (!CollectionDockingView.Instance.CloseRightSplit(maxDoc)) {
- CollectionDockingView.Instance.AddRightSplit(Doc.MakeDelegate(maxDoc));
+ this.props.addDocTab(Doc.MakeDelegate(maxDoc), maxLocation);
}
});
}
} else {
- //if (altKey) this.props.addDocument && expandedDocs.forEach(async maxDoc => this.props.addDocument!(maxDoc, false));
this.toggleIcon(expandedDocs);
}
}
else if (linkedToDocs.length || linkedFromDocs.length) {
- SelectionManager.DeselectAll();
let linkedFwdDocs = [
linkedToDocs.length ? linkedToDocs[0].linkedTo as Doc : linkedFromDocs.length ? linkedFromDocs[0].linkedFrom as Doc : expandedDocs[0],
linkedFromDocs.length ? linkedFromDocs[0].linkedFrom as Doc : linkedToDocs.length ? linkedToDocs[0].linkedTo as Doc : expandedDocs[0]];
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 7167da93b..760e31b49 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -68,7 +68,7 @@ export interface DocumentViewProps {
whenActiveChanged: (isActive: boolean) => void;
toggleMinimized: () => void;
bringToFront: (doc: Doc) => void;
- addDocTab: (doc: Doc) => void;
+ addDocTab: (doc: Doc, where: string) => void;
}
const schema = createSchema({
@@ -315,7 +315,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
cm.addItem({ description: this.props.Document.isButton ? "Remove Button" : "Make Button", event: this.makeButton, icon: "expand-arrows-alt" });
cm.addItem({ description: "Fields", event: this.fieldsClicked, icon: "layer-group" });
cm.addItem({ description: "Center", event: () => this.props.focus(this.props.Document), icon: "align-center" });
- cm.addItem({ description: "Open Tab", event: () => this.props.addDocTab && this.props.addDocTab(this.props.Document), icon: "expand-arrows-alt" });
+ cm.addItem({ description: "Open Tab", event: () => this.props.addDocTab && this.props.addDocTab(this.props.Document, "inTab"), icon: "expand-arrows-alt" });
cm.addItem({ description: "Open Right", event: () => CollectionDockingView.Instance.AddRightSplit(this.props.Document), icon: "caret-square-right" });
cm.addItem({
description: "Find aliases", event: async () => {
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index b5dfd18eb..5c149af99 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -35,7 +35,7 @@ export interface FieldViewProps {
isTopMost: boolean;
selectOnLoad: boolean;
addDocument?: (document: Doc, allowDuplicates?: boolean) => boolean;
- addDocTab: (document: Doc) => boolean;
+ addDocTab: (document: Doc, where: string) => boolean;
removeDocument?: (document: Doc) => boolean;
moveDocument?: (document: Doc, targetCollection: Doc, addDocument: (document: Doc) => boolean) => boolean;
ScreenToLocalTransform: () => Transform;