@@ -3,7 +3,12 @@ import { QColorizeMixin } from 'q-colorize-mixin'
33
44// Utils
55import props from '../utils/props'
6- import { debounce , QBtn , QResizeObserver , scroll } from 'quasar'
6+ import {
7+ debounce ,
8+ QBtn ,
9+ QResizeObserver ,
10+ scroll
11+ } from 'quasar'
712
813// tree shake other scroll functions
914const { getScrollPosition, setScrollPosition, getScrollTarget } = scroll
@@ -226,24 +231,29 @@ export default {
226231
227232 getItemIndexFromEvent ( event ) {
228233 const top = event . target . scrollTop
229- return Math . floor ( top / this . itemHeight )
234+ return Math . round ( top / this . itemHeight )
230235 } ,
231236
232237 scrollEvent : debounce ( function ( event ) {
238+ if ( this . $q . platform . is . desktop ) {
239+ return
240+ }
233241 if ( this . disable !== true ) {
234242 const index = this . getItemIndexFromEvent ( event )
235243 if ( index > - 1 && index < this . items . length ) {
236244 const item = this . items [ index ]
237245 if ( this . disable !== true && item . disabled !== true ) {
238- this . $emit ( 'input' , this . value )
246+ if ( item . value !== this . value ) {
247+ this . $emit ( 'input' , item . value )
248+ }
239249 }
240250 event . preventDefault ( )
241251 } else {
242252 /* eslint-disable-next-line */
243253 console . error ( `QScroller: index (${ index } ) is out of bounds (${ this . items . length } )` )
244254 }
245255 }
246- } , 500 ) ,
256+ } , 250 ) ,
247257
248258 clickEvent ( item ) {
249259 if ( this . disable !== true && item . disabled !== true ) {
@@ -329,8 +339,7 @@ export default {
329339 return h ( 'div' , this . setBothColors ( this . textColor , void 0 , {
330340 staticClass : 'q-scroller__body' ,
331341 on : {
332- mousewheel : ( event ) => this . wheelEvent ( event ) ,
333- scroll : ( event ) => this . scrollEvent ( event )
342+ wheel : ( event ) => this . wheelEvent ( event )
334343 }
335344 } ) , [
336345 this . __renderPadding ( h ) ,
@@ -354,7 +363,8 @@ export default {
354363 'q-scroller__overflow-hidden' : this . $q . platform . is . mobile !== true
355364 } ,
356365 on : {
357- ...this . $listeners
366+ ...this . $listeners ,
367+ scroll : ( event ) => this . scrollEvent ( event )
358368 }
359369 } , resize . concat ( [
360370 this . __renderContents ( h )
0 commit comments