diff --git a/src/trackFeature.js b/src/trackFeature.js index df5fe6f8e3..6fd9d1d65b 100644 --- a/src/trackFeature.js +++ b/src/trackFeature.js @@ -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) diff --git a/tests/cases/trackFeature.js b/tests/cases/trackFeature.js index f264b90065..a4c336a478 100644 --- a/tests/cases/trackFeature.js +++ b/tests/cases/trackFeature.js @@ -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();