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

Method changedPosConstrain

src/gridstack-engine.ts:915–926  ·  view source on GitHub ↗

true if x,y or w,h are different after clamping to min/max

(node: GridStackNode, p: GridStackPosition)

Source from the content-addressed store, hash-verified

913
914 /** true if x,y or w,h are different after clamping to min/max */
915 public changedPosConstrain(node: GridStackNode, p: GridStackPosition): boolean {
916 // first make sure w,h are set for caller
917 p.w = p.w || node.w;
918 p.h = p.h || node.h;
919 if (node.x !== p.x || node.y !== p.y) return true;
920 // check constrained w,h
921 if (node.maxW) { p.w = Math.min(p.w, node.maxW); }
922 if (node.maxH) { p.h = Math.min(p.h, node.maxH); }
923 if (node.minW) { p.w = Math.max(p.w, node.minW); }
924 if (node.minH) { p.h = Math.max(p.h, node.minH); }
925 return (node.w !== p.w || node.h !== p.h);
926 }
927
928 /** return true if the passed in node was actually moved (checks for no-op and locked) */
929 public moveNode(node: GridStackNode, o: GridStackMoveOpts): boolean {

Callers 2

moveNodeCheckMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected