* Enable/disable batch mode for multiple operations to optimize performance. * When enabled, layout updates are deferred until batch mode is disabled. * * @param flag true to enable batch mode, false to disable and apply changes * @param doPack if true (default), pack/compact nodes when
(flag = true, doPack = true)
| 83 | * engine.batchUpdate(false); // Apply all changes at once |
| 84 | */ |
| 85 | public batchUpdate(flag = true, doPack = true): GridStackEngine { |
| 86 | if (!!this.batchMode === flag) return this; |
| 87 | this.batchMode = flag; |
| 88 | if (flag) { |
| 89 | this._prevFloat = this._float; |
| 90 | this._float = true; // let things go anywhere for now... will restore and possibly reposition later |
| 91 | this.cleanNodes(); |
| 92 | this.saveInitial(); // since begin update (which is called multiple times) won't do this |
| 93 | } else { |
| 94 | this._float = this._prevFloat; |
| 95 | delete this._prevFloat; |
| 96 | if (doPack) this._packNodes(); |
| 97 | this._notify(); |
| 98 | } |
| 99 | return this; |
| 100 | } |
| 101 | |
| 102 | // use entire row for hitting area (will use bottom reverse sorted first) if we not actively moving DOWN and didn't already skip |
| 103 | protected _useEntireRowArea(node: GridStackNode, nn: GridStackPosition): boolean { |
no test coverage detected