@cyber-harbour/ui 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Graph2D/Graph2D.tsx +19 -2
package/package.json
CHANGED
package/src/Graph2D/Graph2D.tsx
CHANGED
|
@@ -241,7 +241,11 @@ export const Graph2D = ({
|
|
|
241
241
|
// Вибір іконки в залежності від стану наведення для верхньої кнопки (сховати)
|
|
242
242
|
const crossIcon = hoverTopButton ? imgCrossLightHoverIcon : imgCrossLightIcon;
|
|
243
243
|
const renderCrossIcon = () => {
|
|
244
|
-
|
|
244
|
+
try {
|
|
245
|
+
ctx.drawImage(crossIcon, x - iconSize / 2, y - (buttonRadius * 2) / 4 - iconSize - 1, iconSize, iconSize);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
console.log('Error rendering cross icon:', error);
|
|
248
|
+
}
|
|
245
249
|
};
|
|
246
250
|
// Використовуємо безпосередньо зображення, якщо воно вже завантажене
|
|
247
251
|
if (crossIcon.complete) {
|
|
@@ -252,22 +256,35 @@ export const Graph2D = ({
|
|
|
252
256
|
crossIcon.onload = () => {
|
|
253
257
|
renderCrossIcon();
|
|
254
258
|
};
|
|
259
|
+
|
|
260
|
+
crossIcon.onerror = () => {
|
|
261
|
+
console.log('Error loading cross icon image');
|
|
262
|
+
};
|
|
255
263
|
}
|
|
256
264
|
|
|
257
265
|
// Додаємо іконку ока для кнопки "згорнути дочірні вузли"
|
|
258
266
|
const eyeIcon = hoverBottomButton ? imgEyeLightHoverIcon : imgEyeLightIcon;
|
|
259
267
|
const renderEyeIcon = () => {
|
|
260
|
-
|
|
268
|
+
try {
|
|
269
|
+
ctx.drawImage(eyeIcon, x - iconSize / 2, y + (buttonRadius * 2) / 4 + 1, iconSize, iconSize);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.log('Error rendering eye icon:', error);
|
|
272
|
+
}
|
|
261
273
|
};
|
|
262
274
|
// Використовуємо безпосередньо зображення, якщо воно вже завантажене
|
|
263
275
|
if (eyeIcon.complete) {
|
|
264
276
|
// Розміщуємо іконку в центрі нижньої половини кнопки
|
|
277
|
+
|
|
265
278
|
renderEyeIcon();
|
|
266
279
|
} else {
|
|
267
280
|
// Якщо зображення ще не завантажене, додаємо обробник завершення завантаження
|
|
268
281
|
eyeIcon.onload = () => {
|
|
269
282
|
renderEyeIcon();
|
|
270
283
|
};
|
|
284
|
+
|
|
285
|
+
eyeIcon.onerror = () => {
|
|
286
|
+
console.log('Error loading eye icon image');
|
|
287
|
+
};
|
|
271
288
|
}
|
|
272
289
|
|
|
273
290
|
ctx.restore();
|