Skip to content

Commit

Permalink
Merge pull request #1169 from OpenGeoscience/track-style-priority
Browse files Browse the repository at this point in the history
bug: Fix the priority of styles used for tracks.
  • Loading branch information
manthey authored Feb 1, 2022
2 parents 1a1602a + 7547ff0 commit cb770a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/trackFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ var trackFeature = function (arg) {
m_tracks.textFunc = m_this.style.get('text');
['past', 'current', 'future'].forEach(key => {
m_lineFeatures[key]
.style(m_this[key + 'Style']())
.style(m_this.style())
.style(m_this[key + 'Style']())
.line(m_this.style('track'))
.gcs(m_this.gcs())
.data(data)
Expand Down
7 changes: 7 additions & 0 deletions tests/cases/trackFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,18 @@ describe('geo.trackFeature', function () {
.track(function (d) { return d.t; })
.position(function (d, i, t, j) { return {x: testTracks[j].x[i], y: testTracks[j].y[i]}; })
.time(function (d, i, t, j) { return d; })
.style('strokeOpacity', 0.25)
.pastStyle('strokeOpacity', 0.8)
.currentStyle('strokeOpacity', 0.85)
.futureStyle('strokeOpacity', 0.9)
.style('text', function (d, i) { return i % 2 ? testTracks[i].id : undefined; });
track.draw();
expect(layer.children().length).toBe(6);
expect(layer.children()[4].features()[0] instanceof geo.webgl.markerFeature).toBe(true);
expect(layer.children()[5] instanceof geo.canvas.textFeature).toBe(true);
// check that specific style has priority over general style
expect(layer.children()[3] instanceof geo.canvas.lineFeature).toBe(true);
expect(layer.children()[3].style.get('strokeOpacity')(0, 0)).toBe(0.85);
layer.deleteFeature(track);
expect(layer.children().length).toBe(0);
destroyMap();
Expand Down

0 comments on commit cb770a5

Please sign in to comment.