深度画布调整
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<div class="header" @click="show = !show">
|
<div class="header" @click="show = !show">
|
||||||
<span class="icon"><svg-icon name="dc-details_edit" size="17" /></span>
|
<span class="icon"><svg-icon name="dc-details_edit" size="17" /></span>
|
||||||
<span class="title">Edit Details</span>
|
<span class="title">Edit Details</span>
|
||||||
<span class="show">
|
<span class="arrow" :class="{ show }">
|
||||||
<svg-icon name="dc-down_arrow2" size="10" />
|
<svg-icon name="dc-down_arrow2" size="10" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
box-shadow: 0 1.66rem 2.33rem 0 rgba(0, 0, 0, 0.05);
|
box-shadow: 0 1.66rem 2.33rem 0 rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
> .header {
|
> .header {
|
||||||
|
flex-shrink: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 5rem;
|
height: 5rem;
|
||||||
@@ -64,10 +65,17 @@
|
|||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
> .arrow {
|
||||||
|
transition: transform 0.2s;
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
&.show {
|
||||||
|
transform: rotate(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
> .content {
|
> .content {
|
||||||
padding: 1.6rem;
|
padding: 1.6rem;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -15,9 +15,10 @@
|
|||||||
<brush-control-panel :currentTool="toolManager.currentTool.value" />
|
<brush-control-panel :currentTool="toolManager.currentTool.value" />
|
||||||
<zoom
|
<zoom
|
||||||
:zoom="canvasManager.currentZoom.value / 100"
|
:zoom="canvasManager.currentZoom.value / 100"
|
||||||
:step="0.1"
|
|
||||||
is-home
|
is-home
|
||||||
@home="() => canvasManager.resetZoom()"
|
@home="() => canvasManager.resetZoom()"
|
||||||
|
@add="() => canvasManager.zoomIn()"
|
||||||
|
@sub="() => canvasManager.zoomOut()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -426,6 +426,8 @@ export class BrushIndicator {
|
|||||||
this.canvas.on("mouse:over", this._mouseEnterHandler);
|
this.canvas.on("mouse:over", this._mouseEnterHandler);
|
||||||
this.canvas.on("mouse:out", this._mouseLeaveHandler);
|
this.canvas.on("mouse:out", this._mouseLeaveHandler);
|
||||||
this.canvas.on("mouse:move", this._mouseMoveHandler);
|
this.canvas.on("mouse:move", this._mouseMoveHandler);
|
||||||
|
|
||||||
|
this._observeCanvasChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -147,6 +147,35 @@ export class CanvasManager {
|
|||||||
resetZoom() {
|
resetZoom() {
|
||||||
this.animationManager.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() {
|
getObjects() {
|
||||||
return this.canvas.getObjects() || []
|
return this.canvas.getObjects() || []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -487,7 +487,8 @@ export class BrushManager {
|
|||||||
|
|
||||||
// 更新活动笔刷
|
// 更新活动笔刷
|
||||||
if (this.activeBrush) {
|
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