Merge pull request #4 from EnragedAntelope/claude/review-comfyui-compatibility-015ch9jXYy18WsgXqoj8t5CF
Fix widget callback context bug and update credits
This commit is contained in:
@@ -97,6 +97,12 @@ for prompt in prompts:
|
||||
- **Symptom:** Canvas widget completely invisible, no drawing interface shown
|
||||
- **Fix:** Added `WEB_DIRECTORY = os.path.join(os.path.dirname(__file__), "js")` export
|
||||
- **Impact:** JavaScript extensions weren't being loaded, canvas completely broken
|
||||
- 🐛 **Widget Callback Context Bug:** Fixed `TypeError: can't access property "step", this.options is undefined`
|
||||
- **Cause:** Width/height widget callbacks used `.bind(this)` which bound to node, then called original callback with node as context
|
||||
- **Symptom:** Loading workflows crashed with "can't access property step" error (original callback expected widget as `this`)
|
||||
- **Fix:** Removed `.bind(this)`, captured node reference in closure, call original callback with widget context using `.call(this, value)`
|
||||
- **Impact:** Workflows wouldn't load at all in web-based ComfyUI instances (MimicPC, browser-based)
|
||||
- **Location:** RegionalPrompting.js:364-393
|
||||
- 🎨 **Node Naming:** Removed "EASY!" terminology and made names model-agnostic
|
||||
- **Before:** "Regional Prompter (Flux/Chroma - Easy!)" ← Model-specific and gimmicky
|
||||
- **After:** "Regional Prompter (Mask-Based)" ← Describes technique, not specific models
|
||||
|
||||
@@ -450,7 +450,7 @@ TL;DR: Use it however you want, but don't blame us if it breaks! 😄
|
||||
**Current Maintainer:** EnragedAntelope
|
||||
**Repository:** [github.com/EnragedAntelope/ComfyUI_RegionalConditioning](https://github.com/EnragedAntelope/ComfyUI_RegionalConditioning)
|
||||
|
||||
**Original Author:** Davemane42#0042
|
||||
**Original Author:** [Davemane42](https://github.com/Davemane42)
|
||||
**Original Concept:** Visual regional conditioning interface for ComfyUI
|
||||
|
||||
**Modernization & Enhancement (2025):**
|
||||
|
||||
+10
-8
@@ -361,34 +361,36 @@ app.registerExtension({
|
||||
|
||||
if (widthWidget) {
|
||||
const originalWidthCallback = widthWidget.callback;
|
||||
const node = this; // Capture node reference for closure
|
||||
widthWidget.callback = function(value) {
|
||||
// Update canvas property to match
|
||||
this.properties["width"] = value;
|
||||
node.properties["width"] = value;
|
||||
// Force canvas redraw
|
||||
if (app.graph) {
|
||||
app.graph.setDirtyCanvas(true, true);
|
||||
}
|
||||
// Call original callback if it exists
|
||||
// Call original callback if it exists (with widget as context)
|
||||
if (originalWidthCallback) {
|
||||
originalWidthCallback.apply(this, arguments);
|
||||
originalWidthCallback.call(this, value);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
}
|
||||
|
||||
if (heightWidget) {
|
||||
const originalHeightCallback = heightWidget.callback;
|
||||
const node = this; // Capture node reference for closure
|
||||
heightWidget.callback = function(value) {
|
||||
// Update canvas property to match
|
||||
this.properties["height"] = value;
|
||||
node.properties["height"] = value;
|
||||
// Force canvas redraw
|
||||
if (app.graph) {
|
||||
app.graph.setDirtyCanvas(true, true);
|
||||
}
|
||||
// Call original callback if it exists
|
||||
// Call original callback if it exists (with widget as context)
|
||||
if (originalHeightCallback) {
|
||||
originalHeightCallback.apply(this, arguments);
|
||||
originalHeightCallback.call(this, value);
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
}
|
||||
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user