MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / _constrainSize

Method _constrainSize

src/dd-resizable.ts:312–321  ·  view source on GitHub ↗

@internal constrain the size to the set min/max values

(oWidth: number, oHeight: number, moveLeft: boolean, moveUp: boolean)

Source from the content-addressed store, hash-verified

310
311 /** @internal constrain the size to the set min/max values */
312 protected _constrainSize(oWidth: number, oHeight: number, moveLeft: boolean, moveUp: boolean): Size {
313 const o = this.option;
314 const maxWidth = (moveLeft ? o.maxWidthMoveLeft : o.maxWidth) || Number.MAX_SAFE_INTEGER;
315 const minWidth = o.minWidth / this.rectScale.x || oWidth;
316 const maxHeight = (moveUp ? o.maxHeightMoveUp : o.maxHeight) || Number.MAX_SAFE_INTEGER;
317 const minHeight = o.minHeight / this.rectScale.y || oHeight;
318 const width = Math.min(maxWidth, Math.max(minWidth, oWidth));
319 const height = Math.min(maxHeight, Math.max(minHeight, oHeight));
320 return { width, height };
321 }
322
323 /** @internal */
324 protected _applyChange(): DDResizable {

Callers 1

_getChangeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected