aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-07-14 22:13:04 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-07-14 22:13:04 -0400
commit7e423358d420d81ba2fa551195a296f54152bd6c (patch)
tree9728143b5cc0d2467ba6b3f230e86a6c2d4bd4d5
parentd1afda33e938dd8b86074583fe13f786caf05772 (diff)
Tried to clamped DocDecs to screen space
Doesn't work particularly well for text boxes
-rw-r--r--src/client/views/DocumentDecorations.tsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 2cb3de50f..3bed62ef8 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -696,6 +696,17 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
templates.set(template, checked);
});
+ bounds.x = Math.max(0, bounds.x - this._resizeBorderWidth / 2) + this._resizeBorderWidth / 2;
+ bounds.y = Math.max(0, bounds.y - this._resizeBorderWidth / 2 - this._titleHeight) + this._resizeBorderWidth / 2 + this._titleHeight;
+ const borderRadiusDraggerWidth = 15;
+ bounds.r = Math.min(window.innerWidth, bounds.r + borderRadiusDraggerWidth + this._resizeBorderWidth / 2) - this._resizeBorderWidth / 2 - borderRadiusDraggerWidth;
+ bounds.b = Math.min(window.innerHeight, bounds.b + this._resizeBorderWidth / 2 + this._linkBoxHeight) - this._resizeBorderWidth / 2 - this._linkBoxHeight;
+ if (bounds.x > bounds.r) {
+ bounds.x = bounds.r - this._resizeBorderWidth;
+ }
+ if (bounds.y > bounds.b) {
+ bounds.y = bounds.b - (this._resizeBorderWidth + this._linkBoxHeight + this._titleHeight);
+ }
return (<div className="documentDecorations">
<div className="documentDecorations-background" style={{
width: (bounds.r - bounds.x + this._resizeBorderWidth) + "px",