aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2019-11-23 17:56:43 -0500
committerStanley Yip <stanley_yip@brown.edu>2019-11-23 17:56:43 -0500
commit80ecf02d19efb4cc2de63b77f4aa821bd74c67b2 (patch)
treec64fd79dafd83095b84d6107c19df2c2104355a0 /src/client/views/nodes/DocumentView.tsx
parent22472e278c5616ba86c75ed29cd5846d0cf35ff5 (diff)
tool bar works better with touch, started doing resizing interaction but not done
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 687106a9e..f8c592f07 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -648,6 +648,21 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
return this.Document.isBackground && !this.isSelected();
}
+ @action
+ handle2PointersMove = (e: TouchEvent) => {
+ let pt1 = e.targetTouches.item(0);
+ let pt2 = e.targetTouches.item(1);
+ if (pt1 && pt2 && this.prevPoints.has(pt1.identifier) && this.prevPoints.has(pt2.identifier)) {
+ let oldPoint1 = this.prevPoints.get(pt1.identifier);
+ let oldPoint2 = this.prevPoints.get(pt2.identifier);
+ let pinching = InteractionUtils.Pinning(pt1, pt2, oldPoint1!, oldPoint2!);
+ if (pinching !== 0) {
+ let newWidth = Math.max(Math.abs(oldPoint1!.clientX - oldPoint2!.clientX), Math.abs(pt1.clientX - pt2.clientX))
+ this.props.Document.width = newWidth;
+ }
+ }
+ }
+
render() {
if (!this.props.Document) return (null);
const ruleColor = this.props.ruleProvider ? StrCast(this.props.ruleProvider["ruleColor_" + this.Document.heading]) : undefined;
@@ -682,7 +697,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
width: animwidth,
height: animheight,
opacity: this.Document.opacity
- }} >
+ }} onTouchStart={this.onTouchStart}>
{this.innards}
</div>;
}