Browse Source

[完善] 根据背景图大小 缩放 完成

develop
陈鹏飞 4 years ago
parent
commit
cd13de9035
  1. 2
      src/app/ui/collection-tools/collection-tools.component.scss
  2. 12
      src/app/ui/collection-tools/collection-tools.component.ts

2
src/app/ui/collection-tools/collection-tools.component.scss

@ -98,7 +98,7 @@
}
.functionalDomainRight {
border: 1px solid #464646;
width: 12%;
width: 230px;
right: 0;
}
//左侧导航栏显示隐藏

12
src/app/ui/collection-tools/collection-tools.component.ts

@ -898,24 +898,22 @@ export class CollectionToolsComponent implements OnInit {
backGroundScale () {
let that = this
let dad = document.querySelector('.functionalDomainContent').clientWidth
let leftSon = document.querySelector('.functionalDomainLeft').clientWidth
let rightSon = document.querySelector('.functionalDomainRight').clientWidth
let imgWidth = dad - leftSon - rightSon //可是区域内 宽度
let imgWidth = dad - 460 //可是区域内 宽度
let img = new Image()
img.src = this.selectingSitePlan.imageUrl;
img.onload = function(){
// img.width > imgWidth? that.canvas.setBackgroundScale(img.width/imgWidth) : null
img.width > imgWidth? that.canvas.setBackgroundScale(imgWidth/img.width) : null
};
}
//封装 刷新 tree 数据
renovateTreeData (isRefresh:boolean = true) {
this.allFireElements[this.allFireElements.length-1].children = []
isRefresh? this.canvas.refresh() : null
isRefresh? this.canvasData.isChange = false : null //服务中 数据是否改动 改为false
isRefresh? this.isShowProperty = true : null
isRefresh? this.isShowAttribute = true : null
this.allFireElements[this.allFireElements.length-1].children = []
this.backGroundScale()
this.selectingSitePlan.imageUrl? this.backGroundScale() : null
let beforeOneId = this.selectingSitePlan.id || '' //当前 选中 平面图 楼层/区域 id
let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据
@ -1335,6 +1333,7 @@ export class CollectionToolsComponent implements OnInit {
let isSuccess = this.renovateSitePlan()
isSuccess.then(res=>{
this.canvas.refreshBackgroundImage()
this.backGroundScale()
})
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -1346,6 +1345,7 @@ export class CollectionToolsComponent implements OnInit {
let isSuccess = this.renovateBuilding()
isSuccess.then(res=>{
this.canvas.refreshBackgroundImage()
this.backGroundScale()
})
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';

Loading…
Cancel
Save