feat(图层管理): 添加图层管理面板及功能

- 新增图层面板UI组件,支持显示/隐藏图层
- 实现图层列表动态更新和选择功能
- 为所有图层元素添加唯一标识和隐藏状态控制
- 移除原有删除按钮,改为通过图层管理
- 在保存/恢复状态时处理图层可见性
- 优化预览生成逻辑,跳过隐藏图层
This commit is contained in:
Zhukj
2026-04-25 09:31:21 +08:00
parent ef6010a8b2
commit a7d0ad8e51
3 changed files with 561 additions and 70 deletions

View File

@@ -676,3 +676,223 @@ html, body {
.grid-lines.visible {
display: block;
}
/* ==================== 图层面板样式 ==================== */
.layers-panel {
position: fixed;
top: 60px;
right: -280px;
width: 260px;
height: calc(100vh - 80px);
background: #fff;
border-left: 1px solid #e0e0e0;
box-shadow: -2px 0 10px rgba(0,0,0,0.1);
z-index: 200;
display: flex;
flex-direction: column;
transition: right 0.3s ease;
}
.layers-panel.active {
right: 0;
}
.layers-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
border-bottom: 1px solid #e0e0e0;
background: #f8f8f8;
}
.layers-title {
font-size: 14px;
font-weight: 600;
color: #333;
}
.layers-close {
width: 24px;
height: 24px;
border: none;
background: transparent;
font-size: 18px;
color: #666;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
transition: all 0.2s;
}
.layers-close:hover {
background: #e0e0e0;
color: #333;
}
.layers-list {
flex: 1;
overflow-y: auto;
padding: 8px;
}
.layer-item {
display: flex;
align-items: center;
padding: 10px 12px;
margin-bottom: 4px;
background: #f5f5f5;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s;
border: 2px solid transparent;
}
.layer-item:hover {
background: #e8e8e8;
}
.layer-item.selected {
background: #e3f2fd;
border-color: #4a90e2;
}
.layer-item.hidden {
opacity: 0.5;
display: flex !important;
}
.layer-icon {
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10px;
font-size: 14px;
}
.layer-info {
flex: 1;
min-width: 0;
}
.layer-name {
font-size: 13px;
color: #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.layer-type {
font-size: 11px;
color: #999;
margin-top: 2px;
}
.layer-visibility {
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: bold;
cursor: pointer;
padding: 4px;
border-radius: 4px;
transition: all 0.2s;
background: #4CAF50;
color: white;
border: 2px solid transparent;
}
.layer-visibility.is-hidden {
background: #f44336;
color: white;
}
.layer-visibility:hover {
opacity: 0.8;
transform: scale(1.1);
}
.layer-visibility:active {
transform: scale(0.95);
}
.layers-actions {
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
padding: 12px;
border-top: 1px solid #e0e0e0;
background: #f8f8f8;
flex-wrap: wrap;
}
.layers-btn {
width: 32px;
height: 32px;
border: 1px solid #ddd;
background: #fff;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.layers-btn:hover {
background: #f0f0f0;
border-color: #ccc;
}
.layers-btn:disabled {
opacity: 0.3;
cursor: not-allowed;
}
.layers-btn-danger:hover {
background: #ffebee;
border-color: #ef5350;
}
.layers-divider {
width: 1px;
height: 24px;
background: #ddd;
margin: 0 4px;
}
/* 图层隐藏状态(用于画布上的元素) */
.layer-hidden {
visibility: hidden !important;
pointer-events: none !important;
}
/* 移动端适配 */
@media (max-width: 768px) {
.layers-panel {
width: 240px;
right: -260px;
top: 50px;
height: calc(100vh - 50px);
}
.layers-actions {
padding: 8px;
}
.layers-btn {
width: 28px;
height: 28px;
font-size: 12px;
}
}