aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-02-28 01:51:29 -0500
committerbobzel <zzzman@gmail.com>2021-02-28 01:51:29 -0500
commit8f4d9fd82eb798e86508978f77fcb57e4c3b8651 (patch)
tree4493f741edff9240befb4525a9b3ffbf0eca78fa /src/client/views/DocumentDecorations.tsx
parent7902b1021b89e45bd595e4a9588db11dccbf9831 (diff)
got rid of delayAutoHeight by updating dragHeights in documentDecorations.
Diffstat (limited to 'src/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index f41238228..92f5b79bd 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -292,10 +292,7 @@ export class DocumentDecorations extends React.Component<{ boundsLeft: number, b
this._rotateUndo = undefined;
}
-
-
- _initialAutoHeight = false;
- _dragHeights = new Map<Doc, number>();
+ _dragHeights = new Map<Doc, { start: number, lowest: number }>();
@action
onPointerDown = (e: React.PointerEvent): void => {
@@ -323,12 +320,9 @@ export class DocumentDecorations extends React.Component<{ boundsLeft: number, b
}
this._snapX = e.pageX;
this._snapY = e.pageY;
- this._initialAutoHeight = true;
DragManager.docsBeingDragged = SelectionManager.Views().map(dv => dv.rootDoc);
- SelectionManager.Views().map(dv => {
- this._dragHeights.set(dv.layoutDoc, NumCast(dv.layoutDoc._height));
- dv.layoutDoc._delayAutoHeight = dv.layoutDoc._height;
- });
+ SelectionManager.Views().map(dv =>
+ this._dragHeights.set(dv.layoutDoc, { start: NumCast(dv.layoutDoc._height), lowest: NumCast(dv.layoutDoc._height) }));
}
onPointerMove = (e: PointerEvent, down: number[], move: number[]): boolean => {
@@ -471,9 +465,11 @@ export class DocumentDecorations extends React.Component<{ boundsLeft: number, b
} else {
dW && (doc._width = actualdW);
dH && (doc._height = actualdH);
- dH && this._initialAutoHeight && (doc._autoHeight = this._initialAutoHeight = false);
+ dH && (doc._autoHeight = false);
}
}
+ const val = this._dragHeights.get(docView.layoutDoc);
+ if (val) this._dragHeights.set(docView.layoutDoc, { start: val.start, lowest: Math.min(val.lowest, NumCast(docView.layoutDoc._height)) });
}));
return false;
}
@@ -481,12 +477,12 @@ export class DocumentDecorations extends React.Component<{ boundsLeft: number, b
@action
onPointerUp = (e: PointerEvent): void => {
SelectionManager.Views().map(dv => {
- if (NumCast(dv.layoutDoc._delayAutoHeight) < this._dragHeights.get(dv.layoutDoc)!) {
+ const hgts = this._dragHeights.get(dv.layoutDoc);
+ if (hgts && hgts.lowest < hgts.start && hgts.lowest <= 20) {
dv.nativeWidth > 0 && Doc.toggleNativeDimensions(dv.layoutDoc, dv.ContentScale(), dv.props.PanelWidth(), dv.props.PanelHeight());
if (dv.layoutDoc._autoHeight) dv.layoutDoc._autoHeight = false;
setTimeout(() => dv.layoutDoc._autoHeight = true);
}
- dv.layoutDoc._delayAutoHeight = undefined;
});
this._resizeHdlId = "";
this.Interacting = false;