diff --git a/ts/reroute.ts b/ts/reroute.ts index 2b8d6b4..5443fef 100644 --- a/ts/reroute.ts +++ b/ts/reroute.ts @@ -30,8 +30,14 @@ declare const LGraphNode: typeof TLGraphNode; declare const LGraphCanvas: typeof TLGraphCanvas; const rerouteConfig = rgthreeConfig?.['nodes']?.['reroute'] || {}; -let configWidth = Math.round((Number(rerouteConfig['default_width']) || 40) / 10) * 10; -let configHeight = Math.round((Number(rerouteConfig['default_height']) || 30) / 10) * 10; +let configWidth = Math.max(Math.round((Number(rerouteConfig['default_width']) || 40) / 10) * 10, 10); +let configHeight = Math.max(Math.round((Number(rerouteConfig['default_height']) || 30) / 10) * 10, 10); +// Don't allow too small sizes. Granted, 400 is too small, but at least you can right click and +// resize... 10x10 you cannot. +while(configWidth * configHeight < 400) { + configWidth += 10; + configHeight += 10; +} const configDefaultSize = [configWidth, configHeight] as Vector2; const configResizable = !!rerouteConfig['default_resizable']; let configLayout: [string, string] = rerouteConfig['default_layout']; diff --git a/web/reroute.js b/web/reroute.js index 4a7a71c..1961c8c 100644 --- a/web/reroute.js +++ b/web/reroute.js @@ -4,8 +4,12 @@ import { rgthreeConfig } from "./rgthree_config.js"; import { rgthree } from "./rgthree.js"; import { LAYOUT_CLOCKWISE, LAYOUT_LABEL_OPPOSITES, LAYOUT_LABEL_TO_DATA, addConnectionLayoutSupport, addMenuItem, getSlotLinks, wait, } from "./utils.js"; const rerouteConfig = ((_a = rgthreeConfig === null || rgthreeConfig === void 0 ? void 0 : rgthreeConfig['nodes']) === null || _a === void 0 ? void 0 : _a['reroute']) || {}; -let configWidth = Math.round((Number(rerouteConfig['default_width']) || 40) / 10) * 10; -let configHeight = Math.round((Number(rerouteConfig['default_height']) || 30) / 10) * 10; +let configWidth = Math.max(Math.round((Number(rerouteConfig['default_width']) || 40) / 10) * 10, 10); +let configHeight = Math.max(Math.round((Number(rerouteConfig['default_height']) || 30) / 10) * 10, 10); +while (configWidth * configHeight < 400) { + configWidth += 10; + configHeight += 10; +} const configDefaultSize = [configWidth, configHeight]; const configResizable = !!rerouteConfig['default_resizable']; let configLayout = rerouteConfig['default_layout'];