v0.129.0 — Map building: Tools, layers and the nub
Map building's seventh milestone (M7): drawing tools that all work by clicks, a rebuilt arc and a better cone, shapes that close themselves, map layers you can fade and lock, the nub in the top bar showing the campaign, map and layer you're on, the main palette as a strip down the left edge, and thumbnails for Objects in the Library. The program's documents are in docs/programs/map-building/; this milestone's tasks, decisions and test script are in docs/programs/map-building/m7-tools-and-layers.md.
Drawing tools
- [x] Circle, rectangle and cone are click, click: click the centre (a corner, the cone's tip), then click again to place it; the shape previews under the cursor between the clicks, Escape or a right-click cancels, and a press-drag-release still works. Touch is tap, tap, the second tap placing the shape when the finger lifts.
- [x] Escape while a shape is in progress cancels the shape and leaves Drawing Mode on (it used to close Drawing Mode too).
- [x] The arc tool is rebuilt: click one end, click the other, then move to bend it and click to place it. Inside the square on its two ends it is a circular arc (straight at the line, a quarter circle at the square's corner); beyond, a rounded corner that squares off as you go further. A fill colour fills its slice (the curve to its centre), and Stroke the slice's sides strokes the two sides too. Arcs drawn before, and doors' swing arcs, draw as they did.
- [x] An arc's fill (and its stroked sides) stays inside the square on its two ends: a shallow arc fills the half of the square under it, not a long wedge out to its circle's centre, and every arc but a straight one now has its fill (the cut-off for nearly flat arcs is gone). Hit-testing, its bounds and Object thumbnails agree.
- [x] On a phone the arc's third step is a drag: after tapping its two ends, touch and drag to bend it (it follows the finger, with the same snaps as the mouse) and lift to place it; a tap without dragging places it where tapped, as before. The same rule as the circle's, rectangle's and cone's second tap, which place on the lift; a pinch in between no longer leaves a stale "place on lift" behind.
- [x] Cone: a Straight edge option makes its far edge straight (a triangle); after its first click the mouse wheel widens or narrows it 15° a notch (clamped as the palette's buttons are) instead of zooming; the tool is called a cone, not an arc section. Its hit-test no longer misses one side of a cone pointing west.
- [x] Line and wall finish themselves: a vertex put on the first one (within the snap distance, three or more down) closes the shape and finishes it, a triangle or a square, as if finished by hand; a closed wall is one room, its first corner joined like the rest. Taps with no move between them no longer drop the first vertex.
- [x] The drawing tools' tooltips, the hints beside the cursor, the wall banner and the Drawings help page say how each tool is drawn now.
Map layers
- [x] Map layers can be faded (an opacity for everyone) and locked: on a locked layer nobody, the GM included, creates, moves, edits or deletes a token, drawing or Object (the server refuses it); hover and selection still work. Only who may edit the map changes a layer (the layer routes had no check of their own). Migration 0079.
- [x] The layer you're on is remembered per user per map in this browser (it was per browser), and as soon as you change it.
- [x] Edit Map has a Layers section, like Edit Object's: each layer with its count of tokens, Objects and drawings, a click to make it your current layer (anyone, Viewers too), and for who may edit the map everything the Edit Layers modal did plus visibility, opacity and lock. The palette's Edit Layers opens it; the modal is gone. Who may not edit the map sees Edit Map read-only.
- [x] Delete mode can delete on all layers: the banner's This layer / All layers (this layer by default, kept for the session); with all layers a click deletes whatever is on top under the pointer, on any layer but a hidden one. Nothing on a locked layer is deleted either way, and the banner says so while a layer is locked.
The nub
- [x] The map nub shows your current layer: Campaign / Map / Tokens layer, with a lock when it is locked; too long, it shortens like the Object Edit Mode crumbs.
- [x] The nub's popover is in sections, side by side when there is room: Campaign (its page, Switch campaign), Map (a caret turns the name into the campaign's maps; Edit Map, New Map), Layer (what is on your current layer, See all layers), the Object tree while an Object is selected or entered (a name enters it), and Connected players (Bring all to this map, Request Transcription, Invite Players).
- [x] The nub (campaign / map / layer, and who is here) is in the top bar's centre, where the palette was, without its outline; its popover opens from there as before. The mode banners (Measure, Target, …) sit just below the bar now that the nub no longer hangs over the map. On a phone the nub hangs from the top as before.
- [x] The layer selector has left the palette: the nub shows your current layer, and its popover's Layer section changes it, a list of the map's layers (an Object's own while you are inside one), for anyone, Viewers too. The flash when Drawing Mode switches your layer is on the nub now. The phone's Palette drawer keeps its list of layers.
- [x] When the layer changes for you, only the layer's name in the nub flashes, not the whole nub (Object Edit Mode's nub has no layer name, and flashes whole as before).
- [x] Placing an Object puts you on the map's default Object layer, as Drawing does for drawings, and says so; you're put back when the placement is cancelled, or once what you placed is deselected. What you place is now selected, so it can be moved or turned straight away.
The palette down the left edge
- [x] The main palette is a vertical strip down the left edge of the map (the inner ring), out of the top bar: every tool but the layer selector, square against the bar and the rail, round over the map, in the inner ring's background; on a short screen it wraps into a second column rather than run to the bottom, and the map view clears it. Collapsed, it is its one Tools button there. Phones keep the Palette drawer.
- [x] While drawing (and in VBL or Fog of War), that palette's tools are a second strip right beside the main palette's, and the tool's settings run across the top from right of both; the two strips are one shape, square where they meet, with a curved corner where the shorter one ends.
- [x] The main palette strip's top right corner is square when nothing stands beside it: it meets the play bar there.
- [x] The inner ring is see-through like the sidebars: its colour at 80%, the map blurred 3px behind. The ring's shadows are box-shadows now, since a filter on a container hides the map from the blur.
- [x] No lines between the palette's pieces: the main strip, the drawing (VBL, Fog) tools strip and the properties strip are one shape, outlined in the skin's border colour only where they meet the map, with one soft shadow that falls on the map and not on a neighbouring strip. Where the ring meets the play bar and the rail, their own borders are the line.
- [x] The inner ring is one solid colour, no fade: every strip, the curved corners and the snap bar are the same blue-green (the average of the fade's two tones, still 80% with the map blurred behind), so its pieces blend into one.
- [x] The curved inside corners (where the drawing tools strip ends beside the main strip, and under the properties strip) carry the same border as the straight edges, one unbroken line round the curve.
- [x] The Drawing, VBL and Fog tool buttons keep their own look, apart from the main palette's, but in a lighter tint of the ring's blue-green instead of brown (a darker tint in light mode); the selected tool keeps its own fill.
- [x] Every skin gets the same treatment: the dark skins (Retro, New Retro Dark, Modern Dark) the dark ring and tool tint, the light ones (New Retro Light, Modern Light) the light pair, and the ring's edge over the map is each skin's own border colour, the one its top bar and rail use.
Objects
- [x] The Edit Object tab is in the right sidebar's strip only while an Object is selected or entered: selecting an Object you may edit adds the tab (click it to edit that Object's name and layers; double-click the Object to enter it), without changing what the sidebar shows; entering still opens it. Deselecting removes the tab, and if it was open, puts back what was there before.
- [x] Objects get thumbnails: an Object with no art of its own is drawn from its parts (tokens and drawings, walls included, by its layers; nothing hidden from players) on a transparent background when an editor changes it, stored on its Library Record (
PUT /api/library/assets/object/:id/thumbnail, the old file deleted), and shown on its Library card in place of the placeholder. - [x] An Object's thumbnail shows only what the least-privileged player who can see it would see on the map, at rest: besides parts hidden from players and parts on hidden Object layers (already left out), it now leaves out parts on a hidden map layer (or one that doesn't draw them, the Foundation and VBL/FoW layers, or a layer the map doesn't have), fades parts by their map layer's opacity, and leaves out anything fully transparent so it doesn't widen the picture. Object layers are taken without their hover state, so a door's swing shown only on hover stays out; a lock changes nothing. Hiding or fading a map layer redraws the thumbnails of the Objects on it.
- [x] A selected Object's Edit Object tab no longer looks like edit mode: it says the Object is selected, has an Edit button, and shows Show background while editing only while you are editing it.
- [x] On a generated map, entering an Object shows the white screen or the black void (they were drawn under the generated ground).
- [x] Double-clicking an Object made of drawings enters it, and entering an Object any way (double-click, the nub's Object tree, Edit, New Object) opens the Edit Object sidebar.
- [x] Right-clicking a part of the Object you are editing shows the part's menu (Place in Wall), not the Object's.
Navigation, history and search
- [x] Campaigns in the left navigation has a second level: Current Campaign, the campaign you viewed last (its pages nested under it while you are in it), and All Campaigns. Clicking the crown goes to your Current Campaign, or to All Campaigns when you haven't viewed one yet or can no longer see it. Remembered on this device, per user; the phone's menu has the same.
- [x] Redo on the map works for more than one step (it stopped after the first since v0.100.0).
- [x] Library search matches substrings and typos on Postgres: migration 0080 installs the
pg_trgmextension where the database user may (where it may not, a notice, and search stays on full-text as before).
Migrations
- 0079: map layers' opacity and lock (
map_layers.opacity,map_layers.locked). - 0080: the
pg_trgmextension for Library search, installed where the database user may; where it may not, a notice and search stays on full-text.