feat: render particle clouds for selected tags
This commit is contained in:
+11
-8
@@ -582,14 +582,17 @@ window.companion = {
|
||||
|
||||
updateCloud(particles) {
|
||||
particlesLayer.destroyChildren();
|
||||
particles.forEach(({ x, y, weight }) => {
|
||||
particlesLayer.add(new Konva.Circle({
|
||||
x: x * PPM, y: y * PPM,
|
||||
radius: 2,
|
||||
fill: `rgba(255,152,0,${Math.max(0, Math.min(1, weight))})`,
|
||||
listening: false,
|
||||
}));
|
||||
});
|
||||
if (particles.length > 0) {
|
||||
const maxW = Math.max(...particles.map(p => p.weight));
|
||||
particles.forEach(({ x, y, weight }) => {
|
||||
particlesLayer.add(new Konva.Circle({
|
||||
x: x * PPM, y: y * PPM,
|
||||
radius: 2,
|
||||
fill: `rgba(255,152,0,${maxW > 0 ? weight / maxW : 0})`,
|
||||
listening: false,
|
||||
}));
|
||||
});
|
||||
}
|
||||
particlesLayer.batchDraw();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user