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

Method copyPos

src/utils.ts:474–486  ·  view source on GitHub ↗

* Copy position and size properties from one widget to another. * Copies x, y, w, h and optionally min/max constraints. * * @param a target widget to copy to * @param b source widget to copy from * @param doMinMax if true, also copy min/max width/height constraints * @returns the t

(a: GridStackWidget, b: GridStackWidget, doMinMax = false)

Source from the content-addressed store, hash-verified

472 * Utils.copyPos(widget1, widget2, true); // Also copy constraints
473 */
474 static copyPos(a: GridStackWidget, b: GridStackWidget, doMinMax = false): GridStackWidget {
475 if (b.x !== undefined) a.x = b.x;
476 if (b.y !== undefined) a.y = b.y;
477 if (b.w !== undefined) a.w = b.w;
478 if (b.h !== undefined) a.h = b.h;
479 if (doMinMax) {
480 if (b.minW) a.minW = b.minW;
481 if (b.minH) a.minH = b.minH;
482 if (b.maxW) a.maxW = b.maxW;
483 if (b.maxH) a.maxH = b.maxH;
484 }
485 return a;
486 }
487
488 /** true if a and b has same size & position */
489 static samePos(a: GridStackPosition, b: GridStackPosition): boolean {

Callers 13

onChangeMethod · 0.80
_fixCollisionsMethod · 0.80
nodeBoundFixMethod · 0.80
saveInitialMethod · 0.80
restoreInitialMethod · 0.80
moveNodeCheckMethod · 0.80
willItFitMethod · 0.80
moveNodeMethod · 0.80
loadMethod · 0.80
updateMethod · 0.80
onDragMethod · 0.80
_setupAcceptWidgetMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected