return true if can fit in grid height constrain only (always true if no maxRow)
(node: GridStackNode)
| 892 | |
| 893 | /** return true if can fit in grid height constrain only (always true if no maxRow) */ |
| 894 | public willItFit(node: GridStackNode): boolean { |
| 895 | delete node._willFitPos; |
| 896 | if (!this.maxRow) return true; |
| 897 | // create a clone with NO maxRow and check if still within size |
| 898 | const clone = new GridStackEngine({ |
| 899 | column: this.column, |
| 900 | float: this.float, |
| 901 | nodes: this.nodes.map(n => {return {...n}}) |
| 902 | }); |
| 903 | const n = {...node}; // clone node so we don't mod any settings on it but have full autoPosition and min/max as well! #1687 |
| 904 | this.cleanupNode(n); |
| 905 | delete n.el; delete n._id; delete n.content; delete n.grid; |
| 906 | clone.addNode(n); |
| 907 | if (clone.getRow() <= this.maxRow) { |
| 908 | node._willFitPos = Utils.copyPos({}, n); |
| 909 | return true; |
| 910 | } |
| 911 | return false; |
| 912 | } |
| 913 | |
| 914 | /** true if x,y or w,h are different after clamping to min/max */ |
| 915 | public changedPosConstrain(node: GridStackNode, p: GridStackPosition): boolean { |
nothing calls this directly
no test coverage detected