Skip to content

Commit 78ccbd5

Browse files
authored
Merge pull request #640 from vizzuhq/keyframe_fix
Keyframe fix
2 parents bf4a2e1 + 3c07707 commit 78ccbd5

File tree

6 files changed

+109
-6
lines changed

6 files changed

+109
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [0.17.1] - 2025-08-24
6+
7+
### Fixed
8+
9+
- Fix Keyframe marker modifications on source chart.
10+
511
## [0.17.0] - 2025-07-31
612

713
### Fixed

src/chart/animator/keyframe.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ void Keyframe::prepareActual()
6161
{
6262
if (Gen::Plot::dimensionMatch(*source, *target)) {
6363
if (Gen::Plot::hasMarkerChange(*source, *target))
64-
copyTarget();
64+
copySourceTarget();
6565
Gen::Plot::mergeMarkersAndCellInfo(*source, *target);
6666
}
6767
else {
68-
copyTarget();
68+
copySourceTarget();
6969
target->prependMarkers(*source);
7070
source->appendMarkers(*targetCopy);
7171
}
@@ -80,7 +80,7 @@ void Keyframe::prepareActualMarkersInfo()
8080
{
8181
const auto &origTMI = target->getMarkersInfo();
8282
auto &smi = source->getMarkersInfo();
83-
if (!smi.empty()) copyTarget();
83+
if (!smi.empty()) copySourceTarget();
8484

8585
for (auto &tmi = target->getMarkersInfo(); auto &&item : smi)
8686
tmi.insert(std::pair{item.first, Gen::Plot::MarkerInfo{}});
@@ -89,14 +89,20 @@ void Keyframe::prepareActualMarkersInfo()
8989
smi.insert(std::pair{item.first, Gen::Plot::MarkerInfo{}});
9090
}
9191

92-
void Keyframe::copyTarget()
92+
void Keyframe::copySourceTarget()
9393
{
9494
if (!targetCopy) {
9595
targetCopy = target;
9696
target = std::make_shared<Gen::Plot>(*targetCopy);
9797
target->getStyle().setup();
9898
target->detachOptions();
9999
}
100+
if (!sourceCopy) {
101+
sourceCopy = source;
102+
source = std::make_shared<Gen::Plot>(*sourceCopy);
103+
source->getStyle().setup();
104+
source->detachOptions();
105+
}
100106
}
101107

102108
}

src/chart/animator/keyframe.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ class Keyframe : public Planner
2828
Gen::PlotPtr source;
2929
Gen::PlotPtr target;
3030
Gen::PlotPtr actual;
31+
Gen::PlotPtr sourceCopy;
3132
Gen::PlotPtr targetCopy;
3233

3334
void init(const Gen::PlotPtr &plot,
3435
const Data::DataTable &dataTable);
3536
void prepareActual();
3637
void prepareActualMarkersInfo();
37-
void copyTarget();
38+
void copySourceTarget();
3839
};
3940

4041
}

src/chart/main/version.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
#include "base/app/version.h"
44

5-
const App::Version Vizzu::Main::version(0, 17, 0);
5+
const App::Version Vizzu::Main::version(0, 17, 1);
66

77
const char *const Vizzu::Main::siteUrl = "https://vizzu.io/";

test/e2e/tests/fixes.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
},
7676
"55278793": {
7777
"refs": ["3932754"]
78+
},
79+
"keyframes": {
80+
"refs": ["cdb3779"]
7881
}
7982
}
8083
}

test/e2e/tests/fixes/keyframes.mjs

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import data from '../../test_data/music_data.mjs'
2+
3+
const testSteps = [
4+
(chart) => {
5+
chart.feature('tooltip', true)
6+
return chart.animate({ data })
7+
},
8+
(chart) =>
9+
chart.animate([
10+
{
11+
target: {
12+
data: {
13+
filter: (input) => input.Genres === 'Pop'
14+
},
15+
config: {
16+
channels: {
17+
x: {
18+
set: [{ name: 'Genres' }]
19+
},
20+
y: {
21+
set: [{ name: 'Popularity' }, { name: 'Kinds' }]
22+
},
23+
color: {
24+
set: [{ name: 'Kinds' }]
25+
},
26+
label: {
27+
set: [{ name: 'Popularity' }]
28+
}
29+
}
30+
}
31+
}
32+
},
33+
{
34+
target: {
35+
data: {
36+
filter: (input) => input.Genres === 'Pop'
37+
},
38+
config: {
39+
channels: {
40+
x: {
41+
set: [{ name: 'Genres' }]
42+
},
43+
y: {
44+
set: [{ name: 'Popularity' }]
45+
},
46+
color: {
47+
set: [{ name: 'Kinds' }]
48+
},
49+
label: {
50+
set: [{ name: 'Popularity' }]
51+
}
52+
},
53+
geometry: 'circle'
54+
}
55+
}
56+
},
57+
{
58+
target: {
59+
data: {
60+
filter: null
61+
},
62+
config: {
63+
channels: {
64+
x: {
65+
set: []
66+
},
67+
y: {
68+
set: [{ name: 'Popularity' }, { name: 'Kinds' }, { name: 'Genres' }]
69+
},
70+
color: {
71+
set: [{ name: 'Kinds' }]
72+
},
73+
lightness: {
74+
set: [{ name: 'Genres' }]
75+
},
76+
label: {
77+
set: [{ name: 'Genres' }, { name: 'Popularity' }]
78+
}
79+
},
80+
geometry: 'rectangle'
81+
}
82+
}
83+
}
84+
])
85+
]
86+
87+
export default testSteps

0 commit comments

Comments
 (0)