From 2c919735c3740a6e8e3175ab155b26f0cdf6a6b3 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 20 Aug 2022 17:30:00 -0700 Subject: [PATCH] Tweak the railroad js and CSS files --- static/scripts/railroad.js | 2 +- static/styles/railroad.css | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/static/scripts/railroad.js b/static/scripts/railroad.js index d029475..2f34a07 100644 --- a/static/scripts/railroad.js +++ b/static/scripts/railroad.js @@ -23,7 +23,7 @@ export const Options = { VS: 8, // minimum vertical separation between things. For a 3px stroke, must be at least 4 AR: 10, // radius of arcs DIAGRAM_CLASS: 'railroad-diagram', // class to put on the root - STROKE_ODD_PIXEL_LENGTH: true, // is the stroke width an odd (1px, 3px, etc) pixel length? + STROKE_ODD_PIXEL_LENGTH: false, // is the stroke width an odd (1px, 3px, etc) pixel length? INTERNAL_ALIGNMENT: 'center', // how to align items when they have extra space. left/right/center CHAR_WIDTH: 8.5, // width of each monospace character. play until you find the right value for your font COMMENT_CHAR_WIDTH: 7, // comments are in smaller text by default diff --git a/static/styles/railroad.css b/static/styles/railroad.css index 83072c3..a462608 100644 --- a/static/styles/railroad.css +++ b/static/styles/railroad.css @@ -11,45 +11,55 @@ svg.railroad-diagram path { stroke-width: 2; stroke: var(--body-foreground-color); - fill: var(--body-foreground-color); + fill: none; } + svg.railroad-diagram text { font-family: var(--monospace-font-family); text-anchor: middle; white-space: pre; color: var(--body-foreground-color); } + svg.railroad-diagram text.diagram-text { font-size: 12px; } + svg.railroad-diagram text.diagram-arrow { font-size: 16px; } + svg.railroad-diagram text.label { text-anchor: start; } + svg.railroad-diagram text.comment { font: italic 12px monospace; } + svg.railroad-diagram g.non-terminal text { /*font-style: italic;*/ } + svg.railroad-diagram rect { stroke-width: 2; stroke: var(--body-foreground-color); fill: var(--rect-fill); } + svg.railroad-diagram rect.group-box { stroke: gray; stroke-dasharray: 10 5; fill: none; } + svg.railroad-diagram path.diagram-text { stroke-width: 3; stroke: var(--body-foreground-color); fill: var(--body-background-color); cursor: help; } + svg.railroad-diagram g.diagram-text:hover path.diagram-text { fill: #eee; }