深度画布缩略图
This commit is contained in:
@@ -11,6 +11,7 @@ export async function cloneObjects(objects = []) {
|
||||
height: obj.height,
|
||||
scaleX: obj.scaleX,
|
||||
scaleY: obj.scaleY,
|
||||
angle: obj.angle,
|
||||
})
|
||||
resolve(v)
|
||||
})
|
||||
@@ -26,10 +27,11 @@ export async function getObjectsBoundingBox(objects = []) {
|
||||
const box1 = { x: Infinity, y: Infinity }
|
||||
const box2 = { x: -Infinity, y: -Infinity }
|
||||
objects.forEach(obj => {
|
||||
box1.x = Math.min(box1.x, obj.left)
|
||||
box1.y = Math.min(box1.y, obj.top)
|
||||
box2.x = Math.max(box2.x, obj.left + obj.width * obj.scaleX)
|
||||
box2.y = Math.max(box2.y, obj.top + obj.height * obj.scaleY)
|
||||
const rect = obj.getBoundingRect()
|
||||
box1.x = Math.min(box1.x, rect.left)
|
||||
box1.y = Math.min(box1.y, rect.top)
|
||||
box2.x = Math.max(box2.x, rect.left + rect.width)
|
||||
box2.y = Math.max(box2.y, rect.top + rect.height)
|
||||
})
|
||||
return {
|
||||
left: box1.x,
|
||||
|
||||
Reference in New Issue
Block a user