Skip to content

Commit

Permalink
Merge pull request #17 from lucaszhu2zgf/clip
Browse files Browse the repository at this point in the history
修复由于计算误差导致进度点没有显示完整的问题
lucaszhu2zgf authored Jun 7, 2020
2 parents b067c5c + 94d3a70 commit 97ed579
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions dist/progress.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! mp-progress.js v1.2.7 https://www.npmjs.com/package/mp-progress */
/*! mp-progress.js v1.2.8 https://www.npmjs.com/package/mp-progress */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
@@ -273,12 +273,12 @@ var MpProgress = /*#__PURE__*/function () {
if (this._options.dotStyle.length > 0) {
var circleR = this._options.dotStyle[0].r;

if (circleR > maxBarWidth) {
var diff = circleR - maxBarWidth + (this._options.dotStyle[0].shadow ? circleR / 2 : 0);
_r -= diff;
if (circleR * 2 > maxBarWidth) {
var shadowDiff = this._options.dotStyle[0].shadow ? circleR / 4 : 0;
_r -= circleR - maxBarWidth + shadowDiff;

if (this._percent !== 100) {
originY -= diff;
originY -= circleR + shadowDiff;
}
}
} else {
4 changes: 2 additions & 2 deletions dist/progress.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mp-progress",
"version": "1.2.7",
"version": "1.2.8",
"description": "circle progress for wechat miniprogram",
"main": "dist/progress.min.js",
"scripts": {
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -135,11 +135,11 @@ class MpProgress {
// 考虑剔除进度点的宽度差以及进度点阴影的宽度查
if (this._options.dotStyle.length > 0) {
const circleR = this._options.dotStyle[0].r;
if (circleR > maxBarWidth) {
const diff = circleR - maxBarWidth + (this._options.dotStyle[0].shadow ? circleR / 2 : 0);
_r -= diff;
if (circleR*2 > maxBarWidth) {
const shadowDiff = this._options.dotStyle[0].shadow ? circleR / 4 : 0;
_r -= circleR - maxBarWidth + shadowDiff;
if (this._percent !== 100) {
originY -= diff;
originY -= circleR + shadowDiff;
}
}
} else {

0 comments on commit 97ed579

Please sign in to comment.