mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
set min resize size for nodes
This commit is contained in:
@@ -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: [
|
||||||
|
|||||||
Reference in New Issue
Block a user