feat: Add texture management features and update UI components

This commit is contained in:
bighuixiang
2025-06-26 23:26:50 +08:00
parent fd05c70937
commit fd9b1721c1
9 changed files with 337 additions and 173 deletions

View File

@@ -478,80 +478,80 @@ export class TextureBrush extends BaseBrush {
order: 100,
hidden: allTextures.length === 0,
},
{
id: "textureRepeat",
name: "纹理重复模式",
type: "select",
defaultValue: this.textureRepeat,
options: [
{ value: "repeat", label: "双向重复" },
{ value: "repeat-x", label: "水平重复" },
{ value: "repeat-y", label: "垂直重复" },
{ value: "no-repeat", label: "不重复" },
],
description: "设置纹理的重复模式",
category: "纹理设置",
order: 110,
},
{
id: "textureScale",
name: "纹理缩放",
type: "slider",
defaultValue: this.textureScale,
min: 0.1,
max: 5,
step: 0.1,
description: "调整纹理的缩放比例",
category: "纹理设置",
order: 120,
},
{
id: "textureAngle",
name: "纹理旋转",
type: "slider",
defaultValue: this.textureAngle,
min: 0,
max: 360,
step: 5,
description: "调整纹理的旋转角度",
category: "纹理设置",
order: 130,
},
{
id: "textureOpacity",
name: "纹理透明度",
type: "slider",
defaultValue: this.textureOpacity,
min: 0,
max: 1,
step: 0.05,
description: "调整纹理的透明度",
category: "纹理设置",
order: 140,
},
{
id: "uploadTexture",
name: "上传纹理",
type: "button",
action: "uploadTexture",
description: "上传自定义纹理",
category: "纹理设置",
order: 150,
},
{
id: "texturePreview",
name: "纹理预览",
type: "preview",
description: "当前纹理预览",
category: "纹理设置",
order: 160,
getValue: () => {
const currentTexture = this.getCurrentTexture();
return currentTexture
? texturePresetManager.getTexturePreviewUrl(currentTexture)
: null;
},
},
// {
// id: "textureRepeat",
// name: "纹理重复模式",
// type: "select",
// defaultValue: this.textureRepeat,
// options: [
// { value: "repeat", label: "双向重复" },
// { value: "repeat-x", label: "水平重复" },
// { value: "repeat-y", label: "垂直重复" },
// { value: "no-repeat", label: "不重复" },
// ],
// description: "设置纹理的重复模式",
// category: "纹理设置",
// order: 110,
// },
// {
// id: "textureScale",
// name: "纹理缩放",
// type: "slider",
// defaultValue: this.textureScale,
// min: 0.1,
// max: 5,
// step: 0.1,
// description: "调整纹理的缩放比例",
// category: "纹理设置",
// order: 120,
// },
// {
// id: "textureAngle",
// name: "纹理旋转",
// type: "slider",
// defaultValue: this.textureAngle,
// min: 0,
// max: 360,
// step: 5,
// description: "调整纹理的旋转角度",
// category: "纹理设置",
// order: 130,
// },
// {
// id: "textureOpacity",
// name: "纹理透明度",
// type: "slider",
// defaultValue: this.textureOpacity,
// min: 0,
// max: 1,
// step: 0.05,
// description: "调整纹理的透明度",
// category: "纹理设置",
// order: 140,
// },
// {
// id: "uploadTexture",
// name: "上传纹理",
// type: "file",
// action: "uploadTexture",
// description: "上传自定义纹理",
// category: "纹理设置",
// order: 150,
// },
// {
// id: "texturePreview",
// name: "纹理预览",
// type: "preview",
// description: "当前纹理预览",
// category: "纹理设置",
// order: 160,
// getValue: () => {
// const currentTexture = this.getCurrentTexture();
// return currentTexture
// ? texturePresetManager.getTexturePreviewUrl(currentTexture)
// : null;
// },
// },
];
// 合并并返回所有属性