File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ function createCalendar(element, contributionData) {
190
190
const monthFragment = document . createDocumentFragment ( ) ;
191
191
const tilesFragment = document . createDocumentFragment ( ) ;
192
192
193
+ let lastGridColumn = - 1 ;
194
+
193
195
const [ tiles , totalStatistical ] = data . reduce (
194
196
( [ tiles , stats ] , c , i ) => {
195
197
const date = new Date ( c . date ) ;
@@ -201,7 +203,11 @@ function createCalendar(element, contributionData) {
201
203
202
204
// 处理月份标签
203
205
if ( date . getDay ( ) === 0 && month !== latestMonth ) {
204
- const gridColumn = 2 + Math . floor ( ( i + startRow ) / 7 ) ;
206
+ let gridColumn = 2 + Math . floor ( ( i + startRow ) / 7 ) ;
207
+ if ( gridColumn - lastGridColumn <= 1 ) {
208
+ gridColumn += ( 2 - gridColumn + lastGridColumn ) ; // 防止重叠
209
+ }
210
+ lastGridColumn = gridColumn ;
205
211
latestMonth = month ;
206
212
const monthLabel = document . createElement ( "span" ) ;
207
213
monthLabel . className = "month" ;
You can’t perform that action at this time.
0 commit comments