Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

下拉过半不会选种 #805

Open
milabi opened this issue Sep 27, 2021 · 0 comments
Open

下拉过半不会选种 #805

milabi opened this issue Sep 27, 2021 · 0 comments

Comments

@milabi
Copy link
Contributor

milabi commented Sep 27, 2021

pickerview下拉选择时,选项一半(50%)已经进入待选框,但不会选种,超过100%未到150%时会选种第二个。

if (this.differY <= -this.lineHeight / 2) {
this.currentY += Math.floor(this.differY / this.lineHeight);
if (this.currentY <= this.maxY) {
this.currentY = this.maxY;
}
} else if (this.differY >= this.lineHeight / 2) {
this.currentY += Math.floor(this.differY / this.lineHeight);
if (this.currentY >= 0) {
this.currentY = 0;
}
}

是否改成:

 if (this.differY <= -this.lineHeight / 2) { 
   this.currentY += Math.floor(this.differY / this.lineHeight + 0.5); 
   if (this.currentY <= this.maxY) { 
     this.currentY = this.maxY; 
   } 
 } else if (this.differY >= this.lineHeight / 2) { 
   this.currentY += Math.floor(this.differY / this.lineHeight + 0.5); 
   if (this.currentY >= 0) { 
     this.currentY = 0; 
   } 
 } 

会更合理呢?

milabi added a commit to milabi/ng-zorro-antd-mobile that referenced this issue Jun 9, 2022
pickerview下拉选择时,选项一半(50%)已经进入待选框,但不会选种,超过100%未到150%时会选种第二个。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant