深度画布调整
This commit is contained in:
@@ -426,6 +426,8 @@ export class BrushIndicator {
|
||||
this.canvas.on("mouse:over", this._mouseEnterHandler);
|
||||
this.canvas.on("mouse:out", this._mouseLeaveHandler);
|
||||
this.canvas.on("mouse:move", this._mouseMoveHandler);
|
||||
|
||||
this._observeCanvasChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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() || []
|
||||
}
|
||||
|
||||
@@ -487,7 +487,8 @@ export class BrushManager {
|
||||
|
||||
// 更新活动笔刷
|
||||
if (this.activeBrush) {
|
||||
this.activeBrush.configure(this.canvas.freeDrawingBrush, { color });
|
||||
const currentOpacity = this.brushStore.state.opacity;
|
||||
this.activeBrush.configure(this.canvas.freeDrawingBrush, { color, opacity: currentOpacity });
|
||||
}
|
||||
|
||||
// 更新笔刷指示器大小
|
||||
|
||||
Reference in New Issue
Block a user