Skip to content

v1.9.0

@ers-zaes ers-zaes tagged this 03 Aug 21:22
Decoration is drawn in screen space, not baked into geometry.

Ten graphics sized their decoration at `n * drawingResolution` and froze it into
the geometry in metres. It was therefore correct at whatever zoom the graphic
happened to be drawn at, and wrong at every other -- four times too big two zoom
levels in, gone when zoomed out. Their style functions now draw it at a constant
number of screen pixels, which is how StrongPoint's cross-ties have always
worked and what the library's own conventions have always called for.

  obstacle belt / group / zone      teeth, outward     10 px
  obstacle free / restricted area   teeth, inward      10 px
  obstacle line                     teeth, upper side  10 px
  fortified line, fortified area    square merlons     11 px
  forward line of own troops        scallops           8 px amplitude
  line of contact                   two waves          8 px, 16 px apart

Breaking, in a minor, for one kind of consumer: renderTacticalGraphic returns
the *undecorated* shape for those ten, so code rendering the portable GeoJSON
outside the @zaes/tactical-graphics/openlayers entry point now gets a plain ring
or line where it used to get a toothed one. Nothing is removed from the API and
an OpenLayers host sees no change but a better-behaved symbol. That is the
contract StrongPoint already had, and the README already describes it: other
renderers show the correct geometry and style it themselves.

The line of contact is the case that motivated the change. What the symbol says
is that two forces are in contact along a line -- the enemy-side wave, the
friendly-side wave, and the gap between them. Baked in, that gap was a distance
on the ground, so the thing the graphic is *about* grew and closed as the map
scaled. It is a pixel count now, and alone among these decorations it is not
capped by the symbol's on-screen size, because that cap is itself a function of
zoom and would reintroduce the fault.

Added, for hosts driving these styles themselves:

  obstacleAreaStyles, obstacleRestrictedZoneStyle, fortifiedAreaStyle

FortifiedArea gained a style function of its own; it had none, and only looked
fortified because its merlons were in its geometry.

580 tests, typecheck clean, build clean including the assertion that the root
entry point imports no OpenLayers. Verified in the browser across zoom levels:
teeth 10.0 px, merlons 11.0 px, scallops 8.0 px, line-of-contact reach 24.0 px,
each constant, with the correct side whichever way the graphic was drawn.
Assets 2
Loading