File: controlFlowCaching.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (119 lines) | stat: -rw-r--r-- 6,370 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//// [controlFlowCaching.ts]
// Repro for #8401

function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {
    var isRtl = this._isRtl();  // chart mirroring
    // prepare variable
    var o = this.opt, ta = this.chart.theme.axis, position = o.position,
        leftBottom = position !== "rightOrTop", rotation = o.rotation % 360,
        start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign,
        labelGap = this.chart.theme.axis.tick.labelGap,
        taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font),
        taTitleFont = o.titleFont || (ta.title && ta.title.font),
        taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black",
        taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black",
        taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15,
        taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis",
        taMajorTick = this.chart.theme.getTick("major", o),
        taMinorTick = this.chart.theme.getTick("minor", o),
        taMicroTick = this.chart.theme.getTick("micro", o),

        taStroke = "stroke" in o ? o.stroke : ta.stroke,
        size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0,
        cosr = Math.abs(Math.cos(rotation * Math.PI / 180)),
        sinr = Math.abs(Math.sin(rotation * Math.PI / 180)),
        tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
    if (rotation < 0) {
        rotation += 360;
    }
    var cachedLabelW = this._getMaxLabelSize();
    cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;
    titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0,
        taMinorTick.length > 0 ? taMinorTick.length : 0) +
        tsize + taTitleGap;
    axisVector = { x: isRtl ? -1 : 1, y: 0 };     // chart mirroring
    switch (rotation) {
        default:
            if (rotation < (90 - centerAnchorLimit)) {
                labelOffset.y = leftBottom ? size : 0;
            } else if (rotation < (90 + centerAnchorLimit)) {
                labelOffset.x = -size * 0.4;
            } else if (rotation < 180) {
                labelOffset.y = leftBottom ? 0 : -size;
            } else if (rotation < (270 - centerAnchorLimit)) {
                labelOffset.y = leftBottom ? 0 : -size;
            } else if (rotation < (270 + centerAnchorLimit)) {
                labelOffset.y = leftBottom ? size * 0.4 : 0;
            } else {
                labelOffset.y = leftBottom ? size : 0;
            }
    }

    titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
    titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
    switch (labelAlign) {
        case "start":
            labelAlign = "end";
            break;
        case "end":
            labelAlign = "start";
            break;
        case "middle":
            labelOffset.y -= size;
            break;
    }

    let _ = rotation;
}


//// [controlFlowCaching.js]
// Repro for #8401
function f(dim, offsets, arr, acommon, centerAnchorLimit, g, has, lin) {
    var isRtl = this._isRtl(); // chart mirroring
    // prepare variable
    var o = this.opt, ta = this.chart.theme.axis, position = o.position, leftBottom = position !== "rightOrTop", rotation = o.rotation % 360, start, stop, titlePos, titleRotation = 0, titleOffset, axisVector, tickVector, anchorOffset, labelOffset, labelAlign, labelGap = this.chart.theme.axis.tick.labelGap, taFont = o.font || (ta.majorTick && ta.majorTick.font) || (ta.tick && ta.tick.font), taTitleFont = o.titleFont || (ta.title && ta.title.font), taFontColor = o.fontColor || (ta.majorTick && ta.majorTick.fontColor) || (ta.tick && ta.tick.fontColor) || "black", taTitleFontColor = o.titleFontColor || (ta.title && ta.title.fontColor) || "black", taTitleGap = (o.titleGap == 0) ? 0 : o.titleGap || (ta.title && ta.title.gap) || 15, taTitleOrientation = o.titleOrientation || (ta.title && ta.title.orientation) || "axis", taMajorTick = this.chart.theme.getTick("major", o), taMinorTick = this.chart.theme.getTick("minor", o), taMicroTick = this.chart.theme.getTick("micro", o), taStroke = "stroke" in o ? o.stroke : ta.stroke, size = taFont ? g.normalizedLength(g.splitFontString(taFont).size) : 0, cosr = Math.abs(Math.cos(rotation * Math.PI / 180)), sinr = Math.abs(Math.sin(rotation * Math.PI / 180)), tsize = taTitleFont ? g.normalizedLength(g.splitFontString(taTitleFont).size) : 0;
    if (rotation < 0) {
        rotation += 360;
    }
    var cachedLabelW = this._getMaxLabelSize();
    cachedLabelW = cachedLabelW && cachedLabelW.majLabelW;
    titleOffset = size * cosr + (cachedLabelW || 0) * sinr + labelGap + Math.max(taMajorTick.length > 0 ? taMajorTick.length : 0, taMinorTick.length > 0 ? taMinorTick.length : 0) +
        tsize + taTitleGap;
    axisVector = { x: isRtl ? -1 : 1, y: 0 }; // chart mirroring
    switch (rotation) {
        default:
            if (rotation < (90 - centerAnchorLimit)) {
                labelOffset.y = leftBottom ? size : 0;
            }
            else if (rotation < (90 + centerAnchorLimit)) {
                labelOffset.x = -size * 0.4;
            }
            else if (rotation < 180) {
                labelOffset.y = leftBottom ? 0 : -size;
            }
            else if (rotation < (270 - centerAnchorLimit)) {
                labelOffset.y = leftBottom ? 0 : -size;
            }
            else if (rotation < (270 + centerAnchorLimit)) {
                labelOffset.y = leftBottom ? size * 0.4 : 0;
            }
            else {
                labelOffset.y = leftBottom ? size : 0;
            }
    }
    titleRotation = (taTitleOrientation && taTitleOrientation == "away") ? 180 : 0;
    titlePos.y = offsets.t - titleOffset + (titleRotation ? 0 : tsize);
    switch (labelAlign) {
        case "start":
            labelAlign = "end";
            break;
        case "end":
            labelAlign = "start";
            break;
        case "middle":
            labelOffset.y -= size;
            break;
    }
    var _ = rotation;
}