aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2020-02-07 13:58:33 -0500
committerbob <bcz@cs.brown.edu>2020-02-07 13:58:33 -0500
commitea5e85e30b83b40135c83025d4f1be1ed188b9b7 (patch)
tree6e28ccee1b6cdcdca2ad5ecb5d49365d0cd28b13 /src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx
parentccedb9302632fcdbc75292b90942a34b98bebcee (diff)
parent688f54be8be328d733e05b0781aa8908305e14fa (diff)
Merge branch 'master' into fixinglayoutsyms
Diffstat (limited to 'src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx')
-rw-r--r--src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx b/src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx
index 4f58f3fa8..d00939b26 100644
--- a/src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx
+++ b/src/client/views/collections/collectionMulticolumn/MultirowResizer.tsx
@@ -46,14 +46,12 @@ export default class ResizeBar extends React.Component<ResizerProps> {
const unitLength = columnUnitLength();
if (unitLength) {
if (toNarrow) {
- const { dimUnit, dimMagnitude } = toNarrow;
- const scale = dimUnit === DimUnit.Ratio ? unitLength : 1;
- toNarrow.dimMagnitude = NumCast(dimMagnitude) - Math.abs(movementY) / scale;
+ const scale = StrCast(toNarrow.dimUnit, "*") === DimUnit.Ratio ? unitLength : 1;
+ toNarrow.dimMagnitude = Math.max(0.05, NumCast(toNarrow.dimMagnitude, 1) - Math.abs(movementY) / scale);
}
if (this.resizeMode === ResizeMode.Pinned && toWiden) {
- const { dimUnit, dimMagnitude } = toWiden;
- const scale = dimUnit === DimUnit.Ratio ? unitLength : 1;
- toWiden.dimMagnitude = NumCast(dimMagnitude) + Math.abs(movementY) / scale;
+ const scale = StrCast(toWiden.dimUnit, "*") === DimUnit.Ratio ? unitLength : 1;
+ toWiden.dimMagnitude = Math.max(0.05, NumCast(toWiden.dimMagnitude, 1) + Math.abs(movementY) / scale);
}
}
}
@@ -61,17 +59,17 @@ export default class ResizeBar extends React.Component<ResizerProps> {
private get isActivated() {
const { toTop, toBottom } = this.props;
if (toTop && toBottom) {
- if (StrCast(toTop.dimUnit) === DimUnit.Pixel && StrCast(toBottom.dimUnit) === DimUnit.Pixel) {
+ if (StrCast(toTop.dimUnit, "*") === DimUnit.Pixel && StrCast(toBottom.dimUnit, "*") === DimUnit.Pixel) {
return false;
}
return true;
} else if (toTop) {
- if (StrCast(toTop.dimUnit) === DimUnit.Pixel) {
+ if (StrCast(toTop.dimUnit, "*") === DimUnit.Pixel) {
return false;
}
return true;
} else if (toBottom) {
- if (StrCast(toBottom.dimUnit) === DimUnit.Pixel) {
+ if (StrCast(toBottom.dimUnit, "*") === DimUnit.Pixel) {
return false;
}
return true;
@@ -91,7 +89,7 @@ export default class ResizeBar extends React.Component<ResizerProps> {
render() {
return (
<div
- className={"resizer"}
+ className={"multiRowResizer"}
style={{
height: this.props.height,
opacity: this.isActivated && this.isHoverActive ? resizerOpacity : 0
@@ -100,12 +98,12 @@ export default class ResizeBar extends React.Component<ResizerProps> {
onPointerLeave={action(() => !this.isResizingActive && (this.isHoverActive = false))}
>
<div
- className={"internal"}
+ className={"multiRowResizer-hdl"}
onPointerDown={e => this.registerResizing(e, ResizeMode.Pinned)}
style={{ backgroundColor: this.resizeMode }}
/>
<div
- className={"internal"}
+ className={"multiRowResizer-hdl"}
onPointerDown={e => this.registerResizing(e, ResizeMode.Global)}
style={{ backgroundColor: this.resizeMode }}
/>