MCPcopy Create free account
hub / github.com/breck7/scroll / _makeParticleIndex

Method _makeParticleIndex

external/.scrollLibs.js:18161–18174  ·  view source on GitHub ↗
(startAt = 0)

Source from the content-addressed store, hash-verified

18159 return super._makeCueIndex(startAt)
18160 }
18161 _makeParticleIndex(startAt = 0) {
18162 if (!this._particleIndex || !startAt) this._particleIndex = {}
18163 const particles = this._getSubparticlesArray()
18164 const newIndex = this._particleIndex
18165 const length = particles.length
18166 for (let index = startAt; index < length; index++) {
18167 const particle = particles[index]
18168 const ancestors = Array.from(particle.definition._getAncestorSet()).forEach(id => {
18169 if (!newIndex[id]) newIndex[id] = []
18170 newIndex[id].push(particle)
18171 })
18172 }
18173 return newIndex
18174 }
18175 /**
18176 * Returns the total information bits required to represent this particle and all its subparticles.
18177 * This is calculated as the sum of:

Callers 2

particleIndexMethod · 0.95
_makeCueIndexMethod · 0.95

Calls 4

_getSubparticlesArrayMethod · 0.80
forEachMethod · 0.80
_getAncestorSetMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected