add js file

This commit is contained in:
toto
2024-01-10 19:09:57 +08:00
parent 388500723a
commit c5fbb321e0
2 changed files with 21 additions and 0 deletions
+2
View File
@@ -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,
+19
View File
@@ -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)
};
}
},
});