深度画布调整
This commit is contained in:
@@ -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() || []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user