3 Commits
Author SHA1 Message Date
rubz 6f8ad8320b fix: complete Nodes 2.0 compatibility for custom widgets, bump to 1.1.1
Simplifies the preset-chip picker (Smart Resize / Smart Batch Resize)
to a single canvas implementation - drops the dual DOM-widget path,
so chips stay positioned correctly under "Longest side (px)" in both
classic and Nodes 2.0 rendering instead of jumping to the bottom of
the node.

Adds a shared setWidgetVisible() helper so dynamic show/hide (Counter
start, the hidden customtext output on every node) actually works
under Nodes 2.0's Vue reactivity - it previously only worked in
classic canvas mode.

Fixes two silent Nodes 2.0 rendering bugs: widgets only repaint via
their own triggerDraw(), not setDirtyCanvas(), so the active preset
chip and status-box text were going visually stale after an update
even though the underlying value was correct. And Nodes 2.0's
WidgetLegacy bridge permanently stamps a widget.width that classic
mode's own click hit-test then reads forever after - once a node had
ever rendered under Nodes 2.0, classic mode silently lost clicks on
the right side of a wide node. Both fixed by keeping widget state in
sync on every draw() instead of trusting it to survive across
renderer switches.

Also centers section-divider labels with flanking lines (was
label-left/line-right) and brightens the line color, which had
become nearly invisible under Nodes 2.0's extra canvas scaling.

README: reorders node sections into actual pipeline order (Prompt
Controller -> Profile Switch -> Resize -> Resolution Multiplier ->
Batch Resize, standalone tool last instead of mid-list), adds a
Nodes 2.0 compatibility screenshot, and refreshes the Smart Batch
Resize screenshot to match its current UI.
2026-08-13 20:45:33 +02:00
rubz c6c26a35fa fix: read live node width in draw() instead of a stale LiteGraph cache; cache-bust shared module imports
- LiteGraph caches a widget's .width the first time it lays a custom-typed
  widget out and reuses that cached value on every later draw() call. For a
  divider/status/preset widget added before the node reaches its final size,
  that cached width goes stale and never updates, making section-divider
  lines and the status box stop partway across the node instead of spanning
  it, and clipping/unevenly sizing the preset chips. All three shared
  widgets now read node.size[0] directly in draw() instead of trusting the
  widgetWidth parameter, which sidesteps the stale cache entirely.
- Add a ?v=2 query string to every import of the shared/*.mjs modules.
  aiohttp's static file server doesn't send Cache-Control: no-store for
  these (unlike the top-level registered extension .js files), so browsers
  were free to keep serving an old cached copy even across a hard reload.
  A versioned import URL forces a fresh fetch regardless of cache state.
2026-08-13 16:29:25 +02:00
rubz dd0c4d9b2e fix: make CraftKit's custom-drawn JS widgets render correctly under Nodes 2.0
- Add js/shared/{nodes2,canvas_widgets,preset_picker_widget}.mjs: widgets
  registered with type "button" get hijacked by ComfyUI's Vue widget
  registry (Nodes 2.0), which renders a generic button showing the raw
  internal widget name instead of calling our draw(). Dividers/status
  boxes now use type "custom" via addCustomWidget, which correctly falls
  through to the legacy-canvas bridge in both renderers. The interactive
  preset-chip picker is dual-path: canvas+hit-testing in classic mode,
  real <button> elements via addDOMWidget in Nodes 2.0 (mirrors how
  ComfyUI-Pixaroma solved the same problem for its own widgets)
- Rewire smart_batch_resize.js, smart_resize.js, smart_profile_switch.js,
  smart_prompt_controller.js to use the shared factories, removing the
  duplicated divider/status/preset-chip code that existed across them
- Fix a save/reload regression found during verification: repositioning
  the Nodes 2.0 preset-chip DOM widget into the middle of node.widgets
  after configure() has run desyncs Vue's value-to-row binding for every
  later widget (values appear shifted by one row, though the saved JSON
  itself is correct). The DOM widget is no longer repositioned under
  Nodes 2.0; classic mode is unaffected and keeps the original placement
2026-08-07 11:07:54 +02:00