Added a remove function for the DOMScatterContainer. Is automatically called onClose.
This commit is contained in:
parent
d04f92ee7f
commit
5e98640ded
@ -355,6 +355,13 @@ export class AbstractScatter extends Throwable {
|
||||
close() {
|
||||
if (this.onClose) {
|
||||
this.onClose.forEach(callback => callback(this))
|
||||
|
||||
/**
|
||||
Removes self from container when it's closed.
|
||||
*/
|
||||
if(this.container){
|
||||
this.container.remove(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -960,6 +967,24 @@ export class DOMScatterContainer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes an element from the scatter.
|
||||
*
|
||||
* @param {Scatter} scatter - Element to remove.
|
||||
* @memberof DOMScatterContainer
|
||||
*/
|
||||
remove(scatter){
|
||||
this.scatter.delete(scatter.element)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds an element to the ScatterContainer.
|
||||
*
|
||||
* @param {Scatter} scatter - Element to add to the ScatterContainer.
|
||||
* @memberof DOMScatterContainer
|
||||
*/
|
||||
add(scatter) {
|
||||
this.scatter.set(scatter.element, scatter)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user