destroyPrimitives

Determines if primitives in the collection are destroyed when they are removed by PrimitiveCollection.destroy or PrimitiveCollection.remove or implicitly by PrimitiveCollection.removeAll.

// Example 1. Primitives are destroyed by default.
const primitives = new PrimitiveCollection();
const labels = primitives.add(new LabelCollection());
primitives = primitives.destroy();
const b = labels.isDestroyed(); // true
// Example 2. Do not destroy primitives in a collection.
const primitives = new PrimitiveCollection();
primitives.destroyPrimitives = false;
const labels = primitives.add(new LabelCollection());
primitives = primitives.destroy();
const b = labels.isDestroyed(); // false
labels = labels.destroy(); // explicitly destroy

See also