diff --git a/src/app/ui/collection-tools/collection-tools.component.html b/src/app/ui/collection-tools/collection-tools.component.html index 7a67b56..e84e780 100644 --- a/src/app/ui/collection-tools/collection-tools.component.html +++ b/src/app/ui/collection-tools/collection-tools.component.html @@ -22,6 +22,14 @@ 多选 + + + 适应缩放 + + + + 重置缩放 + tv create diff --git a/src/app/ui/collection-tools/collection-tools.component.scss b/src/app/ui/collection-tools/collection-tools.component.scss index 3ca4bcf..95aec14 100644 --- a/src/app/ui/collection-tools/collection-tools.component.scss +++ b/src/app/ui/collection-tools/collection-tools.component.scss @@ -25,6 +25,15 @@ align-items:center; min-height: 40px; background-color: #fff; + .zoom{ + display: flex; + align-items: center; + margin-left: 15px; + cursor: pointer; + img{ + margin-right: 3px; + } + } .nameShow{ cursor: pointer; user-select: none; diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index 12fef73..a88ea02 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -138,6 +138,14 @@ export class CollectionToolsComponent implements OnInit { this.isImgNumCss = false } } + //适应缩放 + adaptZoom(){ + this.canvas.zoomFit() + } + //重置缩放 + resetZoom(){ + this.canvas.resetCamera2D() + } //右侧div边框宽度调节 rightDivMouseDown(e){ document.onmousemove = (ev) => { diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 0f47f43..20dfa38 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -458,7 +458,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 重置相机 */ - private resetCamera2D() { + public resetCamera2D() { this.camera2D.scale.set(1); this.camera2D.x = (this.app.view.width - this.backgroundImage.width) / 2; this.camera2D.y = (this.app.view.height - this.backgroundImage.height) / 2; diff --git a/src/assets/images/适应缩放.png b/src/assets/images/适应缩放.png new file mode 100644 index 0000000..818de89 Binary files /dev/null and b/src/assets/images/适应缩放.png differ diff --git a/src/assets/images/重置缩放.png b/src/assets/images/重置缩放.png new file mode 100644 index 0000000..735886f Binary files /dev/null and b/src/assets/images/重置缩放.png differ