深度画布
This commit is contained in:
@@ -151,6 +151,37 @@ export class LayerManager {
|
||||
if (isActive) this.setActiveID(emptyObject.info.id, false)
|
||||
return emptyObject
|
||||
}
|
||||
/** 创建组图层 */
|
||||
createGroupLayer(options?: any, isRecord = true, isActive = false) {
|
||||
const child = options?.child || []
|
||||
delete options.child
|
||||
const groupObject = new fabric.Group(child, {
|
||||
subTargetCheck: true, // 关键:检测子对象
|
||||
interactive: true, // 启用交互
|
||||
hasControls: true,
|
||||
hasBorders: true,
|
||||
|
||||
// // 子对象样式
|
||||
// cornerColor: 'blue',
|
||||
// cornerSize: 8,
|
||||
// borderColor: 'green',
|
||||
|
||||
// // 允许子对象独立变换
|
||||
// lockScalingX: false,
|
||||
// lockScalingY: false,
|
||||
// lockRotation: false,
|
||||
info: {
|
||||
id: createId("group"),
|
||||
name: '组图层',
|
||||
...(options?.info || {}),
|
||||
}
|
||||
})
|
||||
// this.setLayerPosition(groupObject)
|
||||
this.canvasManager.add(groupObject, isRecord)
|
||||
if (isActive) this.setActiveID(groupObject.info.id, false)
|
||||
return groupObject
|
||||
}
|
||||
|
||||
/** 创建文本图层 */
|
||||
async createTextLayer(text: string, options?: any) {
|
||||
const textObject = new fabric.IText(text, {
|
||||
|
||||
Reference in New Issue
Block a user