web: gated access, anchored viewers, mobile tabs and chat colour
- serve.mjs requires a signed session cookie for every page, artifact and the WebSocket, with a password file, 30-day sessions, login throttling and public brand assets for the sign-in page. - The diff viewer is a fixed-height top-anchored panel whose toolbar (modes, copy, previous, next, close as icons) is its first row; the artifact viewer is likewise a fixed frame so its navigation never moves. - The audit's selected tab uses the app's normal selected surface and bottom accent. Sessions that were not recorded say so plainly. - Chat code blocks are syntax-coloured; graph pinch-zoom works with two fingers while a single pointer still pans and clicks nodes. - Phones always keep the destination bar (pane collapse is wide-only), with the destinations spread evenly and Search on the right; the list default width is narrower; the theme colour matches the app. - Code-format and layout tests, plus the full browser suite, pass.
This commit is contained in:
@@ -1357,9 +1357,33 @@ export function mount(container, graph, options = {}) {
|
||||
let pointerId = null;
|
||||
let dragOrigin = null;
|
||||
let lastPoint = null;
|
||||
const pointers = new Map();
|
||||
let pinch = null;
|
||||
|
||||
function onPointerDown(event) {
|
||||
if (event.button !== 0) return;
|
||||
// No pointer capture: capturing retargeted the following click to the
|
||||
// viewport and swallowed node taps. A pinch that leaves the canvas simply
|
||||
// stops updating until the fingers return.
|
||||
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
||||
if (pointers.size === 2) {
|
||||
const [a, b] = [...pointers.values()];
|
||||
const rect = viewport.getBoundingClientRect();
|
||||
pinch = {
|
||||
distance: Math.hypot(a.x - b.x, a.y - b.y),
|
||||
scale: state.scale,
|
||||
lastCentroid: {
|
||||
x: (a.x + b.x) / 2 - rect.left,
|
||||
y: (a.y + b.y) / 2 - rect.top,
|
||||
},
|
||||
};
|
||||
dragged = true;
|
||||
pointerId = null;
|
||||
dragOrigin = null;
|
||||
lastPoint = null;
|
||||
return;
|
||||
}
|
||||
if (pointers.size > 2) return;
|
||||
dragged = false;
|
||||
pointerId = event.pointerId;
|
||||
dragOrigin = { x: event.clientX, y: event.clientY };
|
||||
@@ -1367,6 +1391,44 @@ export function mount(container, graph, options = {}) {
|
||||
}
|
||||
|
||||
function onPointerMove(event) {
|
||||
if (pointers.has(event.pointerId)) {
|
||||
pointers.set(event.pointerId, { x: event.clientX, y: event.clientY });
|
||||
}
|
||||
if (pointers.size >= 2 && pinch) {
|
||||
const [a, b] = [...pointers.values()];
|
||||
const distance = Math.hypot(a.x - b.x, a.y - b.y);
|
||||
if (pinch.distance <= 0 || distance <= 0) return;
|
||||
const rect = viewport.getBoundingClientRect();
|
||||
const centroid = {
|
||||
x: (a.x + b.x) / 2 - rect.left,
|
||||
y: (a.y + b.y) / 2 - rect.top,
|
||||
};
|
||||
const target = Math.min(
|
||||
Math.max(pinch.scale * (distance / pinch.distance), MIN_SCALE),
|
||||
MAX_SCALE,
|
||||
);
|
||||
const zoomed = zoomAbout(
|
||||
state.offset,
|
||||
state.scale,
|
||||
centroid,
|
||||
target / state.scale,
|
||||
MIN_SCALE,
|
||||
MAX_SCALE,
|
||||
);
|
||||
const dx = centroid.x - pinch.lastCentroid.x;
|
||||
const dy = centroid.y - pinch.lastCentroid.y;
|
||||
state.scale = zoomed.scale;
|
||||
state.offset = clampOffset(
|
||||
{ x: zoomed.offset.x + dx, y: zoomed.offset.y + dy },
|
||||
scaledContent(),
|
||||
viewportSize(),
|
||||
MIN_VISIBLE,
|
||||
);
|
||||
pinch.lastCentroid = centroid;
|
||||
state.userAdjusted = true;
|
||||
applyTransform();
|
||||
return;
|
||||
}
|
||||
if (pointerId === null || event.pointerId !== pointerId || !lastPoint) return;
|
||||
if (!dragged) {
|
||||
const moved =
|
||||
@@ -1388,10 +1450,19 @@ export function mount(container, graph, options = {}) {
|
||||
}
|
||||
|
||||
function onPointerUp(event) {
|
||||
pointers.delete(event.pointerId);
|
||||
if (pointers.size < 2) pinch = null;
|
||||
if (pointerId !== null && event.pointerId !== pointerId) return;
|
||||
pointerId = null;
|
||||
dragOrigin = null;
|
||||
lastPoint = null;
|
||||
// After a pinch, continue with the finger still down as a pan.
|
||||
if (pointers.size === 1) {
|
||||
const [id, point] = [...pointers.entries()][0];
|
||||
pointerId = id;
|
||||
dragOrigin = { ...point };
|
||||
lastPoint = { ...point };
|
||||
}
|
||||
}
|
||||
|
||||
function onWheel(event) {
|
||||
|
||||
Reference in New Issue
Block a user