MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / setContentGap

Method setContentGap

code/main/RenderLocation.ts:19–34  ·  view source on GitHub ↗
(gap: number)

Source from the content-addressed store, hash-verified

17 }
18
19 public setContentGap(gap: number): void{
20 var ex: number, outerWidth: number, addGap: number = 0;
21
22 // Get our outer width
23 outerWidth = $(this.locationString).outerWidth();
24
25 // Get the real ex value
26 ex = this.getRealExValueFromTheStatusBar();
27
28 // If our outerWidth is bigger than the window, calc an additional gap
29 if(outerWidth > $(window).width())
30 addGap = -(outerWidth-$(window).width())/2;
31
32 // Finally change the "left" value of our div
33 $(this.locationString).css({"left" : ((gap/2)*ex+addGap).toString() + "px"});
34 }
35
36 // Public setters
37 public setLocationString(locationString: string): void{

Callers 1

displayAreaMethod · 0.80

Calls 5

$Function · 0.85
outerWidthMethod · 0.80
widthMethod · 0.80
cssMethod · 0.65

Tested by

no test coverage detected