all files / circular-gauge/utils/ helper-pointer-renderer.js

100% Statements 13/13
83.33% Branches 5/6
100% Functions 4/4
100% Lines 13/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21   1037×   347× 347× 347×   342×          
define(["require", "exports", "./helper-common"], function (require, exports, helper_common_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function linear(currentTime, startValue, endValue, duration) {
        return -endValue * Math.cos(currentTime / duration * (Math.PI / 2)) + endValue + startValue;
    }
    exports.linear = linear;
    function getCompleteArc(center, start, end, radius, innerRadius, checkMinValue) {
        end -= helper_common_1.isCompleteAngle(start, end) && !checkMinValue ? 0.0001 : 0;
        var degree = helper_common_1.getDegree(start, end);
        return getCompletePath(center, helper_common_1.getLocationFromAngle(start, radius, center), helper_common_1.getLocationFromAngle(end, radius, center), radius, helper_common_1.getLocationFromAngle(start, innerRadius, center), helper_common_1.getLocationFromAngle(end, innerRadius, center), innerRadius, (degree < 180) ? 0 : 1);
    }
    exports.getCompleteArc = getCompleteArc;
    function getCompletePath(center, start, end, radius, innerStart, innerEnd, innerRadius, clockWise) {
        return 'M ' + start.x + ' ' + start.y + ' A ' + radius + ' ' + radius + ' 0 ' + clockWise +
            ' 1 ' + end.x + ' ' + end.y + ' L ' + innerEnd.x + ' ' + innerEnd.y + ' A ' + innerRadius +
            ' ' + innerRadius + ' 0 ' + clockWise + ',0 ' + innerStart.x + ' ' + innerStart.y + ' Z';
    }
    exports.getCompletePath = getCompletePath;
});