feat: Refactor toolbar and icon interactions in ObjectFlowDesigner

This commit is contained in:
Chop
2025-06-26 22:42:38 +02:00
parent 643a4210ea
commit a45e8cf262
3 changed files with 700 additions and 196 deletions

View File

@@ -103,79 +103,297 @@ body {
}
.toolbar {
width: 250px;
width: 100px;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
padding: 1.5rem;
padding: 1rem 0.75rem;
border-right: 1px solid rgba(255, 255, 255, 0.2);
overflow-y: auto;
overflow: visible;
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.toolbar h3,
.toolbar h4 {
color: #4a5568;
margin-bottom: 1rem;
}
.object-palette {
margin-bottom: 2rem;
}
.palette-item {
.toolbar-section {
display: flex;
flex-direction: column;
align-items: center;
padding: 1rem;
margin-bottom: 1rem;
gap: 0.5rem;
}
.toolbar-label {
font-size: 0.7rem;
font-weight: 600;
color: #718096;
text-transform: uppercase;
letter-spacing: 0.5px;
writing-mode: horizontal-tb;
text-align: center;
line-height: 1.2;
}
.icon-toolbar {
display: flex;
flex-direction: column;
gap: 0.5rem;
align-items: center;
width: 100%;
}
.icon-btn {
width: 44px;
height: 44px;
border: none;
border-radius: 8px;
background: white;
border-radius: 12px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
border: 2px solid transparent;
position: relative;
}
.palette-item:hover {
transform: translateY(-3px);
.icon-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
border-color: #4299e1;
}
.palette-item span {
font-weight: 600;
color: #4a5568;
margin: 0.5rem 0;
.icon-btn.active {
background: #4299e1;
border-color: #3182ce;
transform: translateY(-1px);
}
.palette-item small {
color: #718096;
font-size: 0.8rem;
text-align: center;
.icon-btn.active:hover {
background: #3182ce;
}
.triangle-preview {
/* Tooltip enhancements */
.icon-btn::after {
content: attr(title);
position: absolute;
left: 100%;
top: 50%;
transform: translateY(-50%);
margin-left: 8px;
padding: 6px 8px;
background: rgba(0, 0, 0, 0.8);
color: white;
font-size: 0.7rem;
border-radius: 4px;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
z-index: 1000;
}
.icon-btn:hover::after {
opacity: 1;
}
/* Object Icons */
.icon-triangle {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 25px solid #48bb78;
border-left: 12px solid transparent;
border-right: 12px solid transparent;
border-bottom: 20px solid #48bb78;
}
.square-preview {
width: 30px;
height: 30px;
.icon-btn.active .icon-triangle {
border-bottom-color: white;
}
.icon-box {
width: 24px;
height: 24px;
background: #4299e1;
border-radius: 4px;
border-radius: 3px;
}
.connection-mode {
border-top: 1px solid rgba(0, 0, 0, 0.1);
padding-top: 1rem;
.icon-btn.active .icon-box {
background: white;
}
.connection-mode .btn {
.icon-pole {
width: 4px;
height: 28px;
background: #8b4513;
border-radius: 2px;
position: relative;
}
.icon-pole::before {
content: "";
position: absolute;
top: 2px;
left: -6px;
width: 16px;
height: 2px;
background: #4a5568;
border-radius: 1px;
}
.icon-pole::after {
content: "";
position: absolute;
top: 6px;
left: -6px;
width: 16px;
height: 2px;
background: #4a5568;
border-radius: 1px;
}
.icon-btn.active .icon-pole {
background: white;
}
.icon-btn.active .icon-pole::before,
.icon-btn.active .icon-pole::after {
background: white;
}
.icon-end {
width: 20px;
height: 20px;
border: 3px solid #e53e3e;
border-radius: 50%;
position: relative;
}
.icon-end::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 8px;
height: 8px;
background: #e53e3e;
border-radius: 50%;
}
.icon-btn.active .icon-end {
border-color: white;
}
.icon-btn.active .icon-end::before {
background: white;
}
/* Cable Icons */
.icon-underground {
width: 24px;
height: 3px;
background: #2d3748;
border-radius: 1.5px;
position: relative;
}
.icon-underground::before {
content: "";
position: absolute;
top: -3px;
left: 0;
width: 100%;
margin-bottom: 0.5rem;
height: 1px;
background: repeating-linear-gradient(
to right,
#2d3748 0px,
#2d3748 2px,
transparent 2px,
transparent 4px
);
}
.icon-btn.active .icon-underground {
background: white;
}
.icon-btn.active .icon-underground::before {
background: repeating-linear-gradient(
to right,
white 0px,
white 2px,
transparent 2px,
transparent 4px
);
}
.icon-overhead {
width: 24px;
height: 2px;
background: #2d3748;
border-radius: 1px;
}
.icon-btn.active .icon-overhead {
background: white;
}
/* Tool Icons */
.icon-select {
width: 20px;
height: 20px;
border: 2px solid #4a5568;
border-radius: 2px;
position: relative;
}
.icon-select::before {
content: "";
position: absolute;
top: 2px;
left: 2px;
width: 8px;
height: 8px;
border: 1px solid #4a5568;
border-radius: 1px;
}
.icon-btn.active .icon-select {
border-color: white;
}
.icon-btn.active .icon-select::before {
border-color: white;
}
.icon-delete {
width: 20px;
height: 20px;
position: relative;
}
.icon-delete::before,
.icon-delete::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 20px;
height: 2px;
background: #e53e3e;
border-radius: 1px;
}
.icon-delete::before {
transform: translate(-50%, -50%) rotate(45deg);
}
.icon-delete::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
.icon-btn.active .icon-delete::before,
.icon-btn.active .icon-delete::after {
background: white;
}
.canvas-container {
@@ -249,22 +467,38 @@ body {
}
.tooltip {
position: absolute;
background: rgba(0, 0, 0, 0.8);
position: fixed;
background: rgba(0, 0, 0, 0.9);
color: white;
padding: 0.5rem;
border-radius: 4px;
font-size: 0.8rem;
pointer-events: none;
z-index: 1000;
z-index: 999999;
display: none;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.2);
max-width: 200px;
word-wrap: break-word;
}
.mode-connecting #canvas {
.mode-connect-underground #canvas,
.mode-connect-overhead #canvas {
cursor: crosshair;
}
.mode-selecting #canvas {
.mode-place-triangle #canvas,
.mode-place-box #canvas,
.mode-place-pole #canvas,
.mode-place-end #canvas {
cursor: copy;
}
.mode-delete #canvas {
cursor: not-allowed;
}
.mode-select #canvas {
cursor: default;
}
@@ -362,6 +596,74 @@ body {
border-radius: 4px;
}
/* Node Type Selector Styles */
.node-type-selector {
display: flex;
gap: 8px;
margin: 8px 0;
}
.node-type-btn {
display: flex;
flex-direction: column;
align-items: center;
padding: 8px 12px;
border: 2px solid #e2e8f0;
border-radius: 8px;
background: #f7fafc;
cursor: pointer;
transition: all 0.2s ease;
flex: 1;
min-height: 60px;
font-family: inherit;
}
.node-type-btn:hover {
border-color: #4299e1;
background: #ebf8ff;
transform: translateY(-1px);
}
.node-type-btn.active {
border-color: #3182ce;
background: #3182ce;
color: white;
}
.node-type-btn .node-icon {
font-size: 16px;
margin-bottom: 4px;
display: block;
}
.node-type-btn .node-label {
font-size: 11px;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.node-type-btn.active .node-icon,
.node-type-btn.active .node-label {
color: white;
}
/* Different colors for each node type when active */
.node-type-btn[data-type="cable_box"].active {
border-color: #3182ce;
background: #3182ce;
}
.node-type-btn[data-type="pole"].active {
border-color: #4a5568;
background: #4a5568;
}
.node-type-btn[data-type="end_connection"].active {
border-color: #e53e3e;
background: #e53e3e;
}
/* Responsive design */
@media (max-width: 1024px) {
.main-content {