627 lines
15 KiB
HTML
627 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;
|
|
}
|
|
|
|
/* Control Panel */
|
|
.control-panel {
|
|
width: 320px;
|
|
background-color: var(--panel-bg);
|
|
border-right: 1px solid var(--border-color);
|
|
overflow-y: auto;
|
|
padding: 20px;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
/* 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-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: 12px;
|
|
border-radius: 6px;
|
|
font-family: 'Monaco', 'Courier New', monospace;
|
|
font-size: 12px;
|
|
color: var(--text-color);
|
|
line-height: 1.5;
|
|
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: 10px;
|
|
font-size: 13px;
|
|
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;
|
|
}
|
|
|
|
#canvas-container {
|
|
position: relative;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background-color: white;
|
|
border-radius: 8px;
|
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
|
|
overflow: hidden;
|
|
max-width: 90%;
|
|
max-height: 90%;
|
|
}
|
|
|
|
#background-image {
|
|
display: block;
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
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: 280px;
|
|
}
|
|
}
|
|
|
|
@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>Controlli</h3>
|
|
|
|
<!-- Image Upload -->
|
|
<div class="control-group">
|
|
<label for="image-upload">Carica Immagine:</label>
|
|
<input type="file" id="image-upload" accept="image/*" style="display: none;">
|
|
<button id="upload-btn" class="btn btn-primary">
|
|
<span>📁</span> Scegli Immagine
|
|
</button>
|
|
<small id="image-name">Immagine corrente: picsum.photos</small>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<!-- Zoom Controls -->
|
|
<div class="control-group">
|
|
<label>Zoom Selezione:</label>
|
|
<div class="zoom-buttons">
|
|
<button id="zoom-out-btn" class="btn btn-small" disabled>🔍- Zoom Out</button>
|
|
<button id="zoom-in-btn" class="btn btn-small" disabled>🔍+ Zoom In</button>
|
|
</div>
|
|
<div class="zoom-display">
|
|
<span id="zoom-value">100%</span>
|
|
</div>
|
|
<small>Zoom del rettangolo selezionato</small>
|
|
</div>
|
|
|
|
<!-- Border Width -->
|
|
<div class="control-group">
|
|
<label for="border-slider">
|
|
Spessore Bordo: <span id="border-value">3px</span>
|
|
</label>
|
|
<input type="range" id="border-slider" min="1" max="20" value="3" step="1">
|
|
<small>Larghezza linea di selezione</small>
|
|
</div>
|
|
|
|
<!-- Border Position -->
|
|
<div class="control-group">
|
|
<label>Posizione Bordo:</label>
|
|
<div class="radio-group">
|
|
<label>
|
|
<input type="radio" name="border-position" value="inside" checked>
|
|
Interno
|
|
</label>
|
|
<label>
|
|
<input type="radio" name="border-position" value="outside">
|
|
Esterno
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<!-- Reset Button -->
|
|
<div class="control-group">
|
|
<button id="reset-btn" class="btn btn-secondary" disabled>
|
|
🔄 Cancella Selezione
|
|
</button>
|
|
</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="/extensions/image_region_select/region_selector_core.js"></script>
|
|
</body>
|
|
</html>
|