mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-01 23:21:59 +01:00
set min resize size for nodes
This commit is contained in:
parent
07a843f7bd
commit
c8d32c1668
@ -46,6 +46,7 @@ interface ResizeContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DefaultGapSizePx = 5;
|
const DefaultGapSizePx = 5;
|
||||||
|
const MinNodeSizePx = 40;
|
||||||
|
|
||||||
export class LayoutModel {
|
export class LayoutModel {
|
||||||
/**
|
/**
|
||||||
@ -666,6 +667,15 @@ export class LayoutModel {
|
|||||||
const clientDiff = (this.resizeContext.resizeHandleStartPx - clientPoint) * this.resizeContext.pixelToSizeRatio;
|
const clientDiff = (this.resizeContext.resizeHandleStartPx - clientPoint) * this.resizeContext.pixelToSizeRatio;
|
||||||
const beforeNodeSize = this.resizeContext.beforeNodeStartSize - clientDiff;
|
const beforeNodeSize = this.resizeContext.beforeNodeStartSize - clientDiff;
|
||||||
const afterNodeSize = this.resizeContext.afterNodeStartSize + clientDiff;
|
const afterNodeSize = this.resizeContext.afterNodeStartSize + clientDiff;
|
||||||
|
|
||||||
|
// If either node will be too small after this resize, don't let it happen.
|
||||||
|
if (
|
||||||
|
beforeNodeSize / this.resizeContext.pixelToSizeRatio < MinNodeSizePx ||
|
||||||
|
afterNodeSize / this.resizeContext.pixelToSizeRatio < MinNodeSizePx
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const resizeAction: LayoutTreeResizeNodeAction = {
|
const resizeAction: LayoutTreeResizeNodeAction = {
|
||||||
type: LayoutTreeActionType.ResizeNode,
|
type: LayoutTreeActionType.ResizeNode,
|
||||||
resizeOperations: [
|
resizeOperations: [
|
||||||
|
Loading…
Reference in New Issue
Block a user