aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx2
-rw-r--r--src/client/views/nodes/CollectionFreeFormDocumentView.tsx35
-rw-r--r--src/new_fields/Doc.ts6
3 files changed, 26 insertions, 17 deletions
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index 6301fd27e..d102c8af2 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -273,7 +273,7 @@ export class MarqueeView extends React.Component<MarqueeViewProps>
selected = [newCollection];
newCollection.x = bounds.left + bounds.width;
//this.props.addDocument(newCollection, false);
- summary.proto!.summarizedDocs = new List<Doc>(selected.map(s => s.proto!));
+ summary.proto!.summarizedDocs = new List<Doc>(selected);
summary.proto!.maximizeLocation = "inTab"; // or "inPlace", or "onRight"
//summary.proto!.isButton = true;
//let scrpt = this.props.getTransform().inverse().transformPoint(bounds.left, bounds.top);
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index 833947ac3..7cb4c1dfe 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -137,7 +137,7 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
if (!CollectionFreeFormDocumentView._undoBatch) {
CollectionFreeFormDocumentView._undoBatch = UndoManager.StartBatch("iconAnimating");
}
- maximizedDocs.map(maximizedDoc => {
+ maximizedDocs.map(d => Doc.GetProto(d)).map(maximizedDoc => {
let iconAnimating = Cast(maximizedDoc.isIconAnimating, List);
if (!iconAnimating || (Date.now() - iconAnimating[2] > 1000)) {
if (isMinimized === undefined) {
@@ -204,28 +204,31 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
expandedDocs = summarizedDocs ? [...summarizedDocs, ...expandedDocs] : expandedDocs;
// 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);
+ let expandedProtoDocs = expandedDocs.map(doc => Doc.GetProto(doc))
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);
+ let getDispDoc = (target: Doc) => Object.getOwnPropertyNames(target).indexOf("isPrototype") === -1 ? target : Doc.MakeDelegate(target);
+ if (altKey) {
+ maxLocation = this.props.Document.maximizeLocation = (maxLocation === "inPlace" || !maxLocation ? "inTab" : "inPlace");
+ if (!maxLocation || maxLocation === "inPlace") {
+ let hadView = expandedDocs.length === 1 && DocumentManager.Instance.getDocumentView(expandedProtoDocs[0], this.props.ContainingCollectionView);
+ let wasMinimized = !hadView && expandedDocs.reduce((min, d) => !min && !BoolCast(d.IsMinimized, false), false);
+ expandedDocs.forEach(maxDoc => Doc.GetProto(maxDoc).isMinimized = false);
+ let hasView = expandedDocs.length === 1 && DocumentManager.Instance.getDocumentView(expandedProtoDocs[0], this.props.ContainingCollectionView);
+ if (!hasView) {
+ this.props.addDocument && expandedDocs.forEach(async maxDoc => this.props.addDocument!(getDispDoc(maxDoc), false));
+ }
+ expandedProtoDocs.forEach(maxDoc => maxDoc.isMinimized = wasMinimized);
}
}
- if (!hasView && maxLocation !== "inPlace") {
+ if (maxLocation && maxLocation !== "inPlace") {
let dataDocs = DocListCast(CollectionDockingView.Instance.props.Document.data);
if (dataDocs) {
- expandedDocs.forEach(maxDoc => {
- if (!CollectionDockingView.Instance.CloseRightSplit(maxDoc)) {
- this.props.addDocTab(Doc.MakeDelegate(maxDoc), maxLocation);
- }
- });
+ expandedDocs.forEach(maxDoc =>
+ (!CollectionDockingView.Instance.CloseRightSplit(Doc.GetProto(maxDoc)) &&
+ this.props.addDocTab(getDispDoc(maxDoc), maxLocation)));
}
} else {
- this.toggleIcon(expandedDocs);
+ this.toggleIcon(expandedProtoDocs);
}
}
else if (linkedToDocs.length || linkedFromDocs.length) {
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index a7aa571f8..020f764a2 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -177,6 +177,12 @@ export namespace Doc {
return r || r2 || r3 || r4 ? true : false;
}
+ // gets the document's prototype or returns the document if it is a prototype
+ export function GetProto(doc: Doc) {
+ return Object.getOwnPropertyNames(doc).indexOf("isPrototype") === -1 ? doc.proto! : doc;
+ }
+
+
export function MakeAlias(doc: Doc) {
const proto = Object.getOwnPropertyNames(doc).indexOf("isPrototype") === -1 ? doc.proto : undefined;
const alias = new Doc;