Make monthsWide and monthsHigh global variables
This commit is contained in:
		
							parent
							
								
									9dd937ad68
								
							
						
					
					
						commit
						394c8f9b9d
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								Main.go
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								Main.go
									
										
									
									
									
								
							|  | @ -34,6 +34,10 @@ var ( | |||
| 	defStyle   tcell.Style | ||||
| 	todayStyle tcell.Style | ||||
| 	selStyle   tcell.Style | ||||
| 
 | ||||
| 	monthsWide  int | ||||
| 	monthsHigh  int | ||||
| 	monthsDrawn int | ||||
| ) | ||||
| 
 | ||||
| var ( | ||||
|  | @ -125,9 +129,9 @@ func drawWall() { | |||
| 		wrappedText("Екран је премали за календар.", wall, defStyle) | ||||
| 		return | ||||
| 	} | ||||
| 	monthsWide := (w - 2*smallGap + largeGap) / (maxMonthWidth + largeGap) | ||||
| 	monthsHigh := (h - smallGap - titleHeight) / (maxMonthHeight + smallGap) | ||||
| 	monthsDrawn := min(monthsHigh*monthsWide, 12) // TODO: izraziti 12 drugacije?? | ||||
| 	monthsWide = (w - 2*smallGap + largeGap) / (maxMonthWidth + largeGap) | ||||
| 	monthsHigh = (h - smallGap - titleHeight) / (maxMonthHeight + smallGap) | ||||
| 	monthsDrawn = min(monthsHigh*monthsWide, 12) | ||||
| 
 | ||||
| 	startingMonth := time.Month((int(selTime.Month())-1)/monthsDrawn*monthsDrawn + 1) | ||||
| 	endingMonth := time.Month(min(12, int(startingMonth)+monthsDrawn-1)) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Petar Kapriš
						Petar Kapriš