Dispose correctly of gradient definitions in the control. Attach to port number not id.

This commit is contained in:
Sam El-Husseini
2018-04-10 11:49:15 -07:00
parent f41310e879
commit 8398c8efdb
2 changed files with 12 additions and 2 deletions

View File

@ -13,7 +13,7 @@ namespace pxsim.visuals {
private static SLIDER_SIDE_PADDING = 6;
getInnerView(parent: SVGSVGElement, globalDefs: SVGDefsElement) {
let gid = "gradient-slider-" + this.getId();
let gid = "gradient-slider-" + this.getPort();
this.group = svg.elt("g") as SVGGElement;
this.gradient = createGradient(gid, this.getGradientDefinition());
this.gradient.setAttribute('x1', '0%');
@ -74,6 +74,11 @@ namespace pxsim.visuals {
return this.group;
}
public dispose() {
if (this.gradient) this.gradient.parentElement.removeChild(this.gradient);
super.dispose();
}
getInnerHeight() {
return 192;
}