Skip to content

Commit 2cf5286

Browse files
authored
Merge pull request #124 from simzer/main
Fix: linking marker moving around
2 parents 0d407f8 + 3258ff7 commit 2cf5286

File tree

6 files changed

+82
-47
lines changed

6 files changed

+82
-47
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
- Fixed unintentional size change of circle markers during polar-cartesian
99
coordinate system change and animation from/to treemap.
1010
- Fixed line width animation when geometry is changing.
11+
- Removed unwanted move around of marker linking first and last data point in
12+
polar coordinates during animation.
1113

1214
## [0.5.1] - 2022-07-14
1315

src/base/geom/angle.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ double Angle::deg() const {
6363
return radToDeg(value);
6464
}
6565

66+
double Angle::turn() const {
67+
return value / (2.0 * M_PI);
68+
}
69+
6670
void Angle::sanitize()
6771
{
6872
auto angleInDeg = deg();

src/base/geom/angle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Angle
2020
static Angle Turn(double value);
2121
double deg() const;
2222
double rad() const { return value; }
23+
double turn() const;
2324

2425
explicit operator std::string() const;
2526

src/chart/rendering/items/areaitem.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,21 @@ AreaItem::AreaItem(const Diag::Marker &marker,
3535
if (prev)
3636
{
3737
auto prevSpacing = prev->spacing * prev->size / 2;
38-
auto prevPos = prev->position - prevSpacing;
38+
auto prevPos = prev->position;
39+
40+
if ((double)options.polar.get() > 0)
41+
{
42+
if ((double)options.horizontal.get() > 0.5)
43+
{
44+
if (prevPos.x >= 1) prevPos.x -= 1;
45+
}
46+
else
47+
{
48+
if (prevPos.y >= 1) prevPos.y -= 1;
49+
}
50+
}
51+
52+
prevPos = prevPos - prevSpacing;
3953

4054
points[3] = prevPos;
4155

src/chart/rendering/items/lineitem.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,21 @@ LineItem::LineItem(const Diag::Marker &marker,
4040
if (prev)
4141
{
4242
auto prevSpacing = prev->spacing * prev->size / 2;
43-
auto prevPos = prev->position - prevSpacing;
43+
auto prevPos = prev->position;
44+
45+
if ((double)options.polar.get() > 0)
46+
{
47+
if ((double)options.horizontal.get() > 0.5)
48+
{
49+
if (prevPos.x >= 1) prevPos.x -= 1;
50+
}
51+
else
52+
{
53+
if (prevPos.y >= 1) prevPos.y -= 1;
54+
}
55+
}
56+
57+
prevPos = prevPos - prevSpacing;
4458

4559
lineWidth[0] = std::max(maxWidth * prev->sizeFactor, minWidth);
4660

test/integration/test_cases/test_cases.json

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"basic_animations/coordsystems/area_carte_2_polar": {
3535
"refs": [
36-
"1fcd830"
36+
"25500f6"
3737
]
3838
},
3939
"basic_animations/coordsystems/circle_without_2_carte": {
@@ -63,7 +63,7 @@
6363
},
6464
"basic_animations/labels/marker/area_2dis_3con": {
6565
"refs": [
66-
"8d35d0b"
66+
"282d0cb"
6767
]
6868
},
6969
"basic_animations/labels/marker/circle_negative_2dis_3con": {
@@ -73,7 +73,7 @@
7373
},
7474
"basic_animations/labels/marker/line_2dis_3con": {
7575
"refs": [
76-
"2c4a581"
76+
"6b2a210"
7777
]
7878
},
7979
"basic_animations/labels/marker/rectangle_negative_2dis_3con": {
@@ -993,7 +993,7 @@
993993
},
994994
"ww_presets/polar_coo_sys/551_P_A_polar_stream_graph": {
995995
"refs": [
996-
"1e3dc8d"
996+
"7b4e71c"
997997
]
998998
},
999999
"ww_presets/polar_coo_sys/55_P_A_polar_overlay_area_chart": {
@@ -1053,12 +1053,12 @@
10531053
},
10541054
"ww_rules/descartes-polar/03_d-p_a-r-a": {
10551055
"refs": [
1056-
"c54314f"
1056+
"f92f419"
10571057
]
10581058
},
10591059
"ww_rules/descartes-polar/04_d-p_l-r-l": {
10601060
"refs": [
1061-
"ab52d14"
1061+
"4ab919a"
10621062
]
10631063
},
10641064
"ww_rules/descartes-polar/05_d-p_r-c-r": {
@@ -1083,42 +1083,42 @@
10831083
},
10841084
"ww_rules/descartes-polar/09_d-p_r-a-r": {
10851085
"refs": [
1086-
"284b9a8"
1086+
"f96363e"
10871087
]
10881088
},
10891089
"ww_rules/descartes-polar/10_d-p_c-a-c": {
10901090
"refs": [
1091-
"5215269"
1091+
"fe1973b"
10921092
]
10931093
},
10941094
"ww_rules/descartes-polar/11_d-p_a-a-a": {
10951095
"refs": [
1096-
"cc4ce3e"
1096+
"678ee43"
10971097
]
10981098
},
10991099
"ww_rules/descartes-polar/12_d-p_l-a-l": {
11001100
"refs": [
1101-
"e7518d0"
1101+
"be682b9"
11021102
]
11031103
},
11041104
"ww_rules/descartes-polar/13_d-p_r-l-r": {
11051105
"refs": [
1106-
"26f5af4"
1106+
"8b9b08e"
11071107
]
11081108
},
11091109
"ww_rules/descartes-polar/14_d-p_c-l-c": {
11101110
"refs": [
1111-
"7b82fe4"
1111+
"3a5281f"
11121112
]
11131113
},
11141114
"ww_rules/descartes-polar/15_d-p_a-l-a": {
11151115
"refs": [
1116-
"e7dd7cd"
1116+
"2557d46"
11171117
]
11181118
},
11191119
"ww_rules/descartes-polar/16_d-p_l-l-l": {
11201120
"refs": [
1121-
"2953846"
1121+
"f3be4cd"
11221122
]
11231123
},
11241124
"ww_rules/descartes-polar_orient/01_d-p_o_r-r-r": {
@@ -1133,12 +1133,12 @@
11331133
},
11341134
"ww_rules/descartes-polar_orient/03_d-p_o_a-r-a": {
11351135
"refs": [
1136-
"2281900"
1136+
"a81c631"
11371137
]
11381138
},
11391139
"ww_rules/descartes-polar_orient/04_d-p_o_l-r-l": {
11401140
"refs": [
1141-
"0f7b192"
1141+
"7a8f9a9"
11421142
]
11431143
},
11441144
"ww_rules/descartes-polar_orient/05_d-p_o_r-c-r": {
@@ -1153,7 +1153,7 @@
11531153
},
11541154
"ww_rules/descartes-polar_orient/07_d-p_o_a-c-a": {
11551155
"refs": [
1156-
"9bff8e5"
1156+
"7670c1f"
11571157
]
11581158
},
11591159
"ww_rules/descartes-polar_orient/08_d-p_o_l-c-l": {
@@ -1163,42 +1163,42 @@
11631163
},
11641164
"ww_rules/descartes-polar_orient/09_d-p_o_r-a-r": {
11651165
"refs": [
1166-
"2ce934f"
1166+
"8bac0db"
11671167
]
11681168
},
11691169
"ww_rules/descartes-polar_orient/10_d-p_o_c-a-c": {
11701170
"refs": [
1171-
"10cadba"
1171+
"442c5f9"
11721172
]
11731173
},
11741174
"ww_rules/descartes-polar_orient/11_d-p_o_a-a-a": {
11751175
"refs": [
1176-
"8972a77"
1176+
"49419b7"
11771177
]
11781178
},
11791179
"ww_rules/descartes-polar_orient/12_d-p_o_l-a-l": {
11801180
"refs": [
1181-
"a9a2d58"
1181+
"74d21d2"
11821182
]
11831183
},
11841184
"ww_rules/descartes-polar_orient/13_d-p_o_r-l-r": {
11851185
"refs": [
1186-
"6641564"
1186+
"ede622a"
11871187
]
11881188
},
11891189
"ww_rules/descartes-polar_orient/14_d-p_o_c-l-c": {
11901190
"refs": [
1191-
"7036784"
1191+
"b83c280"
11921192
]
11931193
},
11941194
"ww_rules/descartes-polar_orient/15_d-p_o_a-l-a": {
11951195
"refs": [
1196-
"8d56d7a"
1196+
"4ba73d5"
11971197
]
11981198
},
11991199
"ww_rules/descartes-polar_orient/16_d-p_o_l-l-l": {
12001200
"refs": [
1201-
"c2820b9"
1201+
"3b8b0ff"
12021202
]
12031203
},
12041204
"ww_rules/descartes/02_d-d_c-r-c": {
@@ -1328,17 +1328,17 @@
13281328
},
13291329
"ww_rules/polar/03_p-p_a-r-a": {
13301330
"refs": [
1331-
"aea2bfd"
1331+
"a57d9e5"
13321332
]
13331333
},
13341334
"ww_rules/polar/04_p-p_l-r-l": {
13351335
"refs": [
1336-
"4a02348"
1336+
"5922012"
13371337
]
13381338
},
13391339
"ww_rules/polar/07_p-p_a-c-a": {
13401340
"refs": [
1341-
"06693db"
1341+
"58832fc"
13421342
]
13431343
},
13441344
"ww_rules/polar/08_p-p_l-c-l": {
@@ -1383,7 +1383,7 @@
13831383
},
13841384
"ww_rules/polar_orientation/07_p-p_o_a-c-a": {
13851385
"refs": [
1386-
"c24c08b"
1386+
"01d5ea8"
13871387
]
13881388
},
13891389
"ww_rules/polar_orientation/08_p-p_o_l-c-l": {
@@ -1393,42 +1393,42 @@
13931393
},
13941394
"ww_rules/polar_orientation/09_p-p_o_r-a-r": {
13951395
"refs": [
1396-
"5ff01cf"
1396+
"f5da1af"
13971397
]
13981398
},
13991399
"ww_rules/polar_orientation/10_p-p_o_c-a-c": {
14001400
"refs": [
1401-
"418edf6"
1401+
"debb860"
14021402
]
14031403
},
14041404
"ww_rules/polar_orientation/11_p-p_o_a-a-a": {
14051405
"refs": [
1406-
"9218e5b"
1406+
"e0fb02f"
14071407
]
14081408
},
14091409
"ww_rules/polar_orientation/12_p-p_o_l-a-l": {
14101410
"refs": [
1411-
"7c91821"
1411+
"c27b128"
14121412
]
14131413
},
14141414
"ww_rules/polar_orientation/13_p-p_o_r-l-r": {
14151415
"refs": [
1416-
"713097e"
1416+
"79ed681"
14171417
]
14181418
},
14191419
"ww_rules/polar_orientation/14_p-p_o_c-l-c": {
14201420
"refs": [
1421-
"d67d6e6"
1421+
"d438650"
14221422
]
14231423
},
14241424
"ww_rules/polar_orientation/15_p-p_o_a-l-a": {
14251425
"refs": [
1426-
"a83027e"
1426+
"ce47516"
14271427
]
14281428
},
14291429
"ww_rules/polar_orientation/16_p-p_o_l-l-l": {
14301430
"refs": [
1431-
"7c4cf44"
1431+
"482fbd4"
14321432
]
14331433
},
14341434
"ww_rules/wNoFade cases/1 des_pol/area/03_are_C-n_D-s": {
@@ -1798,22 +1798,22 @@
17981798
},
17991799
"ww_rules/without-polar/09_w-p_r-a-r": {
18001800
"refs": [
1801-
"e8f36cf"
1801+
"5fc22e6"
18021802
]
18031803
},
18041804
"ww_rules/without-polar/10_w-p_c-a-c": {
18051805
"refs": [
1806-
"d96a3be"
1806+
"0083495"
18071807
]
18081808
},
18091809
"ww_rules/without-polar/13_w-p_r-l-r": {
18101810
"refs": [
1811-
"74feb0f"
1811+
"bea0be0"
18121812
]
18131813
},
18141814
"ww_rules/without-polar/14_w-p_c-l-c": {
18151815
"refs": [
1816-
"8cd1b8f"
1816+
"7c92f56"
18171817
]
18181818
},
18191819
"ww_rules/without-polar_orientation/01_w-p_o_r-r-r": {
@@ -1838,22 +1838,22 @@
18381838
},
18391839
"ww_rules/without-polar_orientation/09_w-p_o_r-a-r": {
18401840
"refs": [
1841-
"73ae4d9"
1841+
"0c15014"
18421842
]
18431843
},
18441844
"ww_rules/without-polar_orientation/10_w-p_o_c-a-c": {
18451845
"refs": [
1846-
"9e4fa33"
1846+
"099e3e7"
18471847
]
18481848
},
18491849
"ww_rules/without-polar_orientation/13_w-p_o_r-l-r": {
18501850
"refs": [
1851-
"39ea682"
1851+
"f3bbeba"
18521852
]
18531853
},
18541854
"ww_rules/without-polar_orientation/14_w-p_o_c-l-c": {
18551855
"refs": [
1856-
"39762eb"
1856+
"970371c"
18571857
]
18581858
},
18591859
"ww_rules/without/02_w-w_c-r-c": {

0 commit comments

Comments
 (0)