Created
March 5, 2021 09:34
-
-
Save captainbrosset/a9bbaad5eca3bb27c855a46bd423409b to your computer and use it in GitHub Desktop.
Code snippets for the "How we built the DevTools Tooltips" article
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
// Get the first segment's start point. | |
const points = [segments[0].start]; | |
// And append the end point of each segment, one by one, after that. | |
for (const segment of segments) { | |
if (!segment) { | |
continue; | |
} | |
points.push(segment.end); | |
} | |
let path = points.map(({x, y}) => `${x},${y}`).join('L'); | |
path = `M${path}Z`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment