From 7f13e25550761bd174b26a64ed73374c2d5da964 Mon Sep 17 00:00:00 2001 From: bob Date: Mon, 11 Mar 2019 19:19:40 -0400 Subject: fixed marquee issues and got rid of captions for images. --- .../views/collections/CollectionFreeFormView.tsx | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/client/views/collections/CollectionFreeFormView.tsx') diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index b0cd7e017..2dba62ee0 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -92,6 +92,9 @@ export class CollectionFreeFormView extends CollectionViewBase { @action onPointerUp = (e: PointerEvent): void => { + if (this._marquee) { + document.removeEventListener("keydown", this.marqueeCommand); + } document.removeEventListener("pointermove", this.onPointerMove); document.removeEventListener("pointerup", this.onPointerUp); e.stopPropagation(); @@ -115,6 +118,13 @@ export class CollectionFreeFormView extends CollectionViewBase { } + @action + clearMarquee = () => { + document.removeEventListener("pointermove", this.onPointerMove); + document.removeEventListener("pointerup", this.onPointerUp); + this._marquee = false; + } + intersectRect(r1: { left: number, right: number, top: number, bottom: number }, r2: { left: number, right: number, top: number, bottom: number }) { return !(r2.left > r1.right || @@ -157,6 +167,7 @@ export class CollectionFreeFormView extends CollectionViewBase { let wasMarquee = this._marquee; this._marquee = e.buttons != 2; if (this._marquee && !wasMarquee) { + this._previewCursorVisible = false; document.addEventListener("keydown", this.marqueeCommand); } @@ -176,8 +187,23 @@ export class CollectionFreeFormView extends CollectionViewBase { marqueeCommand = (e: KeyboardEvent) => { if (e.key == "Backspace") { this.marqueeSelect().map(d => this.props.removeDocument(d)); + this.clearMarquee(); } if (e.key == "c") { + let p = this.getTransform().transformPoint(this._downX, this._downY); + 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] - 400); + d.SetNumber(KeyStore.Y, d.GetNumber(KeyStore.Y, 0) - p[1] - 400); + 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: 800, height: 800, title: "a nested collection" })); + // }, 100); + this.clearMarquee(); } } -- cgit v1.2.3-70-g09d2 From 50fab5856a3aaeb1285c168b66e38ce4bc4312c2 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Mon, 11 Mar 2019 20:09:54 -0400 Subject: added pan modifier keys for macbook --- src/client/views/collections/CollectionFreeFormView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/collections/CollectionFreeFormView.tsx') diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index 2dba62ee0..97e7aefa2 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -165,7 +165,7 @@ 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); -- cgit v1.2.3-70-g09d2 From 151566e396249991e24d49b3db5c246431e62262 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Mon, 11 Mar 2019 20:28:23 -0400 Subject: fixed marquee selection and collection view creation --- .../views/collections/CollectionFreeFormView.tsx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/client/views/collections/CollectionFreeFormView.tsx') diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index 97e7aefa2..b5dc5ab18 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -95,8 +95,6 @@ export class CollectionFreeFormView extends CollectionViewBase { if (this._marquee) { document.removeEventListener("keydown", this.marqueeCommand); } - document.removeEventListener("pointermove", this.onPointerMove); - document.removeEventListener("pointerup", this.onPointerUp); e.stopPropagation(); if (this._marquee) { @@ -105,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 @@ -115,11 +112,11 @@ export class CollectionFreeFormView extends CollectionViewBase { this.props.select(false); } } - + this.cleanupInteractions(); } @action - clearMarquee = () => { + cleanupInteractions = () => { document.removeEventListener("pointermove", this.onPointerMove); document.removeEventListener("pointerup", this.onPointerUp); this._marquee = false; @@ -136,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] } @@ -187,23 +184,24 @@ export class CollectionFreeFormView extends CollectionViewBase { marqueeCommand = (e: KeyboardEvent) => { if (e.key == "Backspace") { this.marqueeSelect().map(d => this.props.removeDocument(d)); - this.clearMarquee(); + this.cleanupInteractions(); } if (e.key == "c") { - 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 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] - 400); - d.SetNumber(KeyStore.Y, d.GetNumber(KeyStore.Y, 0) - p[1] - 400); + 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: 800, height: 800, title: "a nested collection" })); + }), { x: p[0], y: p[1], panx: 0, pany: 0, width: v[0], height: v[1], title: "a nested collection" })); // }, 100); - this.clearMarquee(); + this.cleanupInteractions(); } } -- cgit v1.2.3-70-g09d2 From eb1c48dc6ff1403372f820d07b46c08f58cc7306 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Mon, 11 Mar 2019 20:46:22 -0400 Subject: added modifier options for macbook --- src/client/util/DragManager.ts | 2 +- src/client/views/collections/CollectionFreeFormView.tsx | 2 +- src/client/views/nodes/DocumentView.tsx | 2 +- src/client/views/nodes/FormattedTextBox.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/client/views/collections/CollectionFreeFormView.tsx') diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts index 4a61220a5..9bd7d5c24 100644 --- a/src/client/util/DragManager.ts +++ b/src/client/util/DragManager.ts @@ -158,7 +158,7 @@ export namespace DragManager { e.preventDefault(); x += e.movementX; y += e.movementY; - if (e.shiftKey) { + if (e.shiftKey && (e.button == 2 || e.altKey)) { abortDrag(); CollectionDockingView.Instance.StartOtherDrag(doc, { pageX: e.pageX, pageY: e.pageY, preventDefault: () => { }, button: 0 }); } diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index b5dc5ab18..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); diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index dc793c16d..da40f0dc1 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -182,7 +182,7 @@ export class DocumentView extends React.Component { if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) { document.removeEventListener("pointermove", this.onPointerMove) document.removeEventListener("pointerup", this.onPointerUp); - if (!this.topMost || e.buttons == 2) { + if (!this.topMost || e.buttons == 2 || e.altKey) { this.startDragging(e.x, e.y); } } diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index ad7ddf37a..5c7aaf9fe 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -113,7 +113,7 @@ export class FormattedTextBox extends React.Component { this.props.doc.SetData(this.props.fieldKey, e.target.value, RichTextField); } onPointerDown = (e: React.PointerEvent): void => { - if (e.buttons === 1 && this.props.isSelected()) { + if (e.buttons === 1 && this.props.isSelected() && !e.altKey) { e.stopPropagation(); } } -- cgit v1.2.3-70-g09d2