画布液化功能优化(图片清晰度、添加指示器)

This commit is contained in:
李志鹏
2025-09-26 15:12:57 +08:00
parent c3d7cbcc83
commit 844d5c0972
7 changed files with 1511 additions and 1339 deletions

View File

@@ -258,6 +258,23 @@ const setClosePanel = ()=>{
closePanel.value = !closePanel.value
}
// 工具管理器和画布管理器
const toolManager = inject("toolManager");
const canvasManager = inject("canvasManager");
watch(size, (newSize, oldSize) => {
setBrushIndicatorSize(newSize)
})
// 设置笔刷指示器大小
function setBrushIndicatorSize(size) {
// 如果工具管理器存在,立即应用此更改
console.log(`=========== ${size}`,toolManager);
if (toolManager) {
toolManager.updateBrushIndicatorSize(size);
}
}
// 监听当前工具变化 - 参考 SelectionPanel 的实现方式
watch(
() => props.activeTool,
@@ -269,10 +286,11 @@ watch(
// 如果面板未显示且有合适的目标对象,则显示面板
if (!visible.value) {
visible.value = true;
closePanel.value = true
closePanel.value = true
// 检查是否有可液化的对象
checkAndShowPanel();
}
setBrushIndicatorSize(size.value)
} else {
visible.value = false; // 切换到其他工具时隐藏面板
// 切换到其他工具,隐藏液化面板
@@ -1634,24 +1652,26 @@ function stopPressTimer() {
color: #333;
border: 1px solid rgba(0, 0, 0, 0.05);
padding-bottom: 12px;
&.active{
transform: translateY(100%);
> .btn{
> i{
transform: rotate(90deg);
&.active{
transform: translateY(100%);
> .btn{
> i{
transform: rotate(90deg);
}
}
}
}
> .btn{
width: 100%;
text-align: center;
cursor: pointer;
> i{
font-size: 1.4rem;
display: block;
transform: rotate(270deg);
}
width: 100%;
text-align: center;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
> i{
font-size: 1.4rem;
transform: rotate(270deg);
}
}
}