fix(editor): message line lifecycle, own row, sound no-shift check
Task 3 review, fix round 1. - The gesture message closes for good on any document or history change (store subscription): undo then redo no longer revives it. - Hover and focus hold only the message they were taken on: after « Défaire » the next message expires. - An accepted drop clears the strip's refusal hint again. - Controller ruling: the message has its own fixed row under the add buttons, column width; a refused gesture's full text also shows in the strip notice (red, aria-hidden copy of the row's alert). - expectNoShift: native requestAnimationFrame kept before page.clock (keepNativeFrames), every part box asserted non-null, message row measured; the e2e checks the message is not truncated. No assertion removed; the refused-drop unit test gains the strip copy.
This commit is contained in:
1 parent
1deb037fac
commit
7a45f1d885
9 files changed
+198
-49
No files matched your search
@@ -14,6 +14,7 @@ import { usePlacement } from '@/editor/annotations/usePlacement'
|
||||
import { stripLeadOf } from '@/editor/annotations/stripLead'
|
||||
import {
|
||||
useGestureMessage,
|
||||
type GestureMessage as ShownMessage,
|
||||
type GestureMessages,
|
||||
} from '@/editor/annotations/useGestureMessage'
|
||||
import {
|
||||
@@ -152,7 +153,7 @@ export default function EditableAnnotations(props: Props) {
|
||||
)
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<SceneStrip scene={scene} placement={placement} />
|
||||
<SceneStrip scene={scene} placement={placement} message={message} />
|
||||
<div className="grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]">
|
||||
<CanvasColumn
|
||||
scene={scene}
|
||||
@@ -336,13 +337,15 @@ function overlayOf(
|
||||
function SceneStrip({
|
||||
scene,
|
||||
placement,
|
||||
message,
|
||||
}: {
|
||||
scene: Scene
|
||||
placement: Placement
|
||||
message: GestureMessages
|
||||
}) {
|
||||
const t = useT()
|
||||
const locale = useLocaleStore((s) => s.locale)
|
||||
const notice = useStripNotice(scene)
|
||||
const notice = useStripNotice(scene, message.message)
|
||||
const { ui, selected, doc } = scene
|
||||
return (
|
||||
<EditStrip
|
||||
@@ -362,14 +365,21 @@ function SceneStrip({
|
||||
}
|
||||
|
||||
/**
|
||||
* The strip's middle, first match wins: a refusal, the selection's geometry issues (the
|
||||
* first, then « +n »), then why a tool cannot be used now.
|
||||
* The strip's middle, first match wins: a refusal (the strip's own, then a refused gesture
|
||||
* whose line under the drawing may be cut short: its full text here, A6), the selection's
|
||||
* geometry issues (the first, then « +n »), then why a tool cannot be used now.
|
||||
*/
|
||||
function useStripNotice(scene: Scene): StripNotice | null {
|
||||
function useStripNotice(
|
||||
scene: Scene,
|
||||
message: ShownMessage | null,
|
||||
): StripNotice | null {
|
||||
const t = useT()
|
||||
const issues = useGeometryIssues(scene.selected?.id ?? '')
|
||||
const { ui, model, doc } = scene
|
||||
if (ui.hint) return { tone: 'error', text: ui.hint }
|
||||
if (message?.tone === 'error') {
|
||||
return { tone: 'error', text: message.text, quiet: true }
|
||||
}
|
||||
if (scene.selected && issues.length > 0) {
|
||||
return { tone: 'error', text: issues[0]!, more: issues.length - 1 }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user