test(editor): V1-2.6 browser journeys on the sandbox, touch drag and findings fixes

This commit is contained in:
bchanot committed 2026-11-04 15:27:35 +01:00
1 parent 7bbd096a16
commit 5097fd7484
18 files changed
+3010 -8

No files matched your search

@@ -68,13 +68,18 @@ function clickHandler(input: GestureInput, framing: Framing) {
}
}
/** `touch-action: none` only while a drawing tool, a drag or a zoom is active. */
/**
* `touch-action: none` while a drawing tool, a drag, a zoom or a movable selection is
* active: the browser reads it at touchstart, so a touch drag of the selected marker
* would otherwise be taken as a pan and cancelled before the drag is armed.
*/
function touchStyle(
tool: ToolId,
armed: boolean,
scale: number,
movable: boolean,
): CSSProperties {
const none = tool !== 'select' || armed || scale !== 1
const none = tool !== 'select' || armed || scale !== 1 || movable
return { touchAction: none ? 'none' : 'pan-x pan-y' }
}
@@ -103,7 +108,12 @@ export function useCanvasGestures(input: GestureInput) {
...composedPointer(framing, move),
onKeyDown,
onClick: clickHandler(input, framing),
style: touchStyle(input.tool, move.armed, framing.framing.scale),
style: touchStyle(
input.tool,
move.armed,
framing.framing.scale,
input.moveTarget !== null,
),
},
}
}
+26 -1
View File
@@ -157,9 +157,34 @@ function categoryItems(zone: FindingZone, zoneItemId: string): FindingItem[] {
})
}
// shortcut: the serde defaults of the core's FindingNode and FindingCategory (schema.rs),
// applied here because the page reads the stored text and the equine import omits them
// (a node without `children` or `reference_ids` blanked the Constats tab). Upgrade path:
// the loader hands the page the core's canonical document and this goes away.
const filledNode = (node: FindingNode): FindingNode => ({
...node,
description: node.description ?? {},
requires_vet_referral: node.requires_vet_referral ?? false,
reference_ids: node.reference_ids ?? [],
review_status: node.review_status ?? 'inherited',
children: (node.children ?? []).map(filledNode),
})
const filledCategory = (category: FindingCategory): FindingCategory => ({
...category,
description: category.description ?? {},
reference_ids: category.reference_ids ?? [],
review_status: category.review_status ?? 'inherited',
children: (category.children ?? []).map(filledNode),
})
/** Every element of the findings tree in document order, collapsed or not. */
export function buildItems(doc: AnatomicalSheetDocument): FindingItem[] {
return doc.finding_zones.flatMap((zone, index) => {
return doc.finding_zones.flatMap((stored, index) => {
const zone: FindingZone = {
...stored,
categories: (stored.categories ?? []).map(filledCategory),
}
const id = itemId(zone.id, [])
const self: FindingItem = {
id,