Closed axelpale closed 1 year ago
Next iteration. The methods openChild and openParent are implemented internally. Also the property names are simplified.
const loader = new tapspace.loaders.FractalLoader({
viewport: viewport,
placeholder: function (id) {
// Render placeholder
return tapspace.createCircle(10, 'black')
},
generator: function (id, data) {
return tapspace.createCircle(15, data.color)
},
fetcher: function (id, callback) {
setTimeout(() => {
callback(null, { color: 'red' })
}, 1000)
},
tracker: function (parent, childId) {
return parent.atAnchor().offset(20, 0)
},
backer: function (childId) {
switch (childId) {
case 'b':
return 'a'
case 'a':
return null
default:
return null
}
},
limiter: function (depth) {
return depth < 3
}
})
loader.init('a', viewport.atCenter())
loader.openChild('a', 'b')
loader.openParent('a')
Implemented as TreeLoader around v2.0.0-alpha.14
In v2.0.0-alpha.8 the FractalLoader already works but has issues:
Observations about opening:
Sketch of improved FractalLoader usage: