Browse Source

[新增]新增适应缩放和重置缩放按钮

develop
邵佳豪 4 years ago
parent
commit
085d2e6baf
  1. 8
      src/app/ui/collection-tools/collection-tools.component.html
  2. 9
      src/app/ui/collection-tools/collection-tools.component.scss
  3. 8
      src/app/ui/collection-tools/collection-tools.component.ts
  4. 2
      src/app/working-area/working-area.component.ts
  5. BIN
      src/assets/images/适应缩放.png
  6. BIN
      src/assets/images/重置缩放.png

8
src/app/ui/collection-tools/collection-tools.component.html

@ -22,6 +22,14 @@
<span class="marginLeftRight">
<mat-checkbox color="primary" [(ngModel)]="isMultiSelect" (change)='changeMultiSelect($event)'></mat-checkbox> 多选
</span>
<span title="适应缩放" class="zoom" (click)="adaptZoom()">
<img src="/assets/images/适应缩放.png" alt="">
适应缩放
</span>
<span title="重置缩放" class="zoom" (click)="resetZoom()">
<img src="/assets/images/重置缩放.png" alt="">
重置缩放
</span>
<span style="position: absolute;right: 60px;cursor: pointer;">
<mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon>
<mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern">create</mat-icon>

9
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;

8
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) => {

2
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;

BIN
src/assets/images/适应缩放.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

BIN
src/assets/images/重置缩放.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Loading…
Cancel
Save