fix(js): set onload before src to handle cached images

This commit is contained in:
2026-07-09 13:07:23 +02:00
parent 63a16392d7
commit bcfb838b5e

View File

@@ -9,7 +9,6 @@ window.profileCropper = {
const img = container.querySelector('.cropper-image');
if (!circle || !img) return;
img.src = imageUrl;
img.onload = function () {
const cx = cropX != null ? parseFloat(cropX) : 50;
const cy = cropY != null ? parseFloat(cropY) : 50;
@@ -17,6 +16,10 @@ window.profileCropper = {
window.profileCropper._state.set(containerId, { cropX: cx, cropY: cy, dragging: false, startX: 0, startY: 0, startCX: cx, startCY: cy });
};
img.onerror = function () {
img.style.display = 'none';
};
img.src = imageUrl;
const onStart = function (clientX, clientY) {
const state = window.profileCropper._state.get(containerId);