深度画布调整

This commit is contained in:
lzp
2026-03-16 11:38:58 +08:00
parent 9cd8d82e9e
commit dec750ab48
5 changed files with 45 additions and 4 deletions

View File

@@ -147,6 +147,35 @@ export class CanvasManager {
resetZoom() {
this.animationManager.resetZoom()
}
// 使用动画管理器的缩放方法
animateZoom(point, targetZoom, options = {}) {
console.log(point, targetZoom, options)
this.animationManager.animateZoom(point, targetZoom, options);
}
zoomIn() {
const currentZoom = this.canvas.getZoom()
const newZoom = Math.min(currentZoom + 0.1, 20) // 增加20%最大20倍
// 使用画布中心作为缩放点
const centerPoint = {
x: this.canvas.width / 2,
y: this.canvas.height / 2
}
this.animateZoom(centerPoint, newZoom)
}
zoomOut() {
const currentZoom = this.canvas.getZoom()
const newZoom = Math.max(currentZoom - 0.1, 0.1) // 减少20%最小0.1倍
// 使用画布中心作为缩放点
const centerPoint = {
x: this.canvas.width / 2,
y: this.canvas.height / 2
}
this.animateZoom(centerPoint, newZoom)
}
getObjects() {
return this.canvas.getObjects() || []
}