Rename button parameter
This commit is contained in:
@@ -145,7 +145,6 @@
|
|||||||
$: if (containerElem) {
|
$: if (containerElem) {
|
||||||
const canvas = containerElem.querySelector<HTMLDivElement>("#graph-canvas")
|
const canvas = containerElem.querySelector<HTMLDivElement>("#graph-canvas")
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
console.warn("reg!");
|
|
||||||
const paneNode = canvas.closest(".splitpanes__pane")
|
const paneNode = canvas.closest(".splitpanes__pane")
|
||||||
if (paneNode) {
|
if (paneNode) {
|
||||||
(paneNode as HTMLElement).ontransitionstart = () => {
|
(paneNode as HTMLElement).ontransitionstart = () => {
|
||||||
|
|||||||
@@ -99,6 +99,13 @@
|
|||||||
if (spec.canShow)
|
if (spec.canShow)
|
||||||
return spec.canShow(widget);
|
return spec.canShow(widget);
|
||||||
|
|
||||||
|
if (widget.type === "widget" && spec.validNodeTypes) {
|
||||||
|
const node = (widget as WidgetLayout).node
|
||||||
|
if (!node)
|
||||||
|
return false;
|
||||||
|
return spec.validNodeTypes.indexOf(node.type) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
return spec.name in widget.attrs
|
return spec.name in widget.attrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -499,14 +499,13 @@ LiteGraph.registerNodeType({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export interface ComfyButtonProperties extends ComfyWidgetProperties {
|
export interface ComfyButtonProperties extends ComfyWidgetProperties {
|
||||||
message: string,
|
param: string
|
||||||
variant: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ComfyButtonNode extends ComfyWidgetNode<boolean> {
|
export class ComfyButtonNode extends ComfyWidgetNode<boolean> {
|
||||||
override properties: ComfyButtonProperties = {
|
override properties: ComfyButtonProperties = {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
message: "bang"
|
param: "bang"
|
||||||
}
|
}
|
||||||
|
|
||||||
static slotLayout: SlotLayout = {
|
static slotLayout: SlotLayout = {
|
||||||
@@ -525,8 +524,8 @@ export class ComfyButtonNode extends ComfyWidgetNode<boolean> {
|
|||||||
|
|
||||||
onClick() {
|
onClick() {
|
||||||
this.setValue(true)
|
this.setValue(true)
|
||||||
this.triggerSlot(0, this.properties.message);
|
this.triggerSlot(0, this.properties.param);
|
||||||
this.setValue(false)
|
this.setValue(false) // TODO onRelease
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(name?: string) {
|
constructor(name?: string) {
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
|
|||||||
|
|
||||||
// Button
|
// Button
|
||||||
{
|
{
|
||||||
name: "message",
|
name: "param",
|
||||||
type: "string",
|
type: "string",
|
||||||
location: "nodeProps",
|
location: "nodeProps",
|
||||||
editable: true,
|
editable: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user