@@ -112,7 +112,6 @@ class InputSpinner extends Component {
112112 }
113113 this . setState ( { longStep : spinnerLongStep } ) ;
114114 }
115-
116115 }
117116
118117 /**
@@ -563,12 +562,21 @@ class InputSpinner extends Component {
563562
564563 /**
565564 * Increase
565+ * @param event
566+ * @param isLongPress
567+ * @returns {Promise<void> }
566568 */
567- async increase ( event ) {
569+ async increase ( event , isLongPress = false ) {
568570 if ( this . _isDisabledButtonRight ( ) ) return ;
569571 let currentValue = this . _parseNum ( this . state . value ) ;
570- let num = currentValue + this . _parseNum ( ( ! event && this . state . longStep > 0 ) ? this . state . longStep : this . state . step ) ;
571- if ( ! event && this . state . longStep > 0 ) {
572+ let num =
573+ currentValue +
574+ this . _parseNum (
575+ isLongPress && this . state . longStep > 0
576+ ? this . state . longStep
577+ : this . state . step ,
578+ ) ;
579+ if ( isLongPress && this . state . longStep > 0 ) {
572580 num = Math . round ( num / this . state . longStep ) * this . state . longStep ;
573581 }
574582 if ( this . isTypeDecimal ( ) ) {
@@ -601,18 +609,30 @@ class InputSpinner extends Component {
601609 this . onLongPress ( num ) ;
602610 }
603611
604- this . increaseTimer = setTimeout ( this . increase . bind ( this ) , wait ) ;
612+ this . increaseTimer = setTimeout (
613+ this . increase . bind ( this , event , true ) ,
614+ wait ,
615+ ) ;
605616 this . onChange ( num , true ) ;
606617 }
607618
608619 /**
609620 * Decrease
621+ * @param event
622+ * @param isLongPress
623+ * @returns {Promise<void> }
610624 */
611- async decrease ( event ) {
625+ async decrease ( event , isLongPress = false ) {
612626 if ( this . _isDisabledButtonLeft ( ) ) return ;
613627 let currentValue = this . _parseNum ( this . state . value ) ;
614- let num = currentValue - this . _parseNum ( ( ! event && this . state . longStep > 0 ) ? this . state . longStep : this . state . step ) ;
615- if ( ! event && this . state . longStep > 0 ) {
628+ let num =
629+ currentValue -
630+ this . _parseNum (
631+ isLongPress && this . state . longStep > 0
632+ ? this . state . longStep
633+ : this . state . step ,
634+ ) ;
635+ if ( isLongPress && this . state . longStep > 0 ) {
616636 num = Math . round ( num / this . state . longStep ) * this . state . longStep ;
617637 }
618638 if ( this . isTypeDecimal ( ) ) {
@@ -645,7 +665,10 @@ class InputSpinner extends Component {
645665 this . onLongPress ( num ) ;
646666 }
647667
648- this . decreaseTimer = setTimeout ( this . decrease . bind ( this ) , wait ) ;
668+ this . decreaseTimer = setTimeout (
669+ this . decrease . bind ( this , event , true ) ,
670+ wait ,
671+ ) ;
649672 this . onChange ( num , true ) ;
650673 }
651674
0 commit comments