YMapGroupEntity
The GroupEntity entity is similar to ComplexEntity, but the addChild and removeChild methods, as well as the children property, are public.
The ymaps3 module has the abstract YMapGroupEntity class to create custom entities of the GroupEntity type using inheritance:
type YMapSomeGroupEntityProps = {
name?: string;
};
class YMapSomeGroupEntity extends ymaps3.YMapGroupEntity<YMapSomeGroupEntityProps> {
// ...
}
const groupEntity = new YMapSomeGroupEntity();
const someEntity = new YMapSomeEntity(); // YMapSomeEntity is inherited from YMapEntity.
// Adding an external entity from the subtree via a public method.
groupEntity.addChild(someEntity);
// Removing an external entity from athesubtree via a public method.
groupEntity.removeChild(someEntity);