GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — bertin/src/layers/header.js at main · riatelab/bertin Expand file tree/ Copy pathheader.jsMore file actions 60 lines (55 loc) · 1.52 KB / Copy pathheader.jsFile metadata and controls60 lines (55 loc) · 1.52 KB 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 58 59 60 // header export function addheader(selection, width, options = {}) { let fontSize; if (options.text) { fontSize = 25; } if (options.fontSize) { fontSize = options.fontSize; } let text = options.text ? options.text : ""; let fill = options.fill ? options.fill : "#9e9696"; let background = options.background ? options.background : "white"; let backgroundOpacity = options.backgroundOpacity != undefined ? options.backgroundOpacity : 1; let anchor = options.anchor ? options.anchor : "middle"; const delta = fontSize * text.split("\n").length; let x; if (anchor == "start") { x = 5; } if (anchor == "middle") { x = width / 2; } if (anchor == "end") { x = width - 5; } let header = selection .append("g") .attr("class", options.id) .attr("data-layer", JSON.stringify({ _type: "header" })); header .append("rect") .attr("x", 0) .attr("y", 0 - delta - 10) .attr("width", width) .attr("height", delta + 10) .attr("fill", background) .attr("fill-opacity", backgroundOpacity); header .selectAll("text") .data(options.text.split("\n")) .join("text") .attr("x", x) //.attr("y", -delta - 5) .attr("y", -delta - 5) .attr("font-size", `${fontSize}px`) .attr("dy", (d, i) => i * fontSize + fontSize / 2) .attr("text-anchor", anchor) .attr("dominant-baseline", "central") .attr("fill", fill) .attr("font-family", "sans-serif") .attr("font-weight", "bold") .attr("fill-opacity", 1) .text((d) => d); } |
| 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. |