@amcharts/amcharts5
Version:
amCharts 5
53 lines • 1.92 kB
JavaScript
import { RoundedRectangle } from "../render/RoundedRectangle";
import { Container } from "./Container";
import * as $utils from "../../core/util/Utils";
/**
* Draws an interactive button.
*
* @see {@link https://www.amcharts.com/docs/v5/concepts/common-elements/buttons/} for more info
* @important
*/
export class Button extends Container {
_afterNew() {
this._settings.themeTags = $utils.mergeTags(this._settings.themeTags, ["button"]);
super._afterNew();
this._setDefaultTagged("background", $utils.mergeTags(this._settings.themeTags, ["background"]), () => {
return RoundedRectangle.new(this._root, {});
});
this.setPrivate("trustBounds", true);
}
_prepareChildren() {
super._prepareChildren();
if (this.isDirty("icon")) {
const previous = this._prevSettings.icon;
const icon = this.get("icon");
if (icon !== previous) {
this._disposeProperty("icon");
if (previous) {
previous.dispose();
}
if (icon) {
this.children.push(icon);
}
this._prevSettings.icon = icon;
}
}
if (this.isDirty("label")) {
const previous = this._prevSettings.label;
const label = this.get("label");
if (label !== previous) {
this._disposeProperty("label");
if (previous) {
previous.dispose();
}
if (label) {
this.children.push(label);
}
this._prevSettings.label = label;
}
}
}
}
Button.className = "Button";
Button.classNames = Container.classNames.concat([Button.className]);
//# sourceMappingURL=Button.js.map