feat(app): a click on the drawing deselects (R1, D6b)
The decision comes from the press (landed off a marker, moved <= 4 px, one pointer), not the click target: mouse and pen act at pointerup, touch in the tap's own click. The reader passes no onEmpty and is unchanged. No existing assertion rewritten.
This commit is contained in:
1 parent
bbb1668406
commit
bbdfd27311
9 files changed
+586
-21
No files matched your search
@@ -133,14 +133,18 @@ export default function EditableAnnotations(props: Props) {
|
||||
const placement = usePlacement({ ...scene, context })
|
||||
const { ui, selected } = scene
|
||||
const visible = usePlaceVisible()
|
||||
const asideRef = useSelectionEscape(
|
||||
const { asideRef, byDrawing } = useSelectionEscape(
|
||||
selected?.id ?? null,
|
||||
() => scene.dispatch({ type: 'select', id: null }),
|
||||
visible && selected !== undefined && ui.tracing === null && !ui.pending,
|
||||
)
|
||||
return (
|
||||
<div className="grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]">
|
||||
<CanvasColumn scene={scene} placement={placement} />
|
||||
<CanvasColumn
|
||||
scene={scene}
|
||||
placement={placement}
|
||||
onDeselect={byDrawing}
|
||||
/>
|
||||
<aside ref={asideRef}>
|
||||
<SidePanel scene={scene} context={context} />
|
||||
</aside>
|
||||
@@ -153,9 +157,11 @@ type Placement = ReturnType<typeof usePlacement>
|
||||
function CanvasColumn({
|
||||
scene,
|
||||
placement,
|
||||
onDeselect,
|
||||
}: {
|
||||
scene: Scene
|
||||
placement: Placement
|
||||
onDeselect: () => void
|
||||
}) {
|
||||
const { doc, ui, dispatch, model, selected } = scene
|
||||
const noCategory = doc.categories.length === 0
|
||||
@@ -175,7 +181,11 @@ function CanvasColumn({
|
||||
navigate={scene.navigate}
|
||||
/>
|
||||
{selected && <TagOf annotation={selected} doc={doc} />}
|
||||
<CanvasStage scene={scene} placement={placement} />
|
||||
<CanvasStage
|
||||
scene={scene}
|
||||
placement={placement}
|
||||
onDeselect={onDeselect}
|
||||
/>
|
||||
{ui.tracing && (
|
||||
<TracingBar
|
||||
count={ui.tracing.points.length}
|
||||
@@ -211,9 +221,11 @@ function TagOf({
|
||||
function CanvasStage({
|
||||
scene,
|
||||
placement,
|
||||
onDeselect,
|
||||
}: {
|
||||
scene: Scene
|
||||
placement: Placement
|
||||
onDeselect: () => void
|
||||
}) {
|
||||
const locale = useLocaleStore((s) => s.locale)
|
||||
// Hidden (the editor is read-only): no drag in flight survives, none is committed.
|
||||
@@ -240,6 +252,7 @@ function CanvasStage({
|
||||
onSelect={(id) => dispatch({ type: 'select', id })}
|
||||
onPlace={placement.onPlace}
|
||||
onDrop={placement.onDrop}
|
||||
onDeselect={onDeselect}
|
||||
onTraceKey={placement.onTraceKey}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user