657 lines
15 KiB
HTML
657 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="it">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Region Selector - ComfyUI</title>
|
|
<style>
|
|
/* Region Selector Stylesheet */
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
:root {
|
|
--primary-color: #2563eb;
|
|
--secondary-color: #64748b;
|
|
--success-color: #16a34a;
|
|
--danger-color: #dc2626;
|
|
--warning-color: #ea580c;
|
|
--bg-color: #f8fafc;
|
|
--panel-bg: #ffffff;
|
|
--border-color: #e2e8f0;
|
|
--text-color: #1e293b;
|
|
--text-light: #64748b;
|
|
--shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
background-color: var(--bg-color);
|
|
color: var(--text-color);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.selector-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
background-color: var(--panel-bg);
|
|
}
|
|
|
|
/* Header */
|
|
.selector-header {
|
|
position: relative;
|
|
padding: 20px 25px;
|
|
background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
|
|
color: white;
|
|
box-shadow: var(--shadow);
|
|
z-index: 10;
|
|
}
|
|
|
|
.selector-header h1 {
|
|
font-size: 24px;
|
|
margin-bottom: 5px;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.selector-header p {
|
|
font-size: 13px;
|
|
opacity: 0.9;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.close-button {
|
|
position: absolute;
|
|
top: 15px;
|
|
right: 15px;
|
|
background: rgba(255, 255, 255, 0.2);
|
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
color: white;
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 50%;
|
|
font-size: 18px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.close-button:hover {
|
|
background: rgba(255, 255, 255, 0.3);
|
|
border-color: rgba(255, 255, 255, 0.5);
|
|
}
|
|
|
|
/* Content Layout */
|
|
.selector-content {
|
|
display: flex;
|
|
flex: 1;
|
|
overflow: hidden;
|
|
min-height: 0;
|
|
min-width: 0;
|
|
}
|
|
|
|
/* Control Panel */
|
|
.control-panel {
|
|
width: 250px;
|
|
background-color: var(--panel-bg);
|
|
border-right: 1px solid var(--border-color);
|
|
overflow-y: auto;
|
|
padding: 15px;
|
|
}
|
|
|
|
.control-panel h3 {
|
|
font-size: 16px;
|
|
margin-bottom: 15px;
|
|
color: var(--text-color);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.control-panel h4 {
|
|
font-size: 13px;
|
|
margin-bottom: 10px;
|
|
color: var(--text-color);
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.control-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.control-group label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
margin-bottom: 8px;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.control-group small {
|
|
display: block;
|
|
font-size: 11px;
|
|
color: var(--text-light);
|
|
margin-top: 5px;
|
|
font-style: italic;
|
|
}
|
|
|
|
/* Input Range */
|
|
input[type="range"] {
|
|
width: 100%;
|
|
height: 6px;
|
|
border-radius: 3px;
|
|
background: var(--border-color);
|
|
outline: none;
|
|
-webkit-appearance: none;
|
|
appearance: none;
|
|
}
|
|
|
|
input[type="range"]::-webkit-slider-thumb {
|
|
-webkit-appearance: none;
|
|
appearance: none;
|
|
width: 16px;
|
|
height: 16px;
|
|
border-radius: 50%;
|
|
background: var(--primary-color);
|
|
cursor: pointer;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
input[type="range"]::-webkit-slider-thumb:hover {
|
|
transform: scale(1.2);
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
input[type="range"]::-moz-range-thumb {
|
|
width: 16px;
|
|
height: 16px;
|
|
border-radius: 50%;
|
|
background: var(--primary-color);
|
|
cursor: pointer;
|
|
border: none;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
/* Selettore aspect ratio */
|
|
.aspect-ratio-select {
|
|
width: 100%;
|
|
padding: 8px;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 6px;
|
|
font-size: 13px;
|
|
background-color: white;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.aspect-ratio-select:focus {
|
|
outline: 2px solid var(--primary-color);
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
#aspect-ratio-hint {
|
|
display: block;
|
|
margin-top: 5px;
|
|
font-size: 11px;
|
|
color: var(--text-light);
|
|
font-style: italic;
|
|
}
|
|
|
|
/* Buttons */
|
|
.btn {
|
|
padding: 8px 12px;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 6px;
|
|
font-size: 13px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.btn:hover:not(:disabled) {
|
|
transform: translateY(-1px);
|
|
box-shadow: var(--shadow);
|
|
}
|
|
|
|
.btn:active:not(:disabled) {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.btn-primary {
|
|
background-color: var(--primary-color);
|
|
color: white;
|
|
border-color: var(--primary-color);
|
|
width: 100%;
|
|
}
|
|
|
|
.btn-primary:hover:not(:disabled) {
|
|
background-color: #1d4ed8;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background-color: var(--secondary-color);
|
|
color: white;
|
|
border-color: var(--secondary-color);
|
|
width: 100%;
|
|
}
|
|
|
|
.btn-secondary:hover:not(:disabled) {
|
|
background-color: #475569;
|
|
}
|
|
|
|
.btn-warning {
|
|
background-color: var(--warning-color);
|
|
border-color: var(--warning-color);
|
|
color: white;
|
|
width: 100%;
|
|
}
|
|
|
|
.btn-warning:hover:not(:disabled) {
|
|
background-color: #c2410c;
|
|
border-color: #c2410c;
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { transform: scale(1); }
|
|
50% { transform: scale(1.05); }
|
|
}
|
|
|
|
.pulse-animation {
|
|
animation: pulse 2s ease-in-out infinite;
|
|
}
|
|
|
|
.info-box-warning {
|
|
background-color: #fff7ed;
|
|
border-color: #fed7aa;
|
|
}
|
|
|
|
.btn-success {
|
|
background-color: var(--success-color);
|
|
color: white;
|
|
border-color: var(--success-color);
|
|
width: 100%;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.btn-success:hover:not(:disabled) {
|
|
background-color: #15803d;
|
|
}
|
|
|
|
.btn-danger {
|
|
background-color: var(--danger-color);
|
|
color: white;
|
|
border-color: var(--danger-color);
|
|
width: 100%;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.btn-danger:hover:not(:disabled) {
|
|
background-color: #b91c1c;
|
|
}
|
|
|
|
.btn-small {
|
|
width: 100%;
|
|
padding: 6px 10px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.zoom-buttons {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.zoom-buttons .btn {
|
|
flex: 1;
|
|
}
|
|
|
|
/* Radio Group */
|
|
.radio-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
}
|
|
|
|
.radio-group label {
|
|
display: flex;
|
|
align-items: center;
|
|
font-weight: 400;
|
|
margin-bottom: 0;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.radio-group input[type="radio"] {
|
|
margin-right: 8px;
|
|
cursor: pointer;
|
|
width: 16px;
|
|
height: 16px;
|
|
accent-color: var(--primary-color);
|
|
}
|
|
|
|
/* Zoom Display */
|
|
.zoom-display {
|
|
background-color: #f1f5f9;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
text-align: center;
|
|
margin: 10px 0;
|
|
font-weight: 600;
|
|
color: var(--primary-color);
|
|
}
|
|
|
|
/* Info Boxes */
|
|
.info-box {
|
|
background-color: #f9fafb;
|
|
border: 1px solid var(--border-color);
|
|
padding: 8px;
|
|
border-radius: 6px;
|
|
font-family: 'Monaco', 'Courier New', monospace;
|
|
font-size: 11px;
|
|
color: var(--text-color);
|
|
line-height: 1.4;
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.info-box p {
|
|
margin: 0;
|
|
}
|
|
|
|
.info-box-secondary {
|
|
background-color: #eff6ff;
|
|
border-color: #bfdbfe;
|
|
}
|
|
|
|
/* Action Buttons */
|
|
.action-buttons {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
}
|
|
|
|
.action-buttons .btn {
|
|
padding: 8px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* HR */
|
|
hr {
|
|
border: none;
|
|
border-top: 1px solid var(--border-color);
|
|
margin: 15px 0;
|
|
}
|
|
|
|
/* Canvas Area */
|
|
.canvas-area {
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: linear-gradient(45deg, #f0f4f8 25%, transparent 25%, transparent 75%, #f0f4f8 75%, #f0f4f8),
|
|
linear-gradient(45deg, #f0f4f8 25%, transparent 25%, transparent 75%, #f0f4f8 75%, #f0f4f8);
|
|
background-size: 40px 40px;
|
|
background-position: 0 0, 20px 20px;
|
|
background-color: #fafbfc;
|
|
overflow: hidden;
|
|
position: relative;
|
|
padding: 20px;
|
|
min-height: 0;
|
|
min-width: 0;
|
|
}
|
|
|
|
#canvas-container {
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background-color: white;
|
|
overflow: hidden;
|
|
width: 100%;
|
|
height: 100%;
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
}
|
|
|
|
#background-image {
|
|
display: block;
|
|
width: auto;
|
|
height: auto;
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
object-fit: contain;
|
|
object-position: center;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
-webkit-user-drag: none;
|
|
}
|
|
|
|
/* Rectangle */
|
|
.rectangle {
|
|
position: absolute;
|
|
background-color: transparent;
|
|
cursor: move;
|
|
transform-origin: center center;
|
|
transition: none;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.rectangle.border-inside {
|
|
border: 3px solid #2563eb;
|
|
box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.3);
|
|
}
|
|
|
|
.rectangle.border-outside {
|
|
outline: 3px solid #2563eb;
|
|
outline-offset: -3px;
|
|
}
|
|
|
|
/* Resize Handles */
|
|
.resize-handle {
|
|
position: absolute;
|
|
width: 12px;
|
|
height: 12px;
|
|
background-color: #2563eb;
|
|
border: 2px solid white;
|
|
border-radius: 50%;
|
|
opacity: 0;
|
|
transition: opacity 0.2s ease;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.rectangle:hover .resize-handle,
|
|
.rectangle.resizing .resize-handle {
|
|
opacity: 1;
|
|
}
|
|
|
|
.rectangle:hover {
|
|
box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
|
|
}
|
|
|
|
/* Handle positions */
|
|
.resize-handle.top-left {
|
|
top: -6px;
|
|
left: -6px;
|
|
cursor: nwse-resize;
|
|
}
|
|
|
|
.resize-handle.top-right {
|
|
top: -6px;
|
|
right: -6px;
|
|
cursor: nesw-resize;
|
|
}
|
|
|
|
.resize-handle.bottom-left {
|
|
bottom: -6px;
|
|
left: -6px;
|
|
cursor: nesw-resize;
|
|
}
|
|
|
|
.resize-handle.bottom-right {
|
|
bottom: -6px;
|
|
right: -6px;
|
|
cursor: nwse-resize;
|
|
}
|
|
|
|
/* Scrollbar Styling */
|
|
.control-panel::-webkit-scrollbar {
|
|
width: 8px;
|
|
}
|
|
|
|
.control-panel::-webkit-scrollbar-track {
|
|
background: transparent;
|
|
}
|
|
|
|
.control-panel::-webkit-scrollbar-thumb {
|
|
background: var(--border-color);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.control-panel::-webkit-scrollbar-thumb:hover {
|
|
background: var(--secondary-color);
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 1024px) {
|
|
.control-panel {
|
|
width: 220px;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.selector-content {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.control-panel {
|
|
width: 100%;
|
|
border-right: none;
|
|
border-bottom: 1px solid var(--border-color);
|
|
max-height: 40vh;
|
|
}
|
|
|
|
.canvas-area {
|
|
flex: 1;
|
|
min-height: 60vh;
|
|
}
|
|
|
|
.control-panel h3 {
|
|
margin-top: 10px;
|
|
}
|
|
}
|
|
|
|
/* Accessibility */
|
|
.btn:focus,
|
|
input:focus,
|
|
textarea:focus {
|
|
outline: 2px solid var(--primary-color);
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
/* Utility */
|
|
.hidden {
|
|
display: none !important;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="selector-container">
|
|
<!-- Header -->
|
|
<div class="selector-header">
|
|
<h1>🎯 Region Selector</h1>
|
|
<p>Clicca e trascina sull'immagine per selezionare una regione</p>
|
|
<button id="close-btn" class="close-button" title="Chiudi editor">✕</button>
|
|
</div>
|
|
|
|
<!-- Main Content -->
|
|
<div class="selector-content">
|
|
<!-- Control Panel -->
|
|
<div class="control-panel">
|
|
<h3>Selezione</h3>
|
|
|
|
<!-- Selettore Aspect Ratio -->
|
|
<div class="control-group">
|
|
<label for="aspect-ratio-select">Aspect Ratio:</label>
|
|
<select id="aspect-ratio-select" class="aspect-ratio-select">
|
|
<option value="free" selected>Custom (Free)</option>
|
|
<option value="1:1">1:1 Square 1024x1024</option>
|
|
<option value="3:4">3:4 Portrait 896x1152</option>
|
|
<option value="5:8">5:8 Portrait 832x1216</option>
|
|
<option value="9:16">9:16 Portrait 768x1344</option>
|
|
<option value="9:21">9:21 Portrait 640x1536</option>
|
|
<option value="4:3">4:3 Landscape 1152x896</option>
|
|
<option value="3:2">3:2 Landscape 1216x832</option>
|
|
<option value="16:9">16:9 Landscape 1344x768</option>
|
|
<option value="21:9">21:9 Landscape 1536x640</option>
|
|
</select>
|
|
<small id="aspect-ratio-hint">Disegno libero - il ratio verrà calcolato</small>
|
|
</div>
|
|
|
|
<!-- Scale Info Box (nascosto di default) -->
|
|
<div id="scale-info" class="info-box info-box-secondary" style="display: none; margin-top: 10px;">
|
|
<!-- Popolato dinamicamente da JS -->
|
|
</div>
|
|
|
|
<!-- Auto-fix Suggestion (nascosto di default) -->
|
|
<div id="auto-fix-suggestion" class="info-box" style="display: none; margin-top: 10px; background-color: #fff7ed; border-color: #fed7aa;">
|
|
<!-- Popolato dinamicamente da JS -->
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<!-- Coordinates Info -->
|
|
<div id="coordinates-info">
|
|
<h4>Informazioni Selezione</h4>
|
|
<div id="base-coordinates" class="info-box">
|
|
<p>Clicca e trascina sull'immagine per selezionare una regione</p>
|
|
</div>
|
|
|
|
<div id="dimensions-info" style="display: none;">
|
|
<h4 style="margin-top: 15px;">Dimensioni Con Zoom</h4>
|
|
<div id="current-dimensions" class="info-box info-box-secondary">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<!-- Action Buttons -->
|
|
<div class="control-group action-buttons">
|
|
<button id="confirm-btn" class="btn btn-success" disabled>
|
|
✅ Conferma Selezione
|
|
</button>
|
|
<button id="cancel-btn" class="btn btn-danger">
|
|
❌ Annulla
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Canvas Area -->
|
|
<div class="canvas-area">
|
|
<div id="canvas-container">
|
|
<img src="https://picsum.photos/800/500" alt="Immagine di esempio" id="background-image">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="region_selector_core.js"></script>
|
|
</body>
|
|
</html>
|