Frontend changes:
- Wire Smart Select and Color Select to canvas click handlers
- Add externalSelection prop to ImageCanvas for displaying AI-generated selections
- Add zoom controls (mouse wheel + buttons) to ImageCanvas
- Fix layer buttons (New Layer, Delete, Duplicate) with proper handlers
- Lift advancedToolMode state to App.jsx for coordination between components
- Add tool mode indicator overlay on canvas
Backend changes:
- Update smart-select endpoint to return JSON with polygon and bbox data
- Update color-select endpoint to return JSON with polygon and bbox data
- Add _mask_to_polygon helper function using OpenCV contour detection
- Add cv2 and base64 imports to tools.py
API changes:
- smartSelect and colorSelect now return { polygon, bbox, mask_base64 }
109 lines
1.9 KiB
CSS
109 lines
1.9 KiB
CSS
.canvas-container {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
min-height: calc(100vh - 180px);
|
|
background-color: #2a2a2a;
|
|
border: 2px solid #444;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.canvas-container canvas {
|
|
display: block;
|
|
}
|
|
|
|
.clear-selection-btn {
|
|
position: absolute;
|
|
top: 10px;
|
|
right: 10px;
|
|
background-color: #ff4444;
|
|
color: white;
|
|
padding: 8px 16px;
|
|
z-index: 10;
|
|
}
|
|
|
|
.clear-selection-btn:hover {
|
|
background-color: #cc0000;
|
|
}
|
|
|
|
.selection-hint {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
background-color: rgba(0, 0, 0, 0.8);
|
|
color: #00ff00;
|
|
padding: 8px 16px;
|
|
border-radius: 4px;
|
|
font-size: 12px;
|
|
z-index: 10;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
/* Zoom controls */
|
|
.zoom-controls {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
right: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
background-color: rgba(0, 0, 0, 0.8);
|
|
padding: 6px 10px;
|
|
border-radius: 4px;
|
|
z-index: 10;
|
|
}
|
|
|
|
.zoom-controls button {
|
|
width: 28px;
|
|
height: 28px;
|
|
padding: 0;
|
|
font-size: 18px;
|
|
font-weight: bold;
|
|
background-color: #444;
|
|
color: white;
|
|
border: 1px solid #666;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.zoom-controls button:hover {
|
|
background-color: #555;
|
|
}
|
|
|
|
.zoom-level {
|
|
color: white;
|
|
font-size: 12px;
|
|
min-width: 45px;
|
|
text-align: center;
|
|
}
|
|
|
|
/* Tool mode indicator */
|
|
.tool-mode-indicator {
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
background-color: rgba(0, 120, 255, 0.9);
|
|
color: white;
|
|
padding: 10px 20px;
|
|
border-radius: 4px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
z-index: 10;
|
|
white-space: nowrap;
|
|
animation: pulse 2s infinite;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { opacity: 1; }
|
|
50% { opacity: 0.7; }
|
|
}
|