111
This commit is contained in:
@@ -29,17 +29,6 @@ fabric.Object.prototype.toObject = function () {
|
||||
return object
|
||||
}
|
||||
|
||||
fabric.Image.fromURL = (function (originalFromURL) {
|
||||
return function (url, callback, imgOptions) {
|
||||
// 为所有图片请求添加 crossOrigin
|
||||
const options = {
|
||||
crossOrigin: 'anonymous', // 关键设置
|
||||
...imgOptions
|
||||
};
|
||||
return originalFromURL.call(this, url, callback, options);
|
||||
};
|
||||
})(fabric.Image.fromURL);
|
||||
|
||||
interface CanvasInitOptions {
|
||||
canvasRef: any
|
||||
canvasViewWidth?: number
|
||||
@@ -317,6 +306,7 @@ export class CanvasManager {
|
||||
}
|
||||
if (object.src) {
|
||||
object.src = create(object.src)
|
||||
object.crossOrigin = 'anonymous'
|
||||
}
|
||||
if (object.fill?.source) {
|
||||
object.fill.source = create(object.fill.source)
|
||||
|
||||
@@ -156,10 +156,10 @@ export class LayerManager {
|
||||
const child = options?.child || []
|
||||
delete options.child
|
||||
const groupObject = new fabric.Group(child, {
|
||||
subTargetCheck: true, // 关键:检测子对象
|
||||
interactive: true, // 启用交互
|
||||
hasControls: true,
|
||||
hasBorders: true,
|
||||
// subTargetCheck: true, // 关键:检测子对象
|
||||
// interactive: true, // 启用交互
|
||||
// hasControls: true,
|
||||
// hasBorders: true,
|
||||
|
||||
// // 子对象样式
|
||||
// cornerColor: 'blue',
|
||||
@@ -368,7 +368,7 @@ export class LayerManager {
|
||||
}
|
||||
})
|
||||
resolve(img)
|
||||
})
|
||||
}, { crossOrigin: 'anonymous' })
|
||||
})
|
||||
// console.log(mergedImage)
|
||||
const index = this.canvasManager.getObjects().indexOf(targetLayer);
|
||||
|
||||
Reference in New Issue
Block a user