remote sponsors && number widget fix

This commit is contained in:
zombieyang
2025-04-29 09:01:01 +08:00
parent 900ef4175b
commit 03e2133f9a
5 changed files with 102 additions and 42 deletions
+80
View File
@@ -0,0 +1,80 @@
{
"LICENSE": {
"name": "BSD3-Clause",
"url": {
"en": "https://github.com/zombieyang/sd-ppp/blob/main/LICENSE",
"zhcn": "https://gitee.com/zombieyang/sd-ppp/blob/main/LICENSE"
}
},
"sponsors": [
{
"name": "四喜AI",
"url": "https://v.douyin.com/hD2X7S717uw/"
},
{
"name": "沐沐AI",
"url": "https://v.douyin.com/k6yKDEcVgP8/"
}
],
"links": [
{
"name": "猫咪老师Reimagined",
"url": "https://www.xiaohongshu.com/user/profile/59f1fcc411be101aba7f048f"
},
{
"name": "来真的",
"url": "https://space.bilibili.com/590784254"
},
{
"name": "哑狗Egao",
"url": "https://space.bilibili.com/284721975"
}
],
"community": {
"en": [
{
"name": "Github",
"url": "https://github.com/zombieyang/sd-ppp"
},
{
"name": "Discord",
"url": "https://discord.gg/9HeGjDvEmn"
},
{
"name": "Youtube",
"url": "https://www.youtube.com/@Github-Zombeeyang/videos"
}
],
"zhcn": [
{
"name": "Github",
"url": "https://github.com/zombieyang/sd-ppp"
},
{
"name": "QQ频道",
"url": "https://pd.qq.com/s/5m42umo28"
},
{
"name": "Bilibili",
"url": "https://space.bilibili.com/44908313"
}
]
},
"cloud": {
"en": [],
"zhcn": [
{
"name": "Cephalon",
"url": "https://cephalon.cloud/share/register-landing?invite_id=m95SDj",
"icon": "https://cephalon.cloud/favicon.ico",
"color": "#000000"
},
{
"name": "晨羽智云",
"url": "https://www.chenyu.cn/console/login?invitationCode=BUD913",
"icon": "https://www.chenyu.cn/favicon.ico",
"color": "#f3ac40"
}
]
}
}
@@ -66,37 +66,8 @@ export class GetTextFromLayerNode extends SDPPPDownloadableNode {
delete nodeData.input.optional['document'];
}
}
private documentWidget: DocumentWidget;
private layerWidget: LayerWidget;
protected async update() {
this.documentWidget?.lockMode(this.layerConnected, i18n('document linked'))
this.layerWidget?.lockMode(this.layerConnected, i18n('layer linked'))
this.documentWidget.update();
this.layerWidget.update();
super.update();
if (!this.node.widgets[0].label)
this.node.widgets[0].label = i18n(this.node.widgets[0].name)
if (!this.node.widgets[1].label)
this.node.widgets[1].label = i18n(this.node.widgets[1].name)
this.node.inputs[0].label = i18n(this.node.inputs[0].name)
this.node.outputs[0].label = i18n(this.node.outputs[0].name)
}
constructor(node: any) {
const documentWidget = DocumentWidget.create(node, 'document')
const layerWidget = LayerWidget.create(node, 'layer_or_group', {
documentWidgetInNode: documentWidget,
extraOptions: []
});
super(node);
this.documentWidget = documentWidget
this.layerWidget = layerWidget
}
protected layerConnected: boolean = false;
protected inputConnectionChange(index: number, connected: boolean) {
super.inputConnectionChange(index, connected);
if (index == 0) {
this.layerConnected = connected;
}
}
}
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useCallback, useState, useEffect } from 'react';
import { Flex, InputNumber, Slider, Space, Typography } from 'antd';
import { useUIWeightCSS } from './hooks.mts';
import { BaseWidgetProps } from './_base';
@@ -22,16 +22,26 @@ export const NumberWidget: React.FC<NumberWidgetProps> = ({
onValueChange
}) => {
const uiWeightCSS = useUIWeightCSS(uiWeight || 12);
const handleValueChange = (newValue: number | null) => {
const [localValue, setLocalValue] = useState<number>(+value.toFixed(3));
// Update local state when props value changes
useEffect(() => {
setLocalValue(+value.toFixed(3));
}, [value]);
const handleValueChange = useCallback((newValue: number | null) => {
if (newValue !== null) {
// 保留3位小数
const value = +newValue.toFixed(3);
onValueChange(value);
const roundedValue = +newValue.toFixed(3);
setLocalValue(roundedValue);
}
};
const currentValue = +value.toFixed(3);
}, []);
const handleBlur = useCallback(() => {
// Only call onValueChange when input loses focus
onValueChange(localValue);
}, [localValue, onValueChange]);
// 检查步长范围是否过大
// const isStepRangeTooBig = ((inputMax - inputMin) / inputStep) > 1000;
@@ -70,8 +80,9 @@ export const NumberWidget: React.FC<NumberWidgetProps> = ({
min={inputMin}
max={inputMax}
step={inputStep}
value={currentValue}
value={localValue}
onChange={handleValueChange}
onBlur={handleBlur}
controls={false}
/>
</Flex>
Submodule typescripts/modules/photoshop-internal updated: ace712eb98...24156c5676
+2 -4
View File
@@ -202,14 +202,12 @@ export default {
// about
'This plugin is based on sd-ppp': '本插件基于sd-ppp开发',
'And follows its open source license:': '并遵循其开源协议:',
"https://www.youtube.com/@Github-Zombeeyang/videos": 'https://space.bilibili.com/44908313',
"Youtube": 'BiliBili',
"https://discord.gg/9HeGjDvEmn": "https://pd.qq.com/s/5m42umo28",
"Discord": 'QQ频道',
"Cloud": "云端",
"Sponsors": "赞助",
"waiting...": '虚位以待',
'Links': '友情链接',
'Community': '社区',
'LICENSE:': '许可证:',
// comfy popup
"upload": "上传",