@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
43 lines (42 loc) • 1.32 kB
JavaScript
;
import { TypedEventNode } from "./_Base";
import { EventConnectionPoint, EventConnectionPointType } from "../utils/io/connections/Event";
var ButtonEventOutput = /* @__PURE__ */ ((ButtonEventOutput2) => {
ButtonEventOutput2["OUT"] = "out";
return ButtonEventOutput2;
})(ButtonEventOutput || {});
import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig";
class ButtonEventParamsConfig extends NodeParamsConfig {
constructor() {
super(...arguments);
/** @param button to presse to trigger the event */
this.dispatch = ParamConfig.BUTTON(null, {
callback: (node) => {
ButtonEventNode.PARAM_CALLBACK_execute(node);
}
});
}
}
const ParamsConfig = new ButtonEventParamsConfig();
export class ButtonEventNode extends TypedEventNode {
constructor() {
super(...arguments);
this.paramsConfig = ParamsConfig;
}
static type() {
return "button";
}
initializeNode() {
this.io.outputs.setNamedOutputConnectionPoints([
new EventConnectionPoint("out" /* OUT */, EventConnectionPointType.BASE)
]);
}
processEvent(event_context) {
}
process_event_execute(event_context) {
this.dispatchEventToOutput("out" /* OUT */, event_context);
}
static PARAM_CALLBACK_execute(node) {
node.process_event_execute({});
}
}