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

Method restoreInitial

src/gridstack-engine.ts:696–704  ·  view source on GitHub ↗

* Restore all nodes back to their initial values. * This is typically called when canceling an operation (e.g., Esc key during drag). * * @returns the engine instance for chaining * * @internal

()

Source from the content-addressed store, hash-verified

694 * @internal
695 */
696 public restoreInitial(): GridStackEngine {
697 this.nodes.forEach(n => {
698 if (!n._orig || Utils.samePos(n, n._orig)) return;
699 Utils.copyPos(n, n._orig);
700 n._dirty = true;
701 });
702 this._notify();
703 return this;
704 }
705
706 /**
707 * Find the first available empty spot for the given node dimensions.

Callers 3

cancelDragMethod · 0.80
_leaveMethod · 0.80
_keyEventMethod · 0.80

Calls 3

_notifyMethod · 0.95
samePosMethod · 0.80
copyPosMethod · 0.80

Tested by

no test coverage detected