forked from uber/nebula.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[path-marker-layer] Fix incorrectly positioned arrows (uber#730)
* Revert "Fix "Cannot read properties of undefined (reading 'clone')" (uber#671)" This reverts commit 96229b0. * [path-marker-layer] Fix incorrectly positioned arrows
- Loading branch information
Showing
3 changed files
with
303 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
...s/layers/test/lib/layers/path-marker-layer/__snapshots__/create-path-markers.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`test createPathMarkers 1`] = ` | ||
Array [ | ||
Object { | ||
"angle": -97.30808486223859, | ||
"color": Array [ | ||
0, | ||
0, | ||
0, | ||
255, | ||
], | ||
"object": Object { | ||
"direction": Object { | ||
"backward": false, | ||
"forward": true, | ||
}, | ||
"path": Array [ | ||
Array [ | ||
-122.419385, | ||
37.775412, | ||
], | ||
Array [ | ||
-122.4196034, | ||
37.7753836, | ||
], | ||
Array [ | ||
-122.419815, | ||
37.775356, | ||
], | ||
Array [ | ||
-122.4199019, | ||
37.7753448, | ||
], | ||
Array [ | ||
-122.420337, | ||
37.775289, | ||
], | ||
Array [ | ||
-122.420432, | ||
37.7752776, | ||
], | ||
], | ||
}, | ||
"position": Array [ | ||
-122.41990839434719, | ||
37.77534396712348, | ||
0, | ||
], | ||
}, | ||
Object { | ||
"angle": -12.766852083123982, | ||
"color": Array [ | ||
0, | ||
0, | ||
0, | ||
255, | ||
], | ||
"object": Object { | ||
"direction": Object { | ||
"backward": false, | ||
"forward": true, | ||
}, | ||
"path": Array [ | ||
Array [ | ||
-122.419556, | ||
37.776966, | ||
], | ||
Array [ | ||
-122.419631, | ||
37.777297, | ||
], | ||
], | ||
}, | ||
"position": Array [ | ||
-122.41959349999999, | ||
37.777131499999996, | ||
0, | ||
], | ||
}, | ||
Object { | ||
"angle": 136.64059263100177, | ||
"color": Array [ | ||
0, | ||
0, | ||
0, | ||
255, | ||
], | ||
"object": Object { | ||
"direction": Object { | ||
"backward": false, | ||
"forward": true, | ||
}, | ||
"path": Array [ | ||
Array [ | ||
-122.4232649, | ||
37.7715712, | ||
], | ||
Array [ | ||
-122.4231892, | ||
37.7714474, | ||
], | ||
Array [ | ||
-122.4230516, | ||
37.7712495, | ||
], | ||
Array [ | ||
-122.4229364, | ||
37.7711068, | ||
], | ||
Array [ | ||
-122.4228177, | ||
37.7709811, | ||
], | ||
Array [ | ||
-122.4226595, | ||
37.770835, | ||
], | ||
Array [ | ||
-122.4225099, | ||
37.7707146, | ||
], | ||
Array [ | ||
-122.4224446, | ||
37.7706699, | ||
], | ||
], | ||
}, | ||
"position": Array [ | ||
-122.42290555432264, | ||
37.77107413528523, | ||
0, | ||
], | ||
}, | ||
Object { | ||
"angle": 127.35649243207592, | ||
"color": Array [ | ||
0, | ||
0, | ||
0, | ||
255, | ||
], | ||
"object": Object { | ||
"direction": Object { | ||
"backward": false, | ||
"forward": true, | ||
}, | ||
"path": Array [ | ||
Array [ | ||
-122.417263, | ||
37.7763419, | ||
], | ||
Array [ | ||
-122.417163, | ||
37.776264, | ||
], | ||
Array [ | ||
-122.4169496, | ||
37.7761011, | ||
], | ||
], | ||
}, | ||
"position": Array [ | ||
-122.41710667970543, | ||
37.77622100761018, | ||
0, | ||
], | ||
}, | ||
] | ||
`; |
123 changes: 123 additions & 0 deletions
123
modules/layers/test/lib/layers/path-marker-layer/create-path-markers.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import createPathMarkers from '../../../../src/layers/path-marker-layer/create-path-markers'; | ||
|
||
const data = [ | ||
{ | ||
path: [ | ||
[-122.419385, 37.775412], | ||
[-122.4196034, 37.7753836], | ||
[-122.419815, 37.775356], | ||
[-122.4199019, 37.7753448], | ||
[-122.420337, 37.775289], | ||
[-122.420432, 37.7752776], | ||
], | ||
direction: { | ||
forward: true, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.4239121, 37.7739008], | ||
[-122.424018, 37.773888], | ||
], | ||
direction: { | ||
forward: false, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.419556, 37.776966], | ||
[-122.419631, 37.777297], | ||
], | ||
direction: { | ||
forward: true, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.4232649, 37.7715712], | ||
[-122.4231892, 37.7714474], | ||
[-122.4230516, 37.7712495], | ||
[-122.4229364, 37.7711068], | ||
[-122.4228177, 37.7709811], | ||
[-122.4226595, 37.770835], | ||
[-122.4225099, 37.7707146], | ||
[-122.4224446, 37.7706699], | ||
], | ||
direction: { | ||
forward: true, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.421459, 37.7756509], | ||
[-122.4214451, 37.7755683], | ||
[-122.4214282, 37.7755459], | ||
[-122.4213833, 37.7755382], | ||
[-122.4212633, 37.7755543], | ||
], | ||
direction: { | ||
forward: false, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.41515, 37.77588], | ||
[-122.415508, 37.775601], | ||
], | ||
direction: { | ||
forward: false, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.417263, 37.7763419], | ||
[-122.417163, 37.776264], | ||
[-122.4169496, 37.7761011], | ||
], | ||
direction: { | ||
forward: true, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.4205054, 37.7733851], | ||
[-122.4203894, 37.773298], | ||
], | ||
direction: { | ||
forward: false, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.4245033, 37.7762476], | ||
[-122.4244959, 37.7762071], | ||
], | ||
direction: { | ||
forward: false, | ||
backward: false, | ||
}, | ||
}, | ||
{ | ||
path: [ | ||
[-122.415898, 37.777819], | ||
[-122.416311, 37.777494], | ||
], | ||
direction: { | ||
forward: false, | ||
backward: false, | ||
}, | ||
}, | ||
]; | ||
|
||
it('test createPathMarkers', () => { | ||
const result = createPathMarkers({ data, projectFlat: (x) => x }); | ||
expect(result).toMatchSnapshot(); | ||
}); |