aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-04-24 12:20:38 -0400
committerbob <bcz@cs.brown.edu>2019-04-24 12:20:38 -0400
commit20becbb5ca40350ed85e01f73f29621ba7783bb9 (patch)
treee06383f2f35c88430174a74404e91ac8f1fd79f3 /src/client/views/collections/collectionFreeForm
parentd2a95b1aa144e8dd4e87338525922dae1f3d9e67 (diff)
playing with linking
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index 39b42dac9..898fff019 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -14,6 +14,7 @@ import { CollectionFreeFormView } from "./CollectionFreeFormView";
import "./MarqueeView.scss";
import React = require("react");
import { Utils } from "../../../../Utils";
+import { ListField } from "../../../../fields/ListField";
interface MarqueeViewProps {
getContainerTransform: () => Transform;
@@ -128,16 +129,16 @@ export class MarqueeView extends React.Component<MarqueeViewProps>
@undoBatch
@action
marqueeCommand = (e: KeyboardEvent) => {
- if (e.key === "Backspace" || e.key === "Delete") {
+ if (e.key === "Backspace" || e.key === "Delete" || e.key == "d") {
this.marqueeSelect().map(d => this.props.removeDocument(d));
let ink = this.props.container.props.Document.GetT(KeyStore.Ink, InkField);
if (ink && ink !== FieldWaiting) {
this.marqueeInkDelete(ink.Data);
}
- this.cleanupInteractions();
+ this.cleanupInteractions(true);
e.stopPropagation();
}
- if (e.key === "c") {
+ if (e.key === "c" || e.key === "r") {
e.stopPropagation();
let bounds = this.Bounds;
let selected = this.marqueeSelect().map(d => {
@@ -155,16 +156,38 @@ export class MarqueeView extends React.Component<MarqueeViewProps>
y: bounds.top,
panx: 0,
pany: 0,
+ backgroundColor: selected.length ? "white" : "",
scale: zoomBasis,
width: bounds.width * zoomBasis,
height: bounds.height * zoomBasis,
ink: inkData ? this.marqueeInkSelect(inkData) : undefined,
title: "a nested collection"
});
- this.props.addDocument(newCollection, false);
+
this.marqueeInkDelete(inkData);
- this.cleanupInteractions();
SelectionManager.DeselectAll();
+ if (e.key === "r") {
+ let summary = Documents.TextDocument({ x: bounds.left, y: bounds.top, width: 300, height: 100, backgroundColor: "yellow", title: "-summary-" });
+ summary.GetPrototype()!.CreateLink(newCollection.GetPrototype()!);
+ this.props.addLiveTextDocument(summary);
+ e.preventDefault();
+ }
+ else {
+ this.props.addDocument(newCollection, false);
+ }
+ this.cleanupInteractions(true);
+ }
+ if (e.key === "s") {
+ e.stopPropagation();
+ e.preventDefault();
+ let bounds = this.Bounds;
+ let selected = this.marqueeSelect();
+ SelectionManager.DeselectAll();
+ let summary = Documents.TextDocument({ x: bounds.left + bounds.width + 25, y: bounds.top, width: 300, height: 100, backgroundColor: "yellow", title: "-summary-" });
+ this.props.addLiveTextDocument(summary);
+ selected.map(select => summary.GetPrototype()!.CreateLink(select.GetPrototype()!));
+
+ this.cleanupInteractions(true);
}
}
@action