* Initializes the necessary variables * for a magic grid. * * @param config - configuration object
(config)
| 19 | * @param config - configuration object |
| 20 | */ |
| 21 | constructor (config) { |
| 22 | super(); |
| 23 | checkParams(config); |
| 24 | |
| 25 | if (config.container instanceof HTMLElement) { |
| 26 | this.container = config.container; |
| 27 | this.containerClass = config.container.className; |
| 28 | } |
| 29 | else { |
| 30 | this.containerClass = config.container; |
| 31 | this.container = document.querySelector(config.container); |
| 32 | } |
| 33 | |
| 34 | this.static = config.static || false; |
| 35 | this.size = config.items; |
| 36 | this.gutter = config.gutter; |
| 37 | this.maxColumns = config.maxColumns || false; |
| 38 | this.useMin = config.useMin || false; |
| 39 | this.useTransform = config.useTransform; |
| 40 | this.animate = config.animate || false; |
| 41 | this.center = config.center; |
| 42 | this.styledItems = new Set(); |
| 43 | this.resizeObserver = null; |
| 44 | this.isPositioning = false; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Set a new container. Useful in cases where |
nothing calls this directly
no test coverage detected