fix(js): set onload before src to handle cached images
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user