Dispose correctly of gradient definitions in the control. Attach to port number not id.
This commit is contained in:
parent
f41310e879
commit
8398c8efdb
@ -53,7 +53,7 @@ namespace pxsim.visuals {
|
||||
getInnerView(parent: SVGSVGElement, globalDefs: SVGDefsElement) {
|
||||
this.group = svg.elt("g") as SVGGElement;
|
||||
|
||||
let gc = "gradient-color";
|
||||
let gc = "gradient-color-" + this.getPort();
|
||||
this.colorGradient = svg.linearGradient(globalDefs, gc, false);
|
||||
svg.setGradientValue(this.colorGradient, "50%");
|
||||
svg.setGradientColors(this.colorGradient, "black", "yellow");
|
||||
@ -99,5 +99,10 @@ namespace pxsim.visuals {
|
||||
|
||||
return this.group;
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
if (this.colorGradient) this.colorGradient.parentElement.removeChild(this.colorGradient);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user