@vitrinka/web 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +15 -8
- package/build/recorder/version.d.ts +2 -2
- package/build/recorder/version.js +1 -1
- package/build/report/i18n.d.ts +10 -2
- package/build/report/i18n.js +22 -6
- package/build/report/keybind.d.ts +8 -0
- package/build/report/keybind.js +19 -9
- package/build/report/place.d.ts +11 -0
- package/build/report/place.js +14 -0
- package/build/report/settings.d.ts +7 -1
- package/build/report/settings.js +8 -0
- package/build/report/styles.d.ts +1 -1
- package/build/report/styles.js +32 -14
- package/build/report/widget.d.ts +6 -2
- package/build/report/widget.js +130 -51
- package/build/report-widget.mjs +38 -20
- package/package.json +1 -1
package/build/report/widget.js
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* one numbered note line per mark, and Send — the capture frozen when the
|
|
10
10
|
* card opens (the buffer rolls on).
|
|
11
11
|
* - "Show us where" marks the frozen page under a top bar (vt-8020 D6 A): a segmented
|
|
12
|
-
*
|
|
12
|
+
* box · circle · arrow · cover, and Cancel, which leaves marking and drops
|
|
13
13
|
* this pass's marks (vt-8020 D12). The card stays on screen while marking, parked
|
|
14
14
|
* in the corner that covers none of the marks (place.ts). No element
|
|
15
|
-
* selector.
|
|
16
|
-
*
|
|
17
|
-
* move".
|
|
15
|
+
* selector. While marking, a coach rides on the card's top edge, never over
|
|
16
|
+
* the page: a tiny run of the picked shape's gesture and the words "click,
|
|
17
|
+
* hold and move", until the person presses "Got it, don't show again".
|
|
18
18
|
* - The reporter's files (vt-8020 D9, attachments.ts): 📎 in the card's foot,
|
|
19
19
|
* paste or drop onto the card; chips above the foot, refused at once past
|
|
20
20
|
* the project's caps, sent on the wire's attachment leg.
|
|
@@ -42,21 +42,24 @@ import { browserLocale, parseLocale, REPORT_KINDS, strings } from './i18n';
|
|
|
42
42
|
import { normalizeIdentity, onSharedIdentity, sharedIdentity } from './identity';
|
|
43
43
|
import { keybindLabel, loadKeybind, matchesKeybind, readKeybindPress, saveKeybind, watchKeybind } from './keybind';
|
|
44
44
|
import { arrowEnds, arrowHead, isMark, rectBetween, renumber, toWire, } from './markers';
|
|
45
|
-
import { cornerRect, pickCorner } from './place';
|
|
45
|
+
import { coachSide, cornerRect, pickCorner } from './place';
|
|
46
46
|
import { listMine, openSession, sessionLive } from './reader';
|
|
47
47
|
import { noteSent, readSent } from './sent';
|
|
48
|
-
import { readSize, SIZE_KEY, SIZE_SCALE, SIZES, techDetails, writePref } from './settings';
|
|
48
|
+
import { COACH_KEY, readCoach, readSize, SIZE_KEY, SIZE_SCALE, SIZES, techDetails, writePref } from './settings';
|
|
49
49
|
import { REPORT_CSS } from './styles';
|
|
50
50
|
import { EMPTY_CAPTURE, prepareCapture, ReportJob } from './wire';
|
|
51
51
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
52
52
|
const TITLE_CAP = 100;
|
|
53
|
-
|
|
53
|
+
/** The box leads and is the default: most problems are a region, and a box is the one gesture nobody has to learn. */
|
|
54
|
+
const TOOLS = ['box', 'circle', 'arrow', 'hide'];
|
|
54
55
|
/** A keyboard mark starts as this, centred; arrows move it 10 px, Shift+arrows resize it. */
|
|
55
56
|
const KB_DRAFT = { w: 160, h: 80 };
|
|
56
57
|
const MIN_KB_SIZE = 16;
|
|
57
58
|
/** The one card's size (vt-8020 D10: it never changes between states) and the clear band the marking bar keeps at the top. */
|
|
58
59
|
const CARD = { w: 380, h: 460 };
|
|
59
60
|
const BAR_CLEAR = 72;
|
|
61
|
+
/** The coach's box beside the card (styles: `.coach`), before the size setting scales it, and its gap to the card. */
|
|
62
|
+
const COACH = { w: 300, h: 160, gap: 10 };
|
|
60
63
|
/** The gap a parked card keeps on a side it did not rest against. */
|
|
61
64
|
const PARK_EDGE = 16;
|
|
62
65
|
const KB_STEPS = {
|
|
@@ -85,19 +88,68 @@ const ICON = {
|
|
|
85
88
|
pen: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10.8 2.7l2.5 2.5-7.6 7.6-3.1 0.6 0.6-3.1z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg>',
|
|
86
89
|
check: '<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M7.5 12.3l3 3 6-6.3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
87
90
|
};
|
|
88
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* The coach's run of the picked shape (D21): a pointer presses, holds and moves, and the shape grows under it.
|
|
93
|
+
* ONE clock: every moving part is SMIL in the same SVG with the same keyTimes and linear timing, so the pointer
|
|
94
|
+
* and the stroke stay locked frame for frame (a CSS-eased stroke beside a linear SMIL pointer drew ahead of it).
|
|
95
|
+
*/
|
|
96
|
+
const COACH_TIMES = '0;0.18;0.72;1';
|
|
97
|
+
const COACH_DUR = '2.8s';
|
|
89
98
|
const LOOP_PATH = 'M 134 14 C 200 14, 214 50, 134 50 C 54 50, 68 14, 134 14';
|
|
90
|
-
|
|
99
|
+
const POINTER_SHAPE = '<path d="M0 0 L0 15 L4 11 L7 18 L10 16.6 L7 10 L12.5 10 Z" fill="#fff" stroke="#151417" stroke-width="1"/>';
|
|
100
|
+
/** One value run on the coach clock: still at `from`, moving to `to`, still at `to`. */
|
|
101
|
+
function coachAnim(attr, from, to) {
|
|
102
|
+
return `<animate attributeName="${attr}" values="${from};${from};${to};${to}" keyTimes="${COACH_TIMES}" calcMode="linear" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
103
|
+
}
|
|
104
|
+
function coachArt(shape, reduced) {
|
|
105
|
+
const still = (from, to) => (reduced ? to : from);
|
|
106
|
+
const anim = (attr, from, to) => (reduced ? '' : coachAnim(attr, from, to));
|
|
107
|
+
// The finished shape fades as the loop turns over; the press ring shows while the button is held.
|
|
108
|
+
const fade = reduced ? '' : `<animate attributeName="opacity" values="1;1;0" keyTimes="0;0.9;1" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
109
|
+
const hold = reduced
|
|
110
|
+
? ''
|
|
111
|
+
: `<animate attributeName="opacity" values="0;0;.9;.9;0;0" keyTimes="0;0.08;0.14;0.72;0.8;1" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
112
|
+
let scene;
|
|
113
|
+
let path;
|
|
114
|
+
let end;
|
|
115
|
+
if (shape === 'circle') {
|
|
116
|
+
path = LOOP_PATH;
|
|
117
|
+
end = { x: 134, y: 14 };
|
|
118
|
+
scene =
|
|
119
|
+
'<rect class="bar" x="84" y="27" width="100" height="10" rx="5"/>' +
|
|
120
|
+
`<path class="loop" d="${LOOP_PATH}" pathLength="200" stroke-dasharray="200" stroke-dashoffset="${still(200, 0)}">${anim('stroke-dashoffset', 200, 0)}${fade}</path>`;
|
|
121
|
+
}
|
|
122
|
+
else if (shape === 'arrow') {
|
|
123
|
+
path = 'M 74 54 L 128 33';
|
|
124
|
+
end = { x: 128, y: 33 };
|
|
125
|
+
// A zero-length line still paints its head, pointing nowhere: the arrow shows only once it moves.
|
|
126
|
+
const show = reduced ? '' : `<animate attributeName="opacity" values="0;0;1;1;0" keyTimes="0;0.18;0.19;0.9;1" dur="${COACH_DUR}" repeatCount="indefinite"/>`;
|
|
127
|
+
scene =
|
|
128
|
+
'<defs><marker id="vr-coach-head" viewBox="0 0 10 10" refX="7" refY="5" markerWidth="5" markerHeight="5" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="#e6455f"/></marker></defs>' +
|
|
129
|
+
'<rect class="bar" x="136" y="27" width="70" height="10" rx="5"/>' +
|
|
130
|
+
`<line class="loop" x1="74" y1="54" x2="${still(74, 128)}" y2="${still(54, 33)}" marker-end="url(#vr-coach-head)"${reduced ? '' : ' opacity="0"'}>${anim('x2', 74, 128)}${anim('y2', 54, 33)}${show}</line>`;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// box and cover share the drag; a cover fills, so what is under it reads as gone.
|
|
134
|
+
const cover = shape === 'hide';
|
|
135
|
+
path = cover ? 'M 90 10 L 178 54' : 'M 96 12 L 172 52';
|
|
136
|
+
end = cover ? { x: 178, y: 54 } : { x: 172, y: 52 };
|
|
137
|
+
const x = cover ? 90 : 96;
|
|
138
|
+
const y = cover ? 10 : 12;
|
|
139
|
+
const w = end.x - x;
|
|
140
|
+
const hgt = end.y - y;
|
|
141
|
+
scene =
|
|
142
|
+
(cover
|
|
143
|
+
? '<rect class="bar" x="102" y="20" width="64" height="8" rx="4"/><rect class="bar" x="102" y="35" width="44" height="8" rx="4"/>'
|
|
144
|
+
: '<rect class="bar" x="110" y="27" width="48" height="10" rx="5"/>') +
|
|
145
|
+
`<rect class="${cover ? 'veil' : 'loop'}" x="${x}" y="${y}" width="${still(0, w)}" height="${still(0, hgt)}" rx="${cover ? 4 : 6}">${anim('width', 0, w)}${anim('height', 0, hgt)}${fade}</rect>`;
|
|
146
|
+
}
|
|
91
147
|
const motion = reduced
|
|
92
148
|
? ''
|
|
93
|
-
: `<animateMotion dur="
|
|
94
|
-
return (
|
|
95
|
-
|
|
96
|
-
`<
|
|
97
|
-
`<g class="pointer"${reduced ? ' transform="translate(134 14)"' : ''}>` +
|
|
98
|
-
'<circle class="hold" r="9"/>' +
|
|
99
|
-
'<path d="M0 0 L0 15 L4 11 L7 18 L10 16.6 L7 10 L12.5 10 Z" fill="#fff" stroke="#151417" stroke-width="1"/>' +
|
|
100
|
-
`${motion}</g></svg>`);
|
|
149
|
+
: `<animateMotion dur="${COACH_DUR}" repeatCount="indefinite" keyPoints="0;0;1;1" keyTimes="${COACH_TIMES}" calcMode="linear" path="${path}"/>`;
|
|
150
|
+
return (`<svg viewBox="0 0 268 64" aria-hidden="true" data-shape="${shape}">${scene}` +
|
|
151
|
+
`<g class="pointer"${reduced ? ` transform="translate(${end.x} ${end.y})"` : ''}>` +
|
|
152
|
+
`<circle class="hold" r="9"${reduced ? ' opacity=".9"' : ' opacity="0"'}>${hold}</circle>${POINTER_SHAPE}${motion}</g></svg>`);
|
|
101
153
|
}
|
|
102
154
|
function h(tag, attrs = {}, ...kids) {
|
|
103
155
|
const el = document.createElement(tag);
|
|
@@ -261,11 +313,14 @@ function buildDom(mount) {
|
|
|
261
313
|
sizeButtons.set(z, h('button', { type: 'button', role: 'radio', 'aria-checked': 'false', 'data-size': z }));
|
|
262
314
|
const sizeInd = h('span', { class: 'seg-ind', 'aria-hidden': 'true' });
|
|
263
315
|
const sizeSeg = h('div', { class: 'seg', role: 'radiogroup', 'aria-labelledby': 'vr-size-label' }, sizeInd, ...sizeButtons.values());
|
|
316
|
+
// The marking tips: the way back after "Got it, don't show again".
|
|
317
|
+
const coachLabel = h('span', { class: 'label', id: 'vr-coach-label' });
|
|
318
|
+
const coachSwitch = h('button', { class: 'switch', type: 'button', role: 'switch', 'aria-checked': 'true', 'aria-labelledby': 'vr-coach-label' }, h('span', { class: 'knob', 'aria-hidden': 'true' }));
|
|
264
319
|
// Technical details: read-only, for support conversations.
|
|
265
320
|
const techText = h('span');
|
|
266
321
|
const techBtn = h('button', { class: 'link', type: 'button', 'aria-expanded': 'false', 'aria-controls': 'vr-tech' }, techText, icon(ICON.chevron));
|
|
267
322
|
const tech = h('dl', { class: 'tech', id: 'vr-tech' });
|
|
268
|
-
const settings = h('div', { class: 'pane settings' }, h('div', { class: 'row' }, bindLabel, bindBtn), bindReason, bindHint, h('div', { class: 'row size-row' }, sizeLabel, sizeSeg), h('div', { class: 'tech-wrap' }, techBtn, tech), h('div', { class: 'settings-foot' }, back, unbind));
|
|
323
|
+
const settings = h('div', { class: 'pane settings' }, h('div', { class: 'row' }, bindLabel, bindBtn), bindReason, bindHint, h('div', { class: 'row size-row' }, sizeLabel, sizeSeg), h('div', { class: 'row tips-row' }, coachLabel, coachSwitch), h('div', { class: 'tech-wrap' }, techBtn, tech), h('div', { class: 'settings-foot' }, back, unbind));
|
|
269
324
|
const sentTitle = h('h3');
|
|
270
325
|
const sentBody = h('p', { class: 'sent-body' });
|
|
271
326
|
const seeText = h('span');
|
|
@@ -294,8 +349,17 @@ function buildDom(mount) {
|
|
|
294
349
|
const linkWait = h('p', { class: 'list-status', role: 'status' });
|
|
295
350
|
const linkRetry = h('button', { class: 'link', type: 'button' });
|
|
296
351
|
const linking = h('div', { class: 'pane linking' }, linkBack, linkLabel, linkCode, h('div', { class: 'link-go' }, linkOpen, linkQr), linkHint, linkWait, linkRetry);
|
|
352
|
+
// The coach (vt-8020) rides on the card's top edge while marking, never over the page it teaches about;
|
|
353
|
+
// its art follows the picked shape (paint), and one button turns it off for good.
|
|
354
|
+
const coachArtSlot = h('div', { class: 'coach-art' });
|
|
355
|
+
const coachText = h('p');
|
|
356
|
+
const coachMore = h('p');
|
|
357
|
+
const coachDismiss = h('button', { class: 'coach-ok', type: 'button' });
|
|
358
|
+
const coach = h('div', { class: 'coach', role: 'status' }, coachArtSlot, coachText, coachMore, coachDismiss);
|
|
359
|
+
// How to mark from the keyboard: the marking layer's description, for assistive technology only.
|
|
360
|
+
const coachKeys = h('p', { class: 'sr-only', id: 'vr-keys' });
|
|
297
361
|
const body = h('div', { class: 'body' }, describe, settings, sent, reports, recents, linking);
|
|
298
|
-
const card = h('section', { class: 'card', role: 'dialog', 'aria-modal': 'false', 'aria-labelledby': 'vr-title' }, head, accountPop, morePop, body, tray, foot);
|
|
362
|
+
const card = h('section', { class: 'card', role: 'dialog', 'aria-modal': 'false', 'aria-labelledby': 'vr-title' }, head, accountPop, morePop, body, tray, foot, coach);
|
|
299
363
|
const ink = svgEl('svg', { class: 'ink', 'aria-hidden': 'true' });
|
|
300
364
|
const defs = svgEl('defs', {});
|
|
301
365
|
const headMarker = svgEl('marker', { id: 'vr-head', viewBox: '0 0 10 10', refX: 7, refY: 5, markerWidth: 5, markerHeight: 5, orient: 'auto-start-reverse' });
|
|
@@ -305,11 +369,6 @@ function buildDom(mount) {
|
|
|
305
369
|
const draft = svgEl('g', { class: 'draft' });
|
|
306
370
|
ink.append(defs, shapes, draft);
|
|
307
371
|
const pins = h('div', { class: 'pins' });
|
|
308
|
-
const coachText = h('p');
|
|
309
|
-
const coachMore = h('p');
|
|
310
|
-
const coachKeys = h('p', { class: 'keys', id: 'vr-keys' });
|
|
311
|
-
const coach = h('div', { class: 'coach', role: 'status' });
|
|
312
|
-
coach.append(icon(coachArt(reducedMotion())), coachText, coachMore, coachKeys);
|
|
313
372
|
// The top bar (vt-8020 D6): one plain line, the shape as a segmented control whose indicator slides, Cancel.
|
|
314
373
|
const toolButtons = new Map();
|
|
315
374
|
const toolLabels = new Map();
|
|
@@ -328,7 +387,7 @@ function buildDom(mount) {
|
|
|
328
387
|
const ask = h('span', { class: 'tb-confirm', role: 'group' }, askText, discard, keep);
|
|
329
388
|
const toolbar = h('div', { class: 'tb', role: 'toolbar' }, barLead, seg, h('span', { class: 'tb-sep', 'aria-hidden': 'true' }), cancel, ask);
|
|
330
389
|
// Focusable: from the keyboard, Enter places a mark the arrows then move (markKey).
|
|
331
|
-
const mark = h('div', { class: 'mark', tabindex: '0', role: 'application', 'aria-describedby': 'vr-keys' }, pins,
|
|
390
|
+
const mark = h('div', { class: 'mark', tabindex: '0', role: 'application', 'aria-describedby': 'vr-keys' }, pins, coachKeys, toolbar);
|
|
332
391
|
mark.prepend(ink);
|
|
333
392
|
// The card after the marking layer: it stays on top of it, usable, while the reporter marks.
|
|
334
393
|
const root = h('div', { class: 'vr' }, fab, mark, card);
|
|
@@ -347,9 +406,9 @@ function buildDom(mount) {
|
|
|
347
406
|
notify, notifyBox, notifyText, error, where, whereText, send,
|
|
348
407
|
attach, fileInput, fileNote, files, tray,
|
|
349
408
|
settings, bindLabel, bindBtn, unbind, bindHint, bindReason, back,
|
|
350
|
-
sizeLabel, sizeButtons, sizeInd, sizeSeg, techText, techBtn, tech,
|
|
409
|
+
sizeLabel, sizeButtons, sizeInd, sizeSeg, coachLabel, coachSwitch, techText, techBtn, tech,
|
|
351
410
|
sent, sentTitle, sentBody, see, seeText, sentClose,
|
|
352
|
-
mark, ink, shapes, draft, pins, coach, coachText, coachMore, coachKeys,
|
|
411
|
+
mark, ink, shapes, draft, pins, coach, coachArtSlot, coachText, coachMore, coachDismiss, coachKeys,
|
|
353
412
|
toolbar, barLead, seg, segInd, toolButtons, toolLabels, cancel, ask, askText, discard, keep,
|
|
354
413
|
};
|
|
355
414
|
}
|
|
@@ -372,7 +431,11 @@ export class ReportWidget {
|
|
|
372
431
|
marking = false;
|
|
373
432
|
markers = [];
|
|
374
433
|
nextKey = 1;
|
|
375
|
-
tool =
|
|
434
|
+
tool = TOOLS[0];
|
|
435
|
+
/** The coach shows while marking until dismissed (settings.ts readCoach). */
|
|
436
|
+
coachOn = readCoach();
|
|
437
|
+
/** The shape the coach's art shows; its SVG is rebuilt (and its clock restarted) when the pick changes. */
|
|
438
|
+
coachShape = null;
|
|
376
439
|
frozen = null;
|
|
377
440
|
job = null;
|
|
378
441
|
sending = false;
|
|
@@ -658,6 +721,18 @@ export class ReportWidget {
|
|
|
658
721
|
this.placeCard(true);
|
|
659
722
|
});
|
|
660
723
|
}
|
|
724
|
+
const setCoach = (shown) => {
|
|
725
|
+
this.coachOn = shown;
|
|
726
|
+
writePref(COACH_KEY, shown ? 'on' : 'off');
|
|
727
|
+
this.paint();
|
|
728
|
+
};
|
|
729
|
+
on(e.coachDismiss, 'click', () => {
|
|
730
|
+
setCoach(false);
|
|
731
|
+
// The button that had focus is gone: drawing goes on from the layer.
|
|
732
|
+
if (this.marking)
|
|
733
|
+
e.mark.focus();
|
|
734
|
+
});
|
|
735
|
+
on(e.coachSwitch, 'click', () => setCoach(!this.coachOn));
|
|
661
736
|
on(e.techBtn, 'click', () => {
|
|
662
737
|
this.techOpen = !this.techOpen;
|
|
663
738
|
this.paint();
|
|
@@ -1263,8 +1338,6 @@ export class ReportWidget {
|
|
|
1263
1338
|
this.paint();
|
|
1264
1339
|
this.placeCard();
|
|
1265
1340
|
this.placeSeg(true);
|
|
1266
|
-
const vw = globalThis.innerWidth || 800;
|
|
1267
|
-
this.placeCoach({ x: vw / 2 - 150, y: BAR_CLEAR + 12 }, false);
|
|
1268
1341
|
this.e.mark.focus();
|
|
1269
1342
|
}
|
|
1270
1343
|
/** Leaves marking; the card stays where marking parked it until it closes (it never jumps back). */
|
|
@@ -1331,12 +1404,24 @@ export class ReportWidget {
|
|
|
1331
1404
|
card.classList.add('parked');
|
|
1332
1405
|
card.style.left = `${r.x}px`;
|
|
1333
1406
|
card.style.top = `${r.y}px`;
|
|
1407
|
+
this.placeCoachSide();
|
|
1334
1408
|
if (!land)
|
|
1335
1409
|
return;
|
|
1336
1410
|
// The read commits the new place as the style the glide starts from, so restoring the glide moves nothing.
|
|
1337
1411
|
void card.offsetWidth;
|
|
1338
1412
|
card.style.removeProperty('transition');
|
|
1339
1413
|
}
|
|
1414
|
+
/** The coach takes the card's edge that faces the open page (place.ts coachSide); styles place it by `data-side`. */
|
|
1415
|
+
placeCoachSide() {
|
|
1416
|
+
const k = SIZE_SCALE[this.size];
|
|
1417
|
+
// Measured in the layout it takes on the card's edge — the art shown, the card's width — never the one it
|
|
1418
|
+
// holds now ('over' hides the art), so a window grown back from a phone's size finds it above again. Both
|
|
1419
|
+
// writes land before the next paint: the trial layout is never seen. Hidden, it reads 0: the usual height.
|
|
1420
|
+
const coach = this.e.coach;
|
|
1421
|
+
coach.dataset.side = 'above';
|
|
1422
|
+
const h = coach.offsetHeight || COACH.h;
|
|
1423
|
+
coach.dataset.side = coachSide(this.parked ?? this.dock, this.frame(), { w: COACH.w * k, h: h * k }, COACH.gap * k);
|
|
1424
|
+
}
|
|
1340
1425
|
unpark() {
|
|
1341
1426
|
this.parked = null;
|
|
1342
1427
|
this.parkInsets = null;
|
|
@@ -1368,8 +1453,6 @@ export class ReportWidget {
|
|
|
1368
1453
|
this.e.coach.classList.add('pressing');
|
|
1369
1454
|
}
|
|
1370
1455
|
pointerMove(ev) {
|
|
1371
|
-
if (!this.markers.length)
|
|
1372
|
-
this.placeCoach({ x: ev.clientX, y: ev.clientY }, true);
|
|
1373
1456
|
const d = this.drawing;
|
|
1374
1457
|
if (!d || ev.pointerId !== d.pointer)
|
|
1375
1458
|
return;
|
|
@@ -1441,21 +1524,6 @@ export class ReportWidget {
|
|
|
1441
1524
|
return;
|
|
1442
1525
|
this.e.draft.replaceChildren(...this.shapeNodes({ shape: this.tool, rect: r, head: 'se' }));
|
|
1443
1526
|
}
|
|
1444
|
-
/** The coach rides beside the pointer, inside the viewport. */
|
|
1445
|
-
placeCoach(p, beside) {
|
|
1446
|
-
const vw = globalThis.innerWidth || 800;
|
|
1447
|
-
const vh = globalThis.innerHeight || 600;
|
|
1448
|
-
const w = this.e.coach.offsetWidth || 300;
|
|
1449
|
-
const hgt = this.e.coach.offsetHeight || 140;
|
|
1450
|
-
let x = beside ? p.x + 20 : p.x;
|
|
1451
|
-
let y = beside ? p.y + 20 : p.y;
|
|
1452
|
-
if (x + w > vw - 8)
|
|
1453
|
-
x = beside ? p.x - w - 20 : vw - w - 8;
|
|
1454
|
-
if (y + hgt > vh - 90)
|
|
1455
|
-
y = beside ? p.y - hgt - 20 : vh - hgt - 90;
|
|
1456
|
-
this.e.coach.style.left = `${Math.max(8, x)}px`;
|
|
1457
|
-
this.e.coach.style.top = `${Math.max(8, y)}px`;
|
|
1458
|
-
}
|
|
1459
1527
|
shapeNodes(m) {
|
|
1460
1528
|
const { x, y, w, h: hh } = m.rect;
|
|
1461
1529
|
if (m.shape === 'circle') {
|
|
@@ -1469,7 +1537,7 @@ export class ReportWidget {
|
|
|
1469
1537
|
}
|
|
1470
1538
|
const veil = svgEl('rect', { class: 'veil', x, y, width: w, height: hh, rx: 4 });
|
|
1471
1539
|
const label = svgEl('text', { class: 'veil-label', x: x + w / 2, y: y + hh / 2 + 4, 'text-anchor': 'middle' });
|
|
1472
|
-
label.textContent = w >
|
|
1540
|
+
label.textContent = w > 150 && hh > 20 ? this.s.hidden : '';
|
|
1473
1541
|
return [veil, label];
|
|
1474
1542
|
}
|
|
1475
1543
|
renderMarks() {
|
|
@@ -1806,6 +1874,8 @@ export class ReportWidget {
|
|
|
1806
1874
|
paintSettings() {
|
|
1807
1875
|
const { e, s } = this;
|
|
1808
1876
|
e.sizeLabel.textContent = s.size;
|
|
1877
|
+
e.coachLabel.textContent = s.coachSetting;
|
|
1878
|
+
e.coachSwitch.setAttribute('aria-checked', String(this.coachOn));
|
|
1809
1879
|
for (const [z, btn] of e.sizeButtons) {
|
|
1810
1880
|
btn.textContent = s.sizes[z];
|
|
1811
1881
|
btn.setAttribute('aria-checked', String(this.size === z));
|
|
@@ -1913,7 +1983,8 @@ export class ReportWidget {
|
|
|
1913
1983
|
e.mark.hidden = !this.marking;
|
|
1914
1984
|
e.toolbar.setAttribute('aria-label', s.toolbar);
|
|
1915
1985
|
e.seg.setAttribute('aria-label', s.toolbar);
|
|
1916
|
-
|
|
1986
|
+
// Cover says what it is for the moment it is picked: the one tool that hides instead of points.
|
|
1987
|
+
e.barLead.textContent = this.tool === 'hide' ? s.barLeadHide : s.barLead;
|
|
1917
1988
|
for (const [tool, btn] of e.toolButtons) {
|
|
1918
1989
|
const label = e.toolLabels.get(tool);
|
|
1919
1990
|
if (label)
|
|
@@ -1926,9 +1997,17 @@ export class ReportWidget {
|
|
|
1926
1997
|
e.askText.textContent = s.discardMarks(this.markers.filter((m) => !this.passKeys.has(m.key)).length);
|
|
1927
1998
|
e.discard.textContent = s.discard;
|
|
1928
1999
|
e.keep.textContent = s.keep;
|
|
1929
|
-
e.coach.hidden = !this.marking || this.
|
|
1930
|
-
e.
|
|
2000
|
+
e.coach.hidden = !this.marking || !this.coachOn;
|
|
2001
|
+
if (e.coach.hidden)
|
|
2002
|
+
this.coachShape = null; // shown again, it starts its run from the top
|
|
2003
|
+
else if (this.coachShape !== this.tool) {
|
|
2004
|
+
this.coachShape = this.tool;
|
|
2005
|
+
e.coachArtSlot.replaceChildren(icon(coachArt(this.tool, reducedMotion())));
|
|
2006
|
+
this.placeCoachSide();
|
|
2007
|
+
}
|
|
2008
|
+
e.coachText.textContent = s.coach[this.tool];
|
|
1931
2009
|
e.coachMore.textContent = s.coachMore;
|
|
2010
|
+
e.coachDismiss.textContent = s.coachDismiss;
|
|
1932
2011
|
e.coachKeys.textContent = s.keyboardHint;
|
|
1933
2012
|
e.mark.setAttribute('aria-label', s.marking);
|
|
1934
2013
|
if (this.marking) {
|