aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorHannah Chow <hannah_chow@brown.edu>2019-03-11 23:50:04 -0400
committerHannah Chow <hannah_chow@brown.edu>2019-03-11 23:50:04 -0400
commit888dd6f51befd156b24a3c60d56d8e5823e621ad (patch)
treeb6082a04695306357c379c0dcbffd0241e18d649 /src/client/views/collections
parente5c0eab1b3896cf28b6f54f5893d2998b70ef9af (diff)
parenta680579f74380eb016f0ffd61b3818d0850984b5 (diff)
origin merged
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx10
-rw-r--r--src/client/views/collections/CollectionFreeFormView.scss13
-rw-r--r--src/client/views/collections/CollectionFreeFormView.tsx36
-rw-r--r--src/client/views/collections/CollectionView.tsx1
-rw-r--r--src/client/views/collections/CollectionViewBase.tsx3
5 files changed, 53 insertions, 10 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 6a0404663..94005a4c0 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -150,9 +150,13 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
}
}
componentWillUnmount: () => void = () => {
- this._goldenLayout.unbind('itemDropped', this.itemDropped);
- this._goldenLayout.unbind('tabCreated', this.tabCreated);
- this._goldenLayout.unbind('stackCreated', this.stackCreated);
+ try {
+ this._goldenLayout.unbind('itemDropped', this.itemDropped);
+ this._goldenLayout.unbind('tabCreated', this.tabCreated);
+ this._goldenLayout.unbind('stackCreated', this.stackCreated);
+ } catch (e) {
+
+ }
this._goldenLayout.destroy();
this._goldenLayout = null;
window.removeEventListener('resize', this.onResize);
diff --git a/src/client/views/collections/CollectionFreeFormView.scss b/src/client/views/collections/CollectionFreeFormView.scss
index ffd440310..2756874bf 100644
--- a/src/client/views/collections/CollectionFreeFormView.scss
+++ b/src/client/views/collections/CollectionFreeFormView.scss
@@ -48,6 +48,7 @@
background: $light-color-secondary;
}
+<<<<<<< HEAD
border: 0px solid transparent;
border-radius: $border-radius;
box-sizing: border-box;
@@ -58,6 +59,18 @@
height: 100%;
overflow: hidden;
.collectionfreeformview {
+=======
+ .collectionfreeformview > .jsx-parser{
+ position:absolute;
+ height: 100%;
+ }
+ .formattedTextBox-cont {
+ background:yellow;
+ }
+
+ border-style: solid;
+ box-sizing: content-box;
+>>>>>>> a680579f74380eb016f0ffd61b3818d0850984b5
position: absolute;
top: 0;
left: 0;
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index b0cd7e017..74d37ccec 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -77,7 +77,7 @@ export class CollectionFreeFormView extends CollectionViewBase {
@action
onPointerDown = (e: React.PointerEvent): void => {
- if (((e.button === 2 && this.props.active()) || !e.defaultPrevented) && !e.shiftKey &&
+ if (((e.button === 2 && this.props.active()) || !e.defaultPrevented) &&
(!this.isAnnotationOverlay || this.zoomScaling != 1 || e.button == 0)) {
document.removeEventListener("pointermove", this.onPointerMove);
document.addEventListener("pointermove", this.onPointerMove);
@@ -92,8 +92,9 @@ export class CollectionFreeFormView extends CollectionViewBase {
@action
onPointerUp = (e: PointerEvent): void => {
- document.removeEventListener("pointermove", this.onPointerMove);
- document.removeEventListener("pointerup", this.onPointerUp);
+ if (this._marquee) {
+ document.removeEventListener("keydown", this.marqueeCommand);
+ }
e.stopPropagation();
if (this._marquee) {
@@ -102,7 +103,6 @@ export class CollectionFreeFormView extends CollectionViewBase {
}
var selectedDocs = this.marqueeSelect();
selectedDocs.map(s => this.props.CollectionView.SelectedDocs.push(s.Id));
- this._marquee = false;
}
else if (!this._marquee && Math.abs(this._downX - e.clientX) < 3 && Math.abs(this._downY - e.clientY) < 3) {
//show preview text cursor on tap
@@ -112,7 +112,14 @@ export class CollectionFreeFormView extends CollectionViewBase {
this.props.select(false);
}
}
+ this.cleanupInteractions();
+ }
+ @action
+ cleanupInteractions = () => {
+ document.removeEventListener("pointermove", this.onPointerMove);
+ document.removeEventListener("pointerup", this.onPointerUp);
+ this._marquee = false;
}
intersectRect(r1: { left: number, right: number, top: number, bottom: number },
@@ -126,7 +133,7 @@ export class CollectionFreeFormView extends CollectionViewBase {
marqueeSelect() {
this.props.CollectionView.SelectedDocs.length = 0;
var curPage = this.props.Document.GetNumber(KeyStore.CurPage, 1);
- let p = this.getTransform().transformPoint(this._downX, this._downY);
+ let p = this.getTransform().transformPoint(this._downX < this._lastX ? this._downX : this._lastX, this._downY < this._lastY ? this._downY : this._lastY);
let v = this.getTransform().transformDirection(this._lastX - this._downX, this._lastY - this._downY);
let selRect = { left: p[0], top: p[1], right: p[0] + v[0], bottom: p[1] + v[1] }
@@ -155,8 +162,9 @@ export class CollectionFreeFormView extends CollectionViewBase {
e.stopPropagation();
e.preventDefault();
let wasMarquee = this._marquee;
- this._marquee = e.buttons != 2;
+ this._marquee = e.buttons != 2 && !e.altKey && !e.metaKey;
if (this._marquee && !wasMarquee) {
+ this._previewCursorVisible = false;
document.addEventListener("keydown", this.marqueeCommand);
}
@@ -176,8 +184,24 @@ export class CollectionFreeFormView extends CollectionViewBase {
marqueeCommand = (e: KeyboardEvent) => {
if (e.key == "Backspace") {
this.marqueeSelect().map(d => this.props.removeDocument(d));
+ this.cleanupInteractions();
}
if (e.key == "c") {
+ let p = this.getTransform().transformPoint(this._downX < this._lastX ? this._downX : this._lastX, this._downY < this._lastY ? this._downY : this._lastY);
+ let v = this.getTransform().transformDirection(this._lastX - this._downX, this._lastY - this._downY);
+
+ let selected = this.marqueeSelect().map(m => m);
+ this.marqueeSelect().map(d => this.props.removeDocument(d));
+ //setTimeout(() => {
+ this.props.CollectionView.addDocument(Documents.FreeformDocument(selected.map(d => {
+ d.SetNumber(KeyStore.X, d.GetNumber(KeyStore.X, 0) - p[0] - v[0] / 2);
+ d.SetNumber(KeyStore.Y, d.GetNumber(KeyStore.Y, 0) - p[1] - v[1] / 2);
+ d.SetNumber(KeyStore.Page, this.props.Document.GetNumber(KeyStore.Page, 0));
+ d.SetText(KeyStore.Title, "" + d.GetNumber(KeyStore.Width, 0) + " " + d.GetNumber(KeyStore.Height, 0));
+ return d;
+ }), { x: p[0], y: p[1], panx: 0, pany: 0, width: v[0], height: v[1], title: "a nested collection" }));
+ // }, 100);
+ this.cleanupInteractions();
}
}
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 7320e873f..ac634ed53 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -99,7 +99,6 @@ export class CollectionView extends React.Component<CollectionViewProps> {
ContextMenu.Instance.addItem({ description: "Freeform", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Freeform) })
ContextMenu.Instance.addItem({ description: "Schema", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Schema) })
ContextMenu.Instance.addItem({ description: "Treeview", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Tree) })
- ContextMenu.Instance.addItem({ description: "Docking", event: () => this.props.Document.SetNumber(KeyStore.ViewType, CollectionViewType.Docking) })
}
}
diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx
index b126b40a9..31c89a75d 100644
--- a/src/client/views/collections/CollectionViewBase.tsx
+++ b/src/client/views/collections/CollectionViewBase.tsx
@@ -130,6 +130,9 @@ export class CollectionViewBase extends React.Component<SubCollectionViewProps>
if (type.indexOf("audio") !== -1) {
doc = Documents.AudioDocument(path, { ...options, nativeWidth: 300, width: 300, })
}
+ if (type.indexOf("pdf") !== -1) {
+ doc = Documents.PdfDocument(path, { ...options, nativeWidth: 300, width: 300, })
+ }
let docs = that.props.Document.GetT(KeyStore.Data, ListField);
if (docs != FieldWaiting) {
if (!docs) {