File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
packages/vuetify/src/components/VCalendar/mixins Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -172,23 +172,25 @@ export default CalendarBase.extend({
172172
173173 const parentBounds = parent . getBoundingClientRect ( )
174174 const last = events . length - 1
175- let hide = false
175+ const eventsSorted = events . map ( event => ( {
176+ event,
177+ bottom : event . getBoundingClientRect ( ) . bottom ,
178+ } ) ) . sort ( ( a , b ) => a . bottom - b . bottom )
176179 let hidden = 0
177180
178181 for ( let i = 0 ; i <= last ; i ++ ) {
179- if ( ! hide ) {
180- const eventBounds = events [ i ] . getBoundingClientRect ( )
181- hide = i === last
182- ? ( eventBounds . bottom > parentBounds . bottom )
183- : ( eventBounds . bottom + eventHeight > parentBounds . bottom )
184- }
182+ const bottom = eventsSorted [ i ] . bottom
183+ const hide = i === last
184+ ? ( bottom > parentBounds . bottom )
185+ : ( bottom + eventHeight > parentBounds . bottom )
186+
185187 if ( hide ) {
186- events [ i ] . style . display = 'none'
188+ eventsSorted [ i ] . event . style . display = 'none'
187189 hidden ++
188190 }
189191 }
190192
191- if ( hide ) {
193+ if ( hidden ) {
192194 more . style . display = ''
193195 more . innerHTML = this . $vuetify . lang . t ( this . eventMoreText , hidden )
194196 } else {
You can’t perform that action at this time.
0 commit comments