File size: 6,925 Bytes
aceb1b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
/**
 * Image Annotation Styles
 *
 * Styling for the canvas-based image annotation interface.
 */

/* Container */
.image-annotation-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Toolbar */
.image-annotation-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.tool-group,
.label-group,
.zoom-group,
.edit-group,
.count-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tool-group-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-right: 5px;
}

/* Tool buttons */
.tool-btn,
.label-btn,
.zoom-btn,
.edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tool-btn:hover,
.label-btn:hover,
.zoom-btn:hover,
.edit-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.tool-btn.active,
.label-btn.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.tool-btn:focus,
.label-btn:focus,
.zoom-btn:focus,
.edit-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Label buttons with color indicator */
.label-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
}

.label-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    min-width: 12px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.label-btn.active .label-color-dot {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Zoom buttons */
.zoom-btn {
    min-width: 40px;
    padding: 6px 10px;
}

/* Edit buttons */
.edit-btn {
    padding: 6px 10px;
}

.edit-btn.delete-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.edit-btn.delete-btn:hover {
    background: #dc3545;
    color: #fff;
}

.edit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Annotation count */
.annotation-count {
    font-size: 13px;
    color: #6c757d;
    padding: 6px 12px;
    background: #e9ecef;
    border-radius: 4px;
}

.count-value {
    font-weight: 600;
    color: #495057;
}

/* Canvas wrapper */
.canvas-wrapper {
    position: relative;
    width: 100%;
    min-height: 400px;
    height: 500px;  /* Explicit height for Fabric.js canvas rendering */
    max-height: calc(100vh - 200px);
    background: #f8f9fa !important;  /* Force light background */
    border: 2px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

/* Ensure Fabric.js canvas container has light background */
.canvas-wrapper .canvas-container {
    background: #f8f9fa !important;
}

.annotation-canvas {
    display: block;
    width: 100%;
    cursor: crosshair;
}

/* Canvas checkered background for transparency */
.canvas-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    pointer-events: none;
    z-index: -1;
}

/* Hidden data input */
.annotation-data-input {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .image-annotation-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .tool-group,
    .label-group,
    .zoom-group,
    .edit-group {
        flex-wrap: wrap;
    }

    .tool-btn,
    .label-btn,
    .zoom-btn,
    .edit-btn {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* Dark mode support - only apply when explicitly enabled via class */
/* To enable dark mode, add class="dark-mode" to the container */
.image-annotation-container.dark-mode .image-annotation-toolbar {
    background: #2d3748;
    border-color: #4a5568;
}

.image-annotation-container.dark-mode .tool-group-label {
    color: #a0aec0;
}

.image-annotation-container.dark-mode .tool-btn,
.image-annotation-container.dark-mode .label-btn,
.image-annotation-container.dark-mode .zoom-btn,
.image-annotation-container.dark-mode .edit-btn {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.image-annotation-container.dark-mode .tool-btn:hover,
.image-annotation-container.dark-mode .label-btn:hover,
.image-annotation-container.dark-mode .zoom-btn:hover,
.image-annotation-container.dark-mode .edit-btn:hover {
    background: #718096;
    border-color: #a0aec0;
}

.image-annotation-container.dark-mode .canvas-wrapper {
    background: #1a202c;
    border-color: #4a5568;
}

.image-annotation-container.dark-mode .canvas-wrapper::before {
    background-image:
        linear-gradient(45deg, #2d3748 25%, transparent 25%),
        linear-gradient(-45deg, #2d3748 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #2d3748 75%),
        linear-gradient(-45deg, transparent 75%, #2d3748 75%);
}

.image-annotation-container.dark-mode .annotation-count {
    background: #4a5568;
    color: #a0aec0;
}

.image-annotation-container.dark-mode .count-value {
    color: #e2e8f0;
}

/* Form styling within image annotation */
.annotation-form.image-annotation fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.annotation-form.image-annotation legend {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    width: 100%;
}

/* Loading state */
.image-annotation-container.loading .canvas-wrapper::after {
    content: 'Loading image...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #6c757d;
}

/* Error state */
.image-annotation-container.error .canvas-wrapper::after {
    content: 'Failed to load image';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #dc3545;
}

/* Annotation highlight on hover */
.canvas-container canvas {
    outline: none;
}

/* Custom scrollbar for toolbar overflow */
.image-annotation-toolbar::-webkit-scrollbar {
    height: 6px;
}

.image-annotation-toolbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.image-annotation-toolbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.image-annotation-toolbar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}