GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bertin/src/layers/label.js at main · riatelab/bertin

Expand file tree

/

label.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
57 lines (53 loc) · 2.16 KB
/

label.js

Copy path

File metadata and controls

57 lines (53 loc) · 2.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { centroid } from "../helpers/centroid.js";
import { figuration } from "../helpers/figuration.js";
export function label(selection, projection, planar, options = {}, clipid) {
let geojson = options.geojson;
let values = options.values;
let fill = options.fill ? options.fill : "#474342";
let fontSize = options.fontSize ? options.fontSize : 10;
let fontFamily = options.fontFamily ? options.fontFamily : "Roboto";
let textDecoration = options.textDecoration ? options.textDecoration : "none";
let fontWeight = options.fontWeight ? options.fontWeight : "normal";
let fontStyle = options.fontStyle ? options.fontStyle : "normal";
let opacity = options.opacity != undefined ? options.opacity : 1;
let halo = options.halo == true ? true : false;
let halo_style = options.halo_style ? options.halo_style : ["white", 4, 0.5];
//const features = centroid(geojson, { planar: planar }).features;
let features;
if (figuration(geojson) == "p") {
features = geojson.features;
} else {
features = centroid(geojson, { planar: planar }).features;
}
selection
.append("g")
.attr("class", options.id)
.attr("data-layer", JSON.stringify({ _type: "label" }))
.attr("data-layer", undefined)
.selectAll("text")
.data(
features
.filter((d) => d.geometry.coordinates != undefined)
.filter((d) => d.properties[values] != undefined)
)
.join("text")
.attr("class", "onglobe_coords")
.attr("x", (d) => projection(d.geometry.coordinates)[0])
.attr("y", (d) => projection(d.geometry.coordinates)[1])
.attr("fill", fill)
.attr("opacity", opacity)
.attr("font-size", fontSize)
.attr("font-family", fontFamily)
.attr("font-style", fontStyle)
.attr("text-decoration", textDecoration)
.attr("font-weight", fontWeight)
.attr("text-anchor", "middle")
.attr("dominant-baseline", "middle")
.attr("paint-order", "stroke")
.attr("stroke", halo ? halo_style[0] : "none")
.attr("stroke-width", halo ? halo_style[1] : 0)
.attr("stroke-opacity", halo ? halo_style[2] : 0)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.text((d) => d.properties[values]);
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.