Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhus committed Apr 9, 2020
1 parent ccd2a74 commit e17c14a
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs-coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions gauge.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gauge.min.js.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ gulp.task('doc', gulp.series('clean:docs', done => {
*/
gulp.task('build', gulp.series(
'build:' + (yargs.argv.target || 'es5'),
done => done(),
));
done => done()));

/**
* Watch for source code changes and automatically re-build
Expand Down
31 changes: 23 additions & 8 deletions lib/RadialGauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,21 @@ const HPI = PI / 2;
/**
* Gauge configuration options
*
* @typedef {GenericOptions|{exactTicks: boolean, ticksAngle: number, startAngle: number, colorNeedleCircleOuter: string, colorNeedleCircleOuterEnd: string, colorNeedleCircleInner: string, colorNeedleCircleInnerEnd: string, needleCircleSize: number, needleCircleInner: boolean, needleCircleOuter: boolean, animationTarget: string, useMinPath: boolean}} RadialGaugeOptions
* @typedef {GenericOptions|{
* exactTicks: boolean,
* ticksAngle: number,
* startAngle: number,
* colorNeedleCircleOuter: string,
* colorNeedleCircleOuterEnd: string,
* colorNeedleCircleInner: string,
* colorNeedleCircleInnerEnd: string,
* needleCircleSize: number,
* needleCircleInner: boolean,
* needleCircleOuter: boolean,
* animationTarget: string,
* useMinPath: boolean,
* barStartPosition: 'right' | 'left',
* }} RadialGaugeOptions
*/

/**
Expand Down Expand Up @@ -478,11 +492,13 @@ function drawRadialNeedle(context, options) {

let value = options.ticksAngle < 360 ?
drawings.normalizedValue(options).indented : options.value;
let startAngle = isFixed ? options.startAngle :
(options.startAngle + (value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle);
let startAngle = isFixed ? options.startAngle :
(options.startAngle + (value - options.minValue) /
(options.maxValue - options.minValue) * options.ticksAngle);
if (options.barStartPosition === 'right') {
startAngle = options.startAngle + options.ticksAngle -
(value - options.minValue) / (options.maxValue - options.minValue) * options.ticksAngle;
startAngle = options.startAngle + options.ticksAngle -
(value - options.minValue) / (options.maxValue - options.minValue) *
options.ticksAngle;
}
let max = maxRadialRadius(context, options);
//noinspection JSUnresolvedFunction
Expand All @@ -498,7 +514,6 @@ function drawRadialNeedle(context, options) {
let pad1 = max / 100 * options.needleWidth;
let pad2 = max / 100 * options.needleWidth / 2;
let pixelRatio = SmartCanvas.pixelRatio;
let isFixed = options.animationTarget !== 'needle';

context.save();

Expand Down Expand Up @@ -639,8 +654,8 @@ function computeAngles(options) {
function drawRadialProgressBar(context, options) {
let unit = context.max / 100;
let rMax = maxRadialRadius(context, options) - 5 * unit;
let sw = (parseFloat(options.barStrokeWidth) || 0);
let w = (parseFloat(options.barWidth) || 0) * unit;
let sw = (parseFloat(options.barStrokeWidth + '') || 0);
let w = (parseFloat(options.barWidth + '') || 0) * unit;
let rMin = rMax - sw * 2 - w;
let half = (rMax- rMin) / 2;
let r = rMin + half;
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"example": "examples"
},
"scripts": {
"test": "./node_modules/.bin/gulp test --silent",
"test": "gulp test --silent",
"test:headless": "xvfb-run npm test --silent",
"start": "./node_modules/.bin/gulp watch",
"build": "./node_modules/.bin/gulp build --silent",
"doc": "npm run toc && ./node_modules/.bin/gulp doc --silent",
"commit": "npm run build && npm run doc && npm test && ./node_modules/.bin/gulp build:prod && git add --all . && git commit",
"toc": "./node_modules/.bin/markdown-toc -i README.md",
"build:all": "npm run build && npm run doc && npm run test:headless && ./node_modules/.bin/gulp build:prod"
"start": "gulp watch",
"build": "gulp build --silent",
"doc": "npm run toc && gulp doc --silent",
"commit": "npm run build && npm run doc && npm test && gulp build:prod && git add --all . && git commit",
"toc": "markdown-toc -i README.md",
"build:all": "npm run build && npm run doc && npm run test:headless && gulp build:prod"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion test-coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e17c14a

Please sign in to comment.