feat: click-drag drawing, layer tree, settings modal, UI improvements
- interaction: click-drag drawing for 2-point tools (line, rect, circle, dimension, leader) - interaction: preview rendering during drag with setPreviewElement - interaction: handleDrawDown only sets phase=drawing on first point - CanvasArea: sync activeLayerId to LayerManager - CanvasArea: callback refresh useEffect prevents stale closures - App.tsx: functional setElements updates for handleElementCreated/Deleted/Modified - LayerPanel: tree structure with sub-layers (onReorder, onAddSubLayer) - TreeView: drag-and-drop reordering support - RightSidebar: onReorder, onAddSubLayer, onUpdateElement props - PropertiesPanel: onUpdateElement prop - SettingsModal: personal/password/language/theme/users/plugins/AI tabs - styles.css: extensive UI styling additions - types: updated RightSidebarProps, CanvasAreaProps, LayerPanelProps
This commit is contained in:
+467
-3
@@ -372,8 +372,7 @@ a:hover { text-decoration: underline; }
|
||||
align-items: center;
|
||||
padding: 0 var(--spacing-md);
|
||||
gap: var(--spacing-lg);
|
||||
overflow-x: auto;
|
||||
scrollbar-width: thin;
|
||||
overflow: hidden;
|
||||
}
|
||||
.ribbon-group {
|
||||
display: flex;
|
||||
@@ -435,7 +434,13 @@ a:hover { text-decoration: underline; }
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.app-body.left-collapsed { grid-template-columns: 0 1fr var(--rightbar-w); }
|
||||
.app-body.left-collapsed { grid-template-columns: 28px 1fr var(--rightbar-w); }
|
||||
.app-body.left-collapsed .leftbar { padding: 4px; }
|
||||
.app-body.left-collapsed .leftbar-header { padding: 4px; border: none; justify-content: center; }
|
||||
.app-body.left-collapsed .leftbar-title { display: none; }
|
||||
.app-body.left-collapsed .leftbar .tool-section { display: none; }
|
||||
.app-body.left-collapsed .leftbar-toggle svg { transform: rotate(180deg); }
|
||||
.app-body.left-collapsed .leftbar-toggle { display: grid !important; }
|
||||
.app-body.right-collapsed { grid-template-columns: var(--leftbar-w) 1fr 0; }
|
||||
.app-body.both-collapsed { grid-template-columns: 0 1fr 0; }
|
||||
|
||||
@@ -1430,6 +1435,153 @@ body.drawer-open { overflow: hidden; }
|
||||
.tree-row:hover { background: var(--color-surface-2, rgba(0,0,0,0.04)); }
|
||||
.tree-row.active { background: rgba(37, 99, 235, 0.10); color: var(--color-primary, #2563eb); font-weight: 500; }
|
||||
|
||||
/* TreeView component actual classes */
|
||||
.tree-view { padding: 2px 0; }
|
||||
.tree-node {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
min-height: 28px;
|
||||
color: var(--color-text);
|
||||
transition: background-color .12s;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tree-node:hover { background: var(--color-surface-2); }
|
||||
.tree-node.active { background: var(--color-primary-50); color: var(--color-primary); font-weight: 500; }
|
||||
[data-theme="dark"] .tree-node.active { background: var(--color-surface-3); }
|
||||
.tree-toggle {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
color: var(--color-text-muted);
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
border-radius: 3px;
|
||||
transition: background-color .12s;
|
||||
}
|
||||
.tree-toggle:hover { background: var(--color-surface-3); color: var(--color-text); }
|
||||
.tree-toggle svg { width: 12px; height: 12px; transition: transform .15s; }
|
||||
.tree-toggle-placeholder { width: 16px; flex-shrink: 0; }
|
||||
.tree-label {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
color: var(--color-text);
|
||||
}
|
||||
.tree-node.active .tree-label { color: var(--color-primary); }
|
||||
.tree-count {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-muted);
|
||||
background: var(--color-surface-2);
|
||||
padding: 1px 6px;
|
||||
border-radius: 8px;
|
||||
flex-shrink: 0;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.tree-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tree-detail {
|
||||
padding: 4px 8px 4px 24px;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
background: var(--color-surface-2);
|
||||
}
|
||||
.tree-children {
|
||||
border-left: 1px dashed var(--color-border);
|
||||
margin-left: 11px;
|
||||
}
|
||||
|
||||
/* BlockLibrary tree (distinct from TreeView) */
|
||||
.lib-tree-node { margin-bottom: 2px; }
|
||||
.lib-tree-node .tree-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
min-height: 28px;
|
||||
color: var(--color-text);
|
||||
transition: background-color .12s;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.lib-tree-node .tree-item:hover { background: var(--color-surface-2); }
|
||||
.lib-tree-node .tree-item .tree-toggle {
|
||||
width: 16px;
|
||||
flex-shrink: 0;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.lib-tree-node .tree-item .tree-icon { font-size: 14px; flex-shrink: 0; }
|
||||
.lib-tree-node .tree-item .tree-label {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
color: var(--color-text);
|
||||
}
|
||||
.lib-tree-node .tree-item .tree-count {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-muted);
|
||||
background: var(--color-surface-2);
|
||||
padding: 1px 6px;
|
||||
border-radius: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.lib-tree-node .tree-children {
|
||||
padding-left: 20px;
|
||||
border-left: 1px dashed var(--color-border);
|
||||
margin-left: 11px;
|
||||
}
|
||||
.lib-tree-node .tree-item-leaf {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
cursor: grab;
|
||||
min-height: 28px;
|
||||
color: var(--color-text);
|
||||
transition: background-color .12s;
|
||||
}
|
||||
.lib-tree-node .tree-item-leaf:hover { background: var(--color-surface-2); }
|
||||
.lib-tree-node .tree-item-leaf .tree-icon { font-size: 14px; flex-shrink: 0; }
|
||||
.lib-tree-node .tree-item-leaf .tree-label {
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 12px;
|
||||
color: var(--color-text);
|
||||
}
|
||||
.lib-tree-node .tree-item-leaf .tree-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
flex-shrink: 0;
|
||||
opacity: 0;
|
||||
transition: opacity .15s;
|
||||
}
|
||||
.lib-tree-node .tree-item-leaf:hover .tree-actions { opacity: 1; }
|
||||
|
||||
.tree-toggle {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
@@ -1546,3 +1698,315 @@ body.drawer-open { overflow: hidden; }
|
||||
background: white; transition: transform 0.2s;
|
||||
}
|
||||
.plugin-toggle.on .plugin-toggle-knob { transform: translateX(16px); }
|
||||
|
||||
/* Export Menu */
|
||||
.export-menu-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.4);
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.export-menu {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-lg);
|
||||
padding: 16px;
|
||||
min-width: 280px;
|
||||
}
|
||||
.export-menu-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text);
|
||||
margin-bottom: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.export-menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--color-text);
|
||||
transition: background var(--t-fast);
|
||||
text-align: left;
|
||||
}
|
||||
.export-menu-item:hover { background: var(--color-surface-2); }
|
||||
.export-menu-format {
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
color: var(--color-primary);
|
||||
min-width: 40px;
|
||||
}
|
||||
.export-menu-desc {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
/* ===================== DRAG & DROP INDICATORS ===================== */
|
||||
.tree-node.tree-drag-before {
|
||||
border-top: 2px solid var(--color-primary, #2563eb);
|
||||
margin-top: -1px;
|
||||
}
|
||||
.tree-node.tree-drag-after {
|
||||
border-bottom: 2px solid var(--color-primary, #2563eb);
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.tree-node.tree-drag-inside {
|
||||
border: 2px solid var(--color-primary, #2563eb);
|
||||
background: rgba(37, 99, 235, 0.08);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.tree-node.tree-dragging {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
/* ===================== SETTINGS MODAL ===================== */
|
||||
.settings-modal-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.4);
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
z-index: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.settings-modal {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-lg);
|
||||
max-width: 700px;
|
||||
max-height: 80vh;
|
||||
width: 90%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.settings-modal-close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
color: var(--color-text-muted);
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background 0.2s, color 0.2s;
|
||||
z-index: 1;
|
||||
}
|
||||
.settings-modal-close:hover {
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
}
|
||||
.settings-modal-tabs {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
padding: 0 12px;
|
||||
flex-shrink: 0;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.settings-modal-tab {
|
||||
padding: 12px 16px;
|
||||
background: none;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: color 0.2s, border-color 0.2s;
|
||||
}
|
||||
.settings-modal-tab:hover {
|
||||
color: var(--color-text);
|
||||
}
|
||||
.settings-modal-tab.active {
|
||||
color: var(--color-primary);
|
||||
border-bottom-color: var(--color-primary);
|
||||
}
|
||||
.settings-modal-content {
|
||||
padding: 20px 24px;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
.settings-tab-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.settings-label {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text-muted);
|
||||
margin-top: 10px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.settings-label:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.settings-input {
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
font-size: 13px;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.settings-input:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
.settings-avatar-preview {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-primary);
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.settings-message {
|
||||
font-size: 12px;
|
||||
color: var(--color-primary);
|
||||
padding: 8px 0;
|
||||
}
|
||||
.settings-btn {
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-primary);
|
||||
color: white;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s;
|
||||
margin-top: 12px;
|
||||
align-self: flex-start;
|
||||
}
|
||||
.settings-btn:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.settings-btn-danger {
|
||||
padding: 6px 12px;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
background: #e74c3c;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
.settings-btn-danger:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.settings-toggle-group {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
.settings-toggle-btn {
|
||||
padding: 8px 20px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text-muted);
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.settings-toggle-btn.active {
|
||||
background: var(--color-primary);
|
||||
color: white;
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
.settings-color-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.settings-color-picker input[type="color"] {
|
||||
width: 40px;
|
||||
height: 32px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
}
|
||||
.settings-color-value {
|
||||
font-size: 13px;
|
||||
color: var(--color-text-muted);
|
||||
font-family: monospace;
|
||||
}
|
||||
.settings-users-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.settings-user-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.settings-user-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--color-surface-2);
|
||||
}
|
||||
.settings-user-avatar {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-primary);
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.settings-user-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.settings-user-name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--color-text);
|
||||
}
|
||||
.settings-user-email {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.settings-user-role {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--color-primary);
|
||||
background: rgba(37, 99, 235, 0.1);
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user