|
144 | 144 | if (type === 'item' && (_firstItemIndex === null || index <= _firstItemIndex)) { |
145 | 145 | _firstItemIndex = el ? index : null |
146 | 146 | measureToRef(el, firstItemWidth) |
147 | | - console.log(`[measure] RESERVED first item index=${index} width=${firstItemWidth.value}`) |
148 | 147 | return |
149 | 148 | } |
150 | 149 | if (type === 'divider' && (_firstDividerIndex === null || index <= _firstDividerIndex)) { |
151 | 150 | _firstDividerIndex = el ? index : null |
152 | 151 | measureToRef(el, firstDividerWidth) |
153 | | - console.log(`[measure] RESERVED first divider index=${index} width=${firstDividerWidth.value}`) |
154 | 152 | return |
155 | 153 | } |
156 | | - console.log(`[measure] POOL ${type} index=${index}`) |
157 | 154 | overflow.measure(index, el) |
158 | 155 | } |
159 | 156 |
|
|
183 | 180 | const eW = ellipsisWidth.value |
184 | 181 | const reserved = fI + gap + fD + gap + eW + gap |
185 | 182 |
|
186 | | - console.log( |
187 | | - `[watcher] containerWidth=${overflow.width.value} reserved=${reserved}`, |
188 | | - `available=${overflow.width.value - reserved}`, |
189 | | - `capacity=${capacity} measuredCount=${measuredCount} contentSize=${contentSize}`, |
190 | | - `\n firstItem=${fI} firstDivider=${fD} ellipsis=${eW}`, |
191 | | - ) |
192 | | -
|
193 | 183 | if (capacity === Infinity || capacity >= measuredCount) { |
194 | 184 | // Everything fits — show all content, hide ellipsis |
195 | 185 | for (const t of ellipsisTickets) group.unselect(t.id) |
|
222 | 212 |
|
223 | 213 | if (toShow > 0 && showStart > poolStart && contentTickets[showStart]!.type === 'item') { |
224 | 214 | const sep = showStart - 1 |
225 | | - if (sep >= poolStart && contentTickets[sep]!.type === 'divider') { |
226 | | - if (!contentTickets[sep]!.isSelected.value) group.select(contentTickets[sep]!.id) |
227 | | - console.log(`[separator] added divider at content[${sep}]`) |
228 | | - } |
| 215 | + if (sep >= poolStart && contentTickets[sep]!.type === 'divider' && !contentTickets[sep]!.isSelected.value) group.select(contentTickets[sep]!.id) |
229 | 216 | } |
230 | 217 |
|
231 | 218 | if (capacity === 0) { |
232 | 219 | if (lastIndex >= poolStart && !contentTickets[lastIndex]!.isSelected.value) group.select(contentTickets[lastIndex]!.id) |
233 | 220 |
|
234 | 221 | const w = overflow.width.value |
235 | 222 |
|
236 | | - console.log(`[deficit] capacity=0 containerWidth=${w} reserved=${reserved}`) |
237 | | -
|
238 | | - if (w < reserved + fD) { |
239 | | - console.log(`[deficit] dropping first divider`) |
240 | | - if (contentSize > 1) group.unselect(contentTickets[1]!.id) |
241 | | - } |
| 223 | + if (w < reserved + fD && contentSize > 1) group.unselect(contentTickets[1]!.id) |
242 | 224 | if (w < fI + gap + eW + gap) { |
243 | | - console.log(`[deficit] dropping ellipsis`) |
244 | 225 | for (const t of ellipsisTickets) group.unselect(t.id) |
245 | 226 | } |
246 | 227 | if (w < fI + gap) { |
247 | | - console.log(`[deficit] dropping first item`) |
248 | 228 | group.unselect(contentTickets[0]!.id) |
249 | 229 | } |
250 | 230 | } |
251 | | -
|
252 | | - const shown = contentTickets.filter(t => t.isSelected.value).map(t => t.type) |
253 | | - const ellipsisShown = ellipsisTickets.some(t => t.isSelected.value) |
254 | | - console.log(`[result] shown=[${shown.join(', ')}] ellipsis=${ellipsisShown}`) |
255 | 231 | }, |
256 | 232 | { immediate: true }, |
257 | 233 | ) |
|
0 commit comments