UNPKG

@tsparticles/editor

Version:

tsParticles Configuration Editor

59 lines (58 loc) 2.48 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "object-gui", "../../../../EditorBase"], factory); } })(function (require, exports) { "use strict"; 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; });