Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fabric.util.loadImage(object.src, function(img, error) {
// Substitute empty image in case of error
const image = new fabric.Image(
error ? new Image() : img,
object
)
image.crossOrigin = "anonymous"
// Pretend that we were successful in any case
callback(image)
})
}
beforeEach(() => {
mockImage = new fabric.Image();
graphics.setCanvasImage('mockImage', mockImage);
});
beforeEach(() => {
mockImage = new fabric.Image();
graphics.setCanvasImage('mockImage', mockImage);
fEvent = {
e: {}
};
});
beforeEach(() => {
mockImage = new fabric.Image();
graphics.setCanvasImage('mockImage', mockImage);
});
beforeEach(() => {
mockImage = new fabric.Image();
graphics.setCanvasImage('mockImage', mockImage);
});
beforeEach(() => {
graphics = new Graphics(document.createElement('canvas'));
invoker = new Invoker();
mockImage = new fabric.Image();
graphics.setCanvasImage('', mockImage);
canvas = graphics.getCanvas();
});
this.context.store,
this.context.id,
placeholderMatch[1]
).file.content
}
const img = await new Promise((resolve, reject) => {
const image = new Image()
image.addEventListener('load', () => resolve(image))
image.addEventListener('error', e => reject(e))
image.crossOrigin = "anonymous"
image.src = options.src
})
return new fabric.Image(img, {
...defaults,
...options,
})
case 'aoi':
return new fabric.Aoi({
width: 50, height: 50,
...defaults,
})
default:
return undefined
}
})()
img.onload = () => canvas.setBackgroundImage(new fabric.Image(img),
() => canvas.renderAll(), options);
img.src = dataUrl