From c5fbb321e09a4ff231a0773b028d2d4f549a345f Mon Sep 17 00:00:00 2001 From: toto Date: Wed, 10 Jan 2024 19:09:57 +0800 Subject: [PATCH] add js file --- __init__.py | 2 ++ js/facechain-apperance.js | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 js/facechain-apperance.js diff --git a/__init__.py b/__init__.py index e83e1af..edb0fa0 100644 --- a/__init__.py +++ b/__init__.py @@ -8,6 +8,8 @@ parent_dir = os.path.dirname(root_path) sys.path.append(root_path) from facechain.nodes import * from facechain.style_loader_node import * +WEB_DIRECTORY = "js" + NODE_CLASS_MAPPINGS = { "FC StyleLoraLoad": FCStyleLoraLoad, diff --git a/js/facechain-apperance.js b/js/facechain-apperance.js new file mode 100644 index 0000000..f0d5091 --- /dev/null +++ b/js/facechain-apperance.js @@ -0,0 +1,19 @@ +import {app} from "../../scripts/app.js"; + +const SPECIFIC_WIDTH = 400; // Set to desired width + +function setNodeWidthForMappedTitles(node) { + node.setSize([SPECIFIC_WIDTH, node.size[1]]); +} + + +app.registerExtension({ + name: "facechain.appearance", + async beforeRegisterNodeDef(nodeType, nodeData, _app) { + if (nodeData.name === "FC StyleLoraLoad") { + nodeType.prototype.onNodeCreated = function () { + setNodeWidthForMappedTitles(this) + }; + } + }, +}); \ No newline at end of file