|
|
|
@ -435,7 +435,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
ngAfterViewInit(): void { |
|
|
|
|
// 监听canvas组件选中素材事件
|
|
|
|
|
this.canvas.on("select",obj=>{ |
|
|
|
|
console.log(obj.assetData) |
|
|
|
|
//选中素材属性注入函数
|
|
|
|
|
this.setAssetsProperty(obj.assetData) |
|
|
|
|
}) |
|
|
|
@ -942,13 +941,24 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
backGroundScale () { |
|
|
|
|
let that = this |
|
|
|
|
let dad = document.querySelector('.functionalDomainContent').clientWidth |
|
|
|
|
let dadHeight = document.querySelector('.functionalDomainContent').clientHeight |
|
|
|
|
let left = document.querySelector('.functionalDomainLeft').clientWidth |
|
|
|
|
let right = document.querySelector('.functionalDomainRight').clientWidth |
|
|
|
|
let imgWidth = dad - left - right//可是区域内 宽度
|
|
|
|
|
let img = new Image() |
|
|
|
|
img.src = this.selectingSitePlan.imageUrl;
|
|
|
|
|
img.onload = function(){ |
|
|
|
|
img.width > imgWidth? that.canvas.setBackgroundScale(imgWidth/img.width) : null |
|
|
|
|
if (img.height > dadHeight && img.width > imgWidth) { |
|
|
|
|
let number = (dadHeight/img.height + imgWidth/img.width) / 2 |
|
|
|
|
that.canvas.setBackgroundScale(number-0.015) |
|
|
|
|
return |
|
|
|
|
} else if (img.height > dadHeight) { |
|
|
|
|
that.canvas.setBackgroundScale((dadHeight/img.height)-0.01) |
|
|
|
|
return |
|
|
|
|
} else if (img.width > imgWidth) { |
|
|
|
|
that.canvas.setBackgroundScale((imgWidth/img.width)-0.01) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|