Skip to content

Commit

Permalink
Added logic for logo scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayesh Patil authored and Jayesh Patil committed Sep 11, 2023
1 parent 9eb0459 commit e970458
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2303,9 +2303,16 @@ export class SVGDrawing {
calculateLogoDimensionsModuleApproach() {
let logoHeight , logoWidth , logoAreaWidth , logoAreaHeight;

let logoScale = this.config.logoScale ;
let logoMargin = this.config.logoMargin ;
let rectangular = this.config.rectangular ;

if (logoScale <= 0 || logoScale >= 1) {
logoScale = 0.2 ;
}
if( logoMargin < 0 || logoMargin > 100 ){
logoMargin = 50 ;
}
// Calibrating logo margin to avoid small logos
// ( This will ensure at least 50% area of logo is covered by the actual logo)
logoMargin = 0.5 * logoMargin
Expand Down Expand Up @@ -2364,8 +2371,8 @@ export class SVGDrawing {

}

logoAreaHeight = ( this.config.logoScale / maxLogoScale ) * logoAreaHeight ;
logoAreaWidth = ( this.config.logoScale / maxLogoScale ) * logoAreaWidth ;
logoAreaHeight = ( logoScale / maxLogoScale ) * logoAreaHeight ;
logoAreaWidth = ( logoScale / maxLogoScale ) * logoAreaWidth ;

this.calculatedLogoAreaHeight = logoAreaHeight ;
this.calculatedLogoAreaWidth = logoAreaWidth ;
Expand Down

0 comments on commit e970458

Please sign in to comment.