aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-04-26 21:12:23 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-04-26 21:12:23 -0400
commitc5fe2f6e225778cfee4cd2d916fd3e4060bb468f (patch)
treee538a4b5a622aba00e563a1cda7bf753f1c3b92b
parent76582288310c5372dedf3feb45d548acfa3a7e9b (diff)
fixed PDF selection (somewhat) and inking
-rw-r--r--src/client/views/nodes/PDFBox.scss8
-rw-r--r--src/client/views/nodes/PDFBox.tsx11
-rw-r--r--src/client/views/nodes/VideoBox.tsx1
3 files changed, 14 insertions, 6 deletions
diff --git a/src/client/views/nodes/PDFBox.scss b/src/client/views/nodes/PDFBox.scss
index 87fdd720a..3760e378a 100644
--- a/src/client/views/nodes/PDFBox.scss
+++ b/src/client/views/nodes/PDFBox.scss
@@ -4,6 +4,9 @@
top: 0;
left:0;
}
+.react-pdf__Page__textContent span {
+ user-select: text;
+}
.react-pdf__Document {
position: absolute;
}
@@ -20,7 +23,10 @@
height:100px;
}
.pdfBox-cont {
- pointer-events: none;
+ pointer-events: none ;
+ span {
+ pointer-events: none !important;
+ }
}
.pdfBox-cont-interactive {
pointer-events: all;
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx
index 0525d353e..763a29aca 100644
--- a/src/client/views/nodes/PDFBox.tsx
+++ b/src/client/views/nodes/PDFBox.tsx
@@ -17,6 +17,7 @@ import { FieldView, FieldViewProps } from './FieldView';
import "./PDFBox.scss";
import React = require("react");
import { SelectionManager } from "../../util/SelectionManager";
+import { InkingControl } from "../InkingControl";
/** ALSO LOOK AT: Annotation.tsx, Sticky.tsx
* This method renders PDF and puts all kinds of functionalities such as annotation, highlighting,
@@ -203,8 +204,10 @@ export class PDFBox extends React.Component<FieldViewProps> {
* controls the area highlighting (stickies) Kinda temporary
*/
onPointerDown = (e: React.PointerEvent) => {
- if (this.props.isSelected()) {
+ if (this.props.isSelected() && !InkingControl.Instance.selectedTool && e.buttons === 1) {
e.stopPropagation();
+ document.removeEventListener("pointerup", this.onPointerUp);
+ document.addEventListener("pointerup", this.onPointerUp);
}
}
@@ -212,7 +215,7 @@ export class PDFBox extends React.Component<FieldViewProps> {
* controls area highlighting and partially highlighting. Kinda temporary
*/
@action
- onPointerUp = (e: React.PointerEvent) => {
+ onPointerUp = (e: PointerEvent) => {
if (this.props.isSelected()) {
this.highlight("rgba(76, 175, 80, 0.3)"); //highlights to this default color.
}
@@ -314,9 +317,9 @@ export class PDFBox extends React.Component<FieldViewProps> {
}
render() {
trace();
- let classname = "pdfBox-cont" + (this.props.isSelected() ? "-interactive" : "");
+ let classname = "pdfBox-cont" + (this.props.isSelected() && !InkingControl.Instance.selectedTool ? "-interactive" : "");
return (
- <div className={classname} ref={this._mainDiv} onPointerDown={this.onPointerDown} onPointerUp={this.onPointerUp} >
+ <div className={classname} ref={this._mainDiv} onPointerDown={this.onPointerDown} >
{this.pdfRenderer}
</div >
);
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index 019e5e489..b34f1dc08 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -11,7 +11,6 @@ import "./VideoBox.scss";
@observer
export class VideoBox extends React.Component<FieldViewProps> {
- private _reactionDisposer: Opt<IReactionDisposer>;
private _videoRef = React.createRef<HTMLVideoElement>();
public static LayoutString() { return FieldView.LayoutString(VideoBox); }