diff --git a/lib/display/canvas-display.js b/lib/display/canvas-display.js index e9f2eec..d8f7d0c 100644 --- a/lib/display/canvas-display.js +++ b/lib/display/canvas-display.js @@ -93,6 +93,10 @@ export default class CanvasDisplay extends Display { // Apply linecap style this.ctx.lineCap = attrs['stroke-linecap'] || 'butt' + // Apply 'round' line join for smooth edge rendering. + // (The default join is 'miter', which causes jagged edges when zoomed away.) + this.ctx.lineJoin = 'round' + // Draw the path this.ctx.beginPath() this.ctx.moveTo(renderData[0].x, renderData[0].y) diff --git a/stories/Transitive.stories.js b/stories/Transitive.stories.js index eb37dd8..62a9a9c 100644 --- a/stories/Transitive.stories.js +++ b/stories/Transitive.stories.js @@ -28,7 +28,7 @@ Itinerary.args = { export const Itinerary2 = Template.bind({}) Itinerary2.args = { - center: [28.535358, -81.378984], + center: [28.5459257, -81.3467216], companies, itinerary: require('./data/fdot-itin.json'), styles: { diff --git a/stories/data/fdot-itin.json b/stories/data/fdot-itin.json new file mode 100644 index 0000000..f608b80 --- /dev/null +++ b/stories/data/fdot-itin.json @@ -0,0 +1,408 @@ +{ + "duration": 458, + "startTime": 1615418484000, + "endTime": 1615418942000, + "walkTime": 302, + "transitTime": 154, + "waitingTime": 2, + "walkDistance": 376.3225671607773, + "walkLimitExceeded": false, + "elevationLost": 0.1700000000000017, + "elevationGained": 0.18999999999999773, + "transfers": 0, + "fare": { + "fare": { + "regular": { + "currency": { + "symbol": "$", + "currency": "USD", + "defaultFractionDigits": 2, + "currencyCode": "USD" + }, + "cents": 150 + } + }, + "details": { + "regular": [ + { + "fareId": "1:411_1363", + "price": { + "currency": { + "symbol": "$", + "currency": "USD", + "defaultFractionDigits": 2, + "currencyCode": "USD" + }, + "cents": 150 + }, + "routes": [ + "1:CFRTA_11792" + ] + } + ] + } + }, + "legs": [ + { + "startTime": 1615418484000, + "endTime": 1615418613000, + "departureDelay": 0, + "arrivalDelay": 0, + "realTime": false, + "distance": 158.323, + "pathway": false, + "mode": "WALK", + "route": "", + "agencyTimeZoneOffset": -18000000, + "interlineWithPreviousLeg": false, + "from": { + "name": "315 North Hampton Avenue, Orlando, FL, USA", + "lon": -81.35650634765626, + "lat": 28.546378102018082, + "departure": 1615418484000, + "orig": "315 North Hampton Avenue, Orlando, FL, USA", + "vertexType": "NORMAL" + }, + "to": { + "name": "E ROBINSON STREET AND N HAMPTON AVENUE", + "stopId": "1:CFRTA_3980", + "lon": -81.355694, + "lat": 28.545823, + "arrival": 1615418613000, + "departure": 1615418614000, + "stopIndex": 10, + "stopSequence": 11, + "vertexType": "TRANSIT", + "boardAlightType": "DEFAULT" + }, + "legGeometry": { + "points": "gofmDd}poN?sAx@?h@Ah@??kA", + "length": 6 + }, + "rentedBike": false, + "rentedCar": false, + "rentedVehicle": false, + "hailedCar": false, + "flexDrtAdvanceBookMin": 0, + "transitLeg": false, + "duration": 129, + "intermediateStops": [], + "steps": [ + { + "distance": 41.47, + "relativeDirection": "DEPART", + "streetName": "service road", + "absoluteDirection": "EAST", + "stayOn": false, + "area": false, + "bogusName": true, + "lon": -81.35650845766538, + "lat": 28.546606675807073, + "elevation": [ + { + "first": 0, + "second": 31.39 + }, + { + "first": 10, + "second": 31.41 + }, + { + "first": 20, + "second": 31.44 + }, + { + "first": 30, + "second": 31.49 + }, + { + "first": 40, + "second": 31.56 + }, + { + "first": 41.47, + "second": 31.57 + } + ] + }, + { + "distance": 79.765, + "relativeDirection": "RIGHT", + "streetName": "Hampton Avenue", + "absoluteDirection": "SOUTH", + "stayOn": false, + "area": false, + "bogusName": false, + "lon": -81.3560839, + "lat": 28.5466097, + "elevation": [ + { + "first": 0, + "second": 31.79 + }, + { + "first": 10, + "second": 31.74 + }, + { + "first": 20, + "second": 31.7 + }, + { + "first": 33.14, + "second": 31.65 + } + ] + }, + { + "distance": 37.088, + "relativeDirection": "LEFT", + "streetName": "Robinson Street", + "absoluteDirection": "EAST", + "stayOn": false, + "area": false, + "bogusName": false, + "lon": -81.3560746, + "lat": 28.545892400000003, + "elevation": [] + } + ] + }, + { + "startTime": 1615418614000, + "endTime": 1615418768000, + "departureDelay": 0, + "arrivalDelay": 0, + "realTime": false, + "distance": 1749.6170993673672, + "pathway": false, + "mode": "BUS", + "route": "51", + "agencyName": "Central Florida Regional Transit Authority", + "agencyUrl": "http://www.golynx.com", + "agencyTimeZoneOffset": -18000000, + "routeType": 3, + "routeId": "1:CFRTA_11792", + "interlineWithPreviousLeg": false, + "agencyId": "CFRTA", + "tripId": "1:CFRTA_1501114", + "serviceDate": "20210310", + "from": { + "name": "E ROBINSON STREET AND N HAMPTON AVENUE", + "stopId": "1:CFRTA_3980", + "lon": -81.355694, + "lat": 28.545823, + "arrival": 1615418613000, + "departure": 1615418614000, + "stopIndex": 10, + "stopSequence": 11, + "vertexType": "TRANSIT", + "boardAlightType": "DEFAULT" + }, + "to": { + "name": "N PRIMROSE DRIVE AND E LIVINGSTON STREET", + "stopId": "1:CFRTA_3983", + "lon": -81.347754, + "lat": 28.546962, + "arrival": 1615418768000, + "departure": 1615418769000, + "stopIndex": 13, + "stopSequence": 14, + "vertexType": "TRANSIT", + "boardAlightType": "DEFAULT" + }, + "legGeometry": { + "points": "yjfmDbxpoNCqB?qFEaE?w@AeA?kA?iA?K?{@?qBAwC?mAIoIcJD@@gC?K?A?Op@?q@?dB?s@?r@ADEBC@??G?GA??GCeBa@GEAGAG@GDGDC??HA|A^^K?q@N?L?fC?gC?jHC", + "length": 49 + }, + "interStopGeometry": [ + { + "points": "yjfmDbxpoNCqB?qFEaE?w@AeA?kA?iA?K", + "length": 9 + }, + { + "points": "ekfmD|}ooN?{@?qBAwC?mA", + "length": 5 + }, + { + "points": "gkfmDhqooNIoIcJD@@gC?K?A?Op@?q@?dB?s@?r@ADEBC@??G?GA??GCeBa@GEAGAG@GDGDC??HA|A^^K?q@N?L?fC?gC?jHC", + "length": 37 + } + ], + "routeShortName": "51", + "routeLongName": "CONWAY RD/ORLANDO INTL. AIRPORT", + "rentedBike": false, + "rentedCar": false, + "rentedVehicle": false, + "hailedCar": false, + "flexDrtAdvanceBookMin": 0, + "transitLeg": true, + "duration": 154, + "intermediateStops": [ + { + "name": "E ROBINSON STREET AND N BUMBY AVENUE", + "stopId": "1:CFRTA_6904", + "lon": -81.351501, + "lat": 28.545868, + "arrival": 1615418665000, + "departure": 1615418665000, + "stopIndex": 11, + "stopSequence": 12, + "vertexType": "TRANSIT", + "boardAlightType": "DEFAULT" + }, + { + "name": "E ROBINSON STREET AND N GRAHAM AVENUE", + "stopId": "1:CFRTA_3982", + "lon": -81.349482, + "lat": 28.545894, + "arrival": 1615418717000, + "departure": 1615418717000, + "stopIndex": 12, + "stopSequence": 13, + "vertexType": "TRANSIT", + "boardAlightType": "DEFAULT" + } + ], + "steps": [] + }, + { + "startTime": 1615418769000, + "endTime": 1615418942000, + "departureDelay": 0, + "arrivalDelay": 0, + "realTime": false, + "distance": 217.863, + "pathway": false, + "mode": "WALK", + "route": "", + "agencyTimeZoneOffset": -18000000, + "interlineWithPreviousLeg": false, + "from": { + "name": "N PRIMROSE DRIVE AND E LIVINGSTON STREET", + "stopId": "1:CFRTA_3983", + "lon": -81.347754, + "lat": 28.546962, + "arrival": 1615418768000, + "departure": 1615418769000, + "stopIndex": 13, + "stopSequence": 14, + "vertexType": "TRANSIT", + "boardAlightType": "DEFAULT" + }, + "to": { + "name": "2900 East Robinson Street, Orlando, FL, USA", + "lon": -81.34672164916994, + "lat": 28.545925723233477, + "arrival": 1615418942000, + "orig": "2900 East Robinson Street, Orlando, FL, USA", + "vertexType": "NORMAL" + }, + "legGeometry": { + "points": "oqfmD|fooNR?xCAR??QC{DP@", + "length": 7 + }, + "rentedBike": false, + "rentedCar": false, + "rentedVehicle": false, + "hailedCar": false, + "flexDrtAdvanceBookMin": 0, + "transitLeg": false, + "duration": 173, + "intermediateStops": [], + "steps": [ + { + "distance": 107.855, + "relativeDirection": "DEPART", + "streetName": "Primrose Drive", + "absoluteDirection": "SOUTH", + "stayOn": false, + "area": false, + "bogusName": false, + "lon": -81.3478298, + "lat": 28.546960300000002, + "elevation": [] + }, + { + "distance": 100.832, + "relativeDirection": "LEFT", + "streetName": "Robinson Street", + "absoluteDirection": "EAST", + "stayOn": false, + "area": false, + "bogusName": false, + "lon": -81.34781650000001, + "lat": 28.5459904, + "elevation": [ + { + "first": 0, + "second": 32.27 + }, + { + "first": 10, + "second": 32.27 + }, + { + "first": 20, + "second": 32.27 + }, + { + "first": 30, + "second": 32.27 + }, + { + "first": 40, + "second": 32.28 + }, + { + "first": 50, + "second": 32.28 + }, + { + "first": 60, + "second": 32.27 + }, + { + "first": 70, + "second": 32.27 + }, + { + "first": 80, + "second": 32.27 + }, + { + "first": 90, + "second": 32.26 + }, + { + "first": 100.83, + "second": 32.26 + } + ] + }, + { + "distance": 9.176, + "relativeDirection": "RIGHT", + "streetName": "service road", + "absoluteDirection": "SOUTH", + "stayOn": false, + "area": false, + "bogusName": true, + "lon": -81.3467845, + "lat": 28.5460123, + "elevation": [ + { + "first": 0, + "second": 32.26 + }, + { + "first": 9.18, + "second": 32.25 + } + ] + } + ] + } + ], + "tooSloped": false +} \ No newline at end of file