Browse Source

[修正] 修正背景图缩放问题

develop
陈鹏飞 4 years ago
parent
commit
fa89c3feaf
  1. 9
      src/app/ui/collection-tools/collection-tools.component.ts

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

@ -950,14 +950,15 @@ export class CollectionToolsComponent implements OnInit {
img.src = this.selectingSitePlan.imageUrl;
img.onload = function(){
if (img.height > dadHeight && img.width > imgWidth) {
let number = (dadHeight/img.height + imgWidth/img.width) / 2
that.canvas.setBackgroundScale(number-0.015)
let width = imgWidth/img.width
let height = dadHeight/img.height
that.canvas.setBackgroundScale((width>height? height : width)-0.005)
return
} else if (img.height > dadHeight) {
that.canvas.setBackgroundScale((dadHeight/img.height)-0.01)
that.canvas.setBackgroundScale((dadHeight/img.height)-0.005)
return
} else if (img.width > imgWidth) {
that.canvas.setBackgroundScale((imgWidth/img.width)-0.01)
that.canvas.setBackgroundScale((imgWidth/img.width)-0.005)
return
}
};

Loading…
Cancel
Save