Skip to content

Configuration ​

One configuration for the whole package: a palette by colour role, line and label sizes, and the editor's chrome. Renderers read it on their next paint.

ts
import {configureMetoc, getMetocConfig, resetMetocConfig} from '@zaes/metoc';

configureMetoc({lineWidth: 3, defaultLineColor: '#dddddd', handleColor: '#ff8c00'});
getMetocConfig();     // a frozen snapshot of the settings in force
resetMetocConfig();   // back to the defaults

configureMetoc merges what you pass. Numbers are clamped to METOC_CONFIG_RANGES, and a value of the wrong kind (a colour not in CSS form, an unknown point size) is ignored, keeping the setting in force. Passing undefined for an optional setting removes it.

An application that loads the package twice, as an ES module and as CommonJS, still has one configuration.

Lines and labels ​

SettingDefaultWhat it does
lineWidth2Stroke width in CSS pixels (1–8)
pipSize10A front's pips in CSS pixels; other decoration is proportioned from it (4–24)
smoothLinestrueJoin drawn points with a curve through each of them, areas too
areaFillOpacity0.35Opacity of an Area2 fill
defaultLineColornoneRecolours what the standard draws black, and nothing else, for dark or imagery maps
labelSize13Label font size in CSS pixels
labelColornoneOne colour for every label; absent, each label takes its graphic's colour
labelFontsans-serifA CSS font-family list for all text
labelHalo, labelHaloWidthwhite, 3The halo behind text; width 0 draws none
showLabelstrueOff, graphics show without values, heights and date-times; a symbol's own text stays

Point symbols ​

SettingDefaultWhat it does
pointSize'medium''small', 'medium' or 'large' for a graphic that states no size
allowPointRotationfalseOffer a rotate handle on point symbols, saved as rotation
pointFullSizeScalenoneShrink point symbols beyond this map scale (the N of 1:N): half size at four times the scale
pointMinScale0.4The smallest a shrinking point symbol gets

Colours ​

palette holds the standard's colours by role (cold, warm, occluded, black, …), from Table M-II. Change one with configureMetoc({palette: {black: '#e2e6eb'}}); the rest stay. DEFAULT_METOC_PALETTE is the standard's, and METOC_LIGHT_MAP and METOC_DARK_MAP are ready-made settings for a light and a dark basemap.

Editor chrome ​

handleColor, selectionColor, handleOutlineColor, insertHandleColor, rotateHandleColor, resizeHandleColor, guideColor and selectionWidth colour and size the editor's handles, the selection highlight and the construction line.

Released under the MIT License.