@tsparticles/editor
Version:
tsParticles Configuration Editor
49 lines (48 loc) • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShadowOptionsEditor = void 0;
const object_gui_1 = require("object-gui");
const EditorBase_1 = require("../../../../EditorBase");
class ShadowOptionsEditor extends EditorBase_1.EditorBase {
constructor(particles) {
super(particles);
}
addToGroup(parent) {
this.group = parent.addGroup("shadow", "Shadow");
this.options = this.group.data;
this.addOffset();
this.addProperties();
}
addOffset() {
const group = this.group.addGroup("offset", "Offset");
group.addProperty("x", "X", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
group.addProperty("y", "Y", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
}
addProperties() {
const optionsFunc = () => this.options();
const options = optionsFunc();
const color = typeof options.color === "string" ? options.color : options.color?.value;
this.group.addProperty("blur", "Blur", object_gui_1.EditorType.number).change(() => {
void this.particles().refresh();
});
this.group.addProperty("color", "Color", object_gui_1.EditorType.color, color, false).change((value) => {
if (typeof value === "string") {
if (typeof options.color === "string") {
options.color = value;
}
else {
options.color.value = value;
}
}
void this.particles().refresh();
});
this.group.addProperty("enable", "Enable", object_gui_1.EditorType.boolean).change(() => {
void this.particles().refresh();
});
}
}
exports.ShadowOptionsEditor = ShadowOptionsEditor;