fix(editor): guard keeps pending series, mode end said, R-9 hook
- guardDrawing commits a keyboard or size series the focus still holds (its blur) and ends only the mode: a pending series is never dropped. - A started move ended by a selection change is said (R-13). - handleSize: no module-level state; useHandleSizes reads the device once per handle layer. The layer reads ResizeObserver contentRect. - Dead kind check removed in SelectionPointCommands; long lines wrapped (code, doc). - e2e: the zoom check waits for the transform to change; the move-mode arrow clicks are under expectNoShift.
This commit is contained in:
1 parent
e01d8519ea
commit
463e0a2621
11 files changed
+155
-38
No files matched your search
@@ -459,7 +459,13 @@ test.describe('editor annotations (A3)', () => {
|
|||||||
const right = button(page, 'editor.annotations.move.right')
|
const right = button(page, 'editor.annotations.move.right')
|
||||||
await expect(right).toBeVisible()
|
await expect(right).toBeVisible()
|
||||||
await expectAccessible(page, 'the move mode')
|
await expectAccessible(page, 'the move mode')
|
||||||
|
await expectNoShift(
|
||||||
|
page,
|
||||||
|
async () => {
|
||||||
for (let step = 0; step < 3; step++) await right.click()
|
for (let step = 0; step < 3; step++) await right.click()
|
||||||
|
},
|
||||||
|
swaps,
|
||||||
|
)
|
||||||
await expect(cx).toHaveValue(String(x0))
|
await expect(cx).toHaveValue(String(x0))
|
||||||
await expectNoShift(
|
await expectNoShift(
|
||||||
page,
|
page,
|
||||||
@@ -488,13 +494,20 @@ test.describe('editor annotations (A3)', () => {
|
|||||||
const fit = (await hit.boundingBox())!
|
const fit = (await hit.boundingBox())!
|
||||||
// R-9: a 10 px hit radius with a mouse (Chromium desktop has a fine pointer).
|
// R-9: a 10 px hit radius with a mouse (Chromium desktop has a fine pointer).
|
||||||
expect(Math.abs(fit.width - 20)).toBeLessThan(2)
|
expect(Math.abs(fit.width - 20)).toBeLessThan(2)
|
||||||
|
// The drawing's own scale: the measure below waits for the zoom to land.
|
||||||
|
const transform = () =>
|
||||||
|
page
|
||||||
|
.getByTestId('annotation-canvas')
|
||||||
|
.evaluate(
|
||||||
|
(box) => (box.firstElementChild as HTMLElement).style.transform,
|
||||||
|
)
|
||||||
|
const before = await transform()
|
||||||
await page
|
await page
|
||||||
.getByRole('button', { name: dict['catalogue.zoom.in'] })
|
.getByRole('button', { name: dict['catalogue.zoom.in'] })
|
||||||
.click()
|
.click()
|
||||||
await expect
|
await expect.poll(transform).not.toBe(before)
|
||||||
.poll(async () => Math.round((await hit.boundingBox())!.width))
|
const zoomed = (await hit.boundingBox())!
|
||||||
.toBeLessThan(22)
|
expect(Math.abs(zoomed.width - 20)).toBeLessThan(2)
|
||||||
expect(Math.abs((await hit.boundingBox())!.width - 20)).toBeLessThan(2)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('the editor keeps a stable scrollbar gutter; the dashboard does not', async ({
|
test('the editor keeps a stable scrollbar gutter; the dashboard does not', async ({
|
||||||
|
|||||||
@@ -173,7 +173,11 @@ type Work = ReturnType<typeof useWork>
|
|||||||
function useModeFollowsSelection(selectedId: string | null) {
|
function useModeFollowsSelection(selectedId: string | null) {
|
||||||
const modeId = useAnnotationWork((s) => s.mode?.annotationId ?? null)
|
const modeId = useAnnotationWork((s) => s.mode?.annotationId ?? null)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (modeId !== null && modeId !== selectedId) endMode()
|
if (modeId === null || modeId === selectedId) return
|
||||||
|
const { mode } = useAnnotationWork.getState()
|
||||||
|
endMode()
|
||||||
|
// Never silent (R-13): a started move that ends this way is said.
|
||||||
|
if (mode?.started) useAnnotationWork.setState({ dropped: mode.kind })
|
||||||
}, [modeId, selectedId])
|
}, [modeId, selectedId])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ import {
|
|||||||
} from 'react'
|
} from 'react'
|
||||||
import type { Geometry } from '@faunosteo/core-wasm/types'
|
import type { Geometry } from '@faunosteo/core-wasm/types'
|
||||||
import { parseFrame } from '@/editor/annotations/frame'
|
import { parseFrame } from '@/editor/annotations/frame'
|
||||||
import { handleSizes } from '@/editor/annotations/handleSize'
|
import {
|
||||||
|
useHandleSizes,
|
||||||
|
type HandleSizes,
|
||||||
|
} from '@/editor/annotations/handleSize'
|
||||||
import { useAnnotationWork } from '@/editor/annotations/workStore'
|
import { useAnnotationWork } from '@/editor/annotations/workStore'
|
||||||
|
|
||||||
/** The selected point (or link circle) whose handle the layer draws. */
|
/** The selected point (or link circle) whose handle the layer draws. */
|
||||||
@@ -40,7 +43,10 @@ function useBoxSize(svg: RefObject<SVGSVGElement | null>) {
|
|||||||
setSize({ w: element.clientWidth || 0, h: element.clientHeight || 0 })
|
setSize({ w: element.clientWidth || 0, h: element.clientHeight || 0 })
|
||||||
read()
|
read()
|
||||||
if (typeof ResizeObserver === 'undefined') return
|
if (typeof ResizeObserver === 'undefined') return
|
||||||
const observer = new ResizeObserver(read)
|
const observer = new ResizeObserver(([entry]) => {
|
||||||
|
const box = entry?.contentRect
|
||||||
|
if (box) setSize({ w: box.width, h: box.height })
|
||||||
|
})
|
||||||
observer.observe(element)
|
observer.observe(element)
|
||||||
return () => observer.disconnect()
|
return () => observer.disconnect()
|
||||||
}, [svg])
|
}, [svg])
|
||||||
@@ -72,6 +78,7 @@ function unitsPerPx(
|
|||||||
export default function HandleLayer(props: HandleLayerProps) {
|
export default function HandleLayer(props: HandleLayerProps) {
|
||||||
const svg = useRef<SVGSVGElement | null>(null)
|
const svg = useRef<SVGSVGElement | null>(null)
|
||||||
const unit = unitsPerPx(props.viewBox, useBoxSize(svg), props.scale)
|
const unit = unitsPerPx(props.viewBox, useBoxSize(svg), props.scale)
|
||||||
|
const sizes = useHandleSizes()
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
ref={svg}
|
ref={svg}
|
||||||
@@ -81,7 +88,12 @@ export default function HandleLayer(props: HandleLayerProps) {
|
|||||||
className="pointer-events-none absolute inset-0 h-full w-full overflow-visible"
|
className="pointer-events-none absolute inset-0 h-full w-full overflow-visible"
|
||||||
>
|
>
|
||||||
{props.handle && (
|
{props.handle && (
|
||||||
<PointHandleShape {...props} handle={props.handle} unit={unit} />
|
<PointHandleShape
|
||||||
|
{...props}
|
||||||
|
handle={props.handle}
|
||||||
|
sizes={sizes}
|
||||||
|
unit={unit}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
@@ -92,19 +104,26 @@ function PointHandleShape({
|
|||||||
unit,
|
unit,
|
||||||
onKeyDown,
|
onKeyDown,
|
||||||
onBlur,
|
onBlur,
|
||||||
}: HandleLayerProps & { handle: PointHandle; unit: number }) {
|
sizes,
|
||||||
|
}: HandleLayerProps & {
|
||||||
|
handle: PointHandle
|
||||||
|
unit: number
|
||||||
|
sizes: HandleSizes
|
||||||
|
}) {
|
||||||
const preview = useAnnotationWork((s) =>
|
const preview = useAnnotationWork((s) =>
|
||||||
s.preview?.annotationId === handle.annotationId ? s.preview.geometry : null,
|
s.preview?.annotationId === handle.annotationId ? s.preview.geometry : null,
|
||||||
)
|
)
|
||||||
const shown = preview ?? handle.stored
|
const shown = preview ?? handle.stored
|
||||||
if (shown.type !== 'circle') return null
|
if (shown.type !== 'circle') return null
|
||||||
const r = Math.max(shown.r, handleSizes().hit * unit)
|
const r = Math.max(shown.r, sizes.hit * unit)
|
||||||
return (
|
return (
|
||||||
<g
|
<g
|
||||||
role="button"
|
role="button"
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-label={handle.label}
|
aria-label={handle.label}
|
||||||
data-testid="point-handle"
|
data-testid="point-handle"
|
||||||
|
// Its arrow series commits on blur; the drawing guard blurs it before leaving.
|
||||||
|
data-series=""
|
||||||
className="group outline-none"
|
className="group outline-none"
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export function SelectionPointCommands(props: SelectionPointProps) {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{annotation.kind === 'point' && <SelectionSize {...props} />}
|
<SelectionSize {...props} />
|
||||||
<Button
|
<Button
|
||||||
// R-12: the focus comes back here when the mode ends (useMoveFocusReturn).
|
// R-12: the focus comes back here when the mode ends (useMoveFocusReturn).
|
||||||
data-move-entry=""
|
data-move-entry=""
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export default function SizeSlider(props: SizeSliderProps) {
|
|||||||
ref={input}
|
ref={input}
|
||||||
id={id}
|
id={id}
|
||||||
type="range"
|
type="range"
|
||||||
|
data-series=""
|
||||||
min={range.low}
|
min={range.low}
|
||||||
max={range.high}
|
max={range.high}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ function drawingFocus(): void {
|
|||||||
* Deselecting: `id` is the RESOLVED selection (never the raw id, which can name a removed
|
* Deselecting: `id` is the RESOLVED selection (never the raw id, which can name a removed
|
||||||
* annotation). The button always moves the focus to the row; Escape does when it was
|
* annotation). The button always moves the focus to the row; Escape does when it was
|
||||||
* pressed inside the properties panel, or when the focused element left with the selection
|
* pressed inside the properties panel, or when the focused element left with the selection
|
||||||
* (the handle, the slider, « Déplacer le point »). Anywhere else the focus stays where it is. Both answer whether something was deselected.
|
* (the handle, the slider, « Déplacer le point »). Anywhere else the focus stays where it
|
||||||
|
* is. Both answer whether something was deselected.
|
||||||
*/
|
*/
|
||||||
export function useDeselect(id: string | null, clear: () => void) {
|
export function useDeselect(id: string | null, clear: () => void) {
|
||||||
const t = useT()
|
const t = useT()
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
import { endMode, guardWork, useAnnotationWork } from './workStore'
|
import { endMode, guardWork, useAnnotationWork } from './workStore'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A keyboard series or a size change still pending (no blur yet: a mouse Back button)
|
||||||
|
* commits now, through its own blur (BDR-050): leaving never drops it.
|
||||||
|
*/
|
||||||
|
function commitFocusedSeries(): void {
|
||||||
|
const { preview } = useAnnotationWork.getState()
|
||||||
|
if (!preview || preview.source === 'move') return
|
||||||
|
const active = document.activeElement
|
||||||
|
const series = active instanceof HTMLElement || active instanceof SVGElement
|
||||||
|
if (series && active.closest('[data-series]')) active.blur()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** An unstarted mode ends; a pending series that is not the mode's stays. */
|
||||||
|
function endModeOnly(): void {
|
||||||
|
useAnnotationWork.setState((work) => ({
|
||||||
|
mode: null,
|
||||||
|
preview: work.preview?.source === 'move' ? null : work.preview,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The drawing guard (R-12), asked by every navigation that would drop the drawing's work:
|
* The drawing guard (R-12), asked by every navigation that would drop the drawing's work:
|
||||||
* a tab, a section, « Aller à », a view chip, a tool, Back, leaving the editor. Nothing
|
* a tab, a section, « Aller à », a view chip, a tool, Back, leaving the editor. Nothing
|
||||||
@@ -10,7 +30,8 @@ import { endMode, guardWork, useAnnotationWork } from './workStore'
|
|||||||
export function guardDrawing(proceed: () => void): boolean {
|
export function guardDrawing(proceed: () => void): boolean {
|
||||||
const work = guardWork(useAnnotationWork.getState())
|
const work = guardWork(useAnnotationWork.getState())
|
||||||
if (work === null) {
|
if (work === null) {
|
||||||
endMode()
|
commitFocusedSeries()
|
||||||
|
endModeOnly()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
useAnnotationWork.setState({ question: { work, proceed } })
|
useAnnotationWork.setState({ question: { work, proceed } })
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ function clampAxis(value: number, low: number, high: number): number {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Candidate C: radius r0 (the wanted `radius`, fitted to F), the centre clamped per axis
|
* Candidate C: radius r0 (the wanted `radius`, fitted to F), the centre clamped per axis
|
||||||
* into [x + r0, x + w − r0] and [y + r0, y + h − r0], rounded inward to 0.01. When that rounding leaves an empty
|
* into [x + r0, x + w − r0] and [y + r0, y + h − r0], rounded inward to 0.01. When that
|
||||||
* interval (r0 = min(w, h) / 2 with an origin off the grid) the exact clamped value is
|
* rounding leaves an empty interval (r0 = min(w, h) / 2 with an origin off the grid) the
|
||||||
* used: the core accepts any decimals.
|
* exact clamped value is used: the core accepts any decimals.
|
||||||
*/
|
*/
|
||||||
export function correctedCircle(
|
export function correctedCircle(
|
||||||
frame: Frame,
|
frame: Frame,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
/** R-9: handle sizes in CSS px, constant under zoom. */
|
/** R-9: handle sizes in CSS px, constant under zoom. */
|
||||||
export interface HandleSizes {
|
export interface HandleSizes {
|
||||||
vertex: number
|
vertex: number
|
||||||
@@ -9,18 +11,19 @@ export interface HandleSizes {
|
|||||||
const FINE: HandleSizes = { vertex: 12, insert: 16, hit: 10 }
|
const FINE: HandleSizes = { vertex: 12, insert: 16, hit: 10 }
|
||||||
const COARSE: HandleSizes = { vertex: 18, insert: 24, hit: 22 }
|
const COARSE: HandleSizes = { vertex: 18, insert: 24, hit: 22 }
|
||||||
|
|
||||||
let device: HandleSizes | null = null
|
function deviceSizes(): HandleSizes {
|
||||||
|
|
||||||
/**
|
|
||||||
* The device's sizes, read ONCE from `(any-pointer: coarse)` (R-9): a hybrid device keeps
|
|
||||||
* the size it started with, so no handle is re-created under the finger.
|
|
||||||
*/
|
|
||||||
export function handleSizes(): HandleSizes {
|
|
||||||
if (device === null) {
|
|
||||||
const coarse =
|
const coarse =
|
||||||
typeof window.matchMedia === 'function' &&
|
typeof window.matchMedia === 'function' &&
|
||||||
window.matchMedia('(any-pointer: coarse)').matches
|
window.matchMedia('(any-pointer: coarse)').matches
|
||||||
device = coarse ? COARSE : FINE
|
return coarse ? COARSE : FINE
|
||||||
}
|
}
|
||||||
return device
|
|
||||||
|
/**
|
||||||
|
* The device's sizes, read ONCE per handle layer from `(any-pointer: coarse)` (R-9): a
|
||||||
|
* hybrid device keeps the size the layer started with, so no handle is re-created under
|
||||||
|
* the finger.
|
||||||
|
*/
|
||||||
|
export function useHandleSizes(): HandleSizes {
|
||||||
|
const [sizes] = useState(deviceSizes)
|
||||||
|
return sizes
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ import userEvent from '@testing-library/user-event'
|
|||||||
import type { Annotation } from '@faunosteo/core-wasm/types'
|
import type { Annotation } from '@faunosteo/core-wasm/types'
|
||||||
import AnnotationsTab from '@/components/editor/tabs/AnnotationsTab'
|
import AnnotationsTab from '@/components/editor/tabs/AnnotationsTab'
|
||||||
import { useAnnotationWork, resetWork } from '@/editor/annotations/workStore'
|
import { useAnnotationWork, resetWork } from '@/editor/annotations/workStore'
|
||||||
|
import { guardDrawing } from '@/editor/annotations/drawingGuard'
|
||||||
import { useLocaleStore } from '@/state/localeStore'
|
import { useLocaleStore } from '@/state/localeStore'
|
||||||
import { useUndoShortcuts } from '@/editor/useUndoShortcuts'
|
import { useUndoShortcuts } from '@/editor/useUndoShortcuts'
|
||||||
import {
|
import {
|
||||||
@@ -479,7 +480,7 @@ describe('review fixes: no silent loss, no empty commit, no lost focus', () => {
|
|||||||
}
|
}
|
||||||
const question = () => useAnnotationWork.getState().question?.work ?? null
|
const question = () => useAnnotationWork.getState().question?.work ?? null
|
||||||
|
|
||||||
it('« Tout afficher », a tool and « Ajouter un point » ask before a started move goes', async () => {
|
it('« Toutes les annotations », a tool and « Ajouter un point » ask first', async () => {
|
||||||
await started()
|
await started()
|
||||||
const panel = screen.getByTestId('annotation-properties')
|
const panel = screen.getByTestId('annotation-properties')
|
||||||
fireEvent.click(
|
fireEvent.click(
|
||||||
@@ -520,7 +521,7 @@ describe('review fixes: no silent loss, no empty commit, no lost focus', () => {
|
|||||||
expect(message()).not.toHaveTextContent('Défaire')
|
expect(message()).not.toHaveTextContent('Défaire')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Escape that deselects from the handle or the slider keeps the focus on the page', async () => {
|
it('Escape deselecting from the handle or the slider keeps a focus', async () => {
|
||||||
await mount(two())
|
await mount(two())
|
||||||
await select()
|
await select()
|
||||||
handle().focus()
|
handle().focus()
|
||||||
@@ -567,7 +568,7 @@ describe('A5 through the Point tool click', () => {
|
|||||||
point('c', 60, 60, 9),
|
point('c', 60, 60, 9),
|
||||||
)
|
)
|
||||||
|
|
||||||
it('a click places the point at the most used size, or at the size the slider chose', async () => {
|
it('a click places the point at the most used size', async () => {
|
||||||
await mount(sized())
|
await mount(sized())
|
||||||
const user = userEvent.setup()
|
const user = userEvent.setup()
|
||||||
await user.click(screen.getByRole('button', { name: 'Point' }))
|
await user.click(screen.getByRole('button', { name: 'Point' }))
|
||||||
@@ -586,3 +587,55 @@ describe('A5 through the Point tool click', () => {
|
|||||||
expect(within(panel).getByLabelText('Rayon')).toHaveValue('9')
|
expect(within(panel).getByLabelText('Rayon')).toHaveValue('9')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('fix round 1: no silent loss on the way out', () => {
|
||||||
|
const two = () => withPoints(point('a', 50, 50, 5), point('b', 20, 20, 5))
|
||||||
|
|
||||||
|
it('a guarded navigation commits a keyboard series the handle still holds', async () => {
|
||||||
|
await mount(two())
|
||||||
|
await select()
|
||||||
|
const before = depth()
|
||||||
|
handle().focus()
|
||||||
|
fireEvent.keyDown(handle(), { key: 'ArrowRight' })
|
||||||
|
act(() => void guardDrawing(() => undefined))
|
||||||
|
expect(geometryOf('a')).toMatchObject({ cx: 50.5 })
|
||||||
|
expect(depth()).toBe(before + 1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('a pending size the focus already left is kept, not dropped', async () => {
|
||||||
|
await mount(two())
|
||||||
|
await select()
|
||||||
|
fireEvent.change(slider(), { target: { value: '7' } })
|
||||||
|
screen.getByTestId('annotation-canvas').focus()
|
||||||
|
act(() => void guardDrawing(() => undefined))
|
||||||
|
expect(useAnnotationWork.getState().preview).toMatchObject({
|
||||||
|
source: 'size',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('a started move ended by a selection change is said, never silent', async () => {
|
||||||
|
await mount(two())
|
||||||
|
await select()
|
||||||
|
await userEvent.setup().click(moveButton())
|
||||||
|
fireEvent.click(arrow('la droite'))
|
||||||
|
const mode = useAnnotationWork.getState().mode!
|
||||||
|
act(() =>
|
||||||
|
useAnnotationWork.setState({ mode: { ...mode, annotationId: 'b' } }),
|
||||||
|
)
|
||||||
|
expect(useAnnotationWork.getState().mode).toBeNull()
|
||||||
|
expect(
|
||||||
|
await screen.findByText('Déplacement abandonné : la fiche a changé.'),
|
||||||
|
).toBeInTheDocument()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('a view chip asks before a started move goes', async () => {
|
||||||
|
await mount(withLink(two(), 'l'))
|
||||||
|
await select()
|
||||||
|
await userEvent.setup().click(moveButton())
|
||||||
|
fireEvent.click(arrow('la droite'))
|
||||||
|
const views = screen.getByRole('group', { name: 'Vues' })
|
||||||
|
fireEvent.click(within(views).getByRole('button', { name: 'Tête' }))
|
||||||
|
expect(useAnnotationWork.getState().question?.work).toBe('move')
|
||||||
|
expect(screen.getByTestId('move-mode-bar')).toBeInTheDocument()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -149,8 +149,9 @@ annotation: the markers stay the core's (`view.canvas`) and the drawing is never
|
|||||||
modified. The overlay holds numbers only, drawn from the editor's state: the
|
modified. The overlay holds numbers only, drawn from the editor's state: the
|
||||||
selection outline (dashed), the vertex circles, the tracing in progress, the
|
selection outline (dashed), the vertex circles, the tracing in progress, the
|
||||||
pending or dragged outline, the hollow cross of a corrected position and the
|
pending or dragged outline, the hollow cross of a corrected position and the
|
||||||
crop rectangle. It is `aria-hidden` and never takes the pointer. It sets `pointer-events: none` on its own shapes; the pointer
|
crop rectangle. It is `aria-hidden` and never takes the pointer. It sets
|
||||||
is read on the canvas box and mapped to drawing units through the overlay's
|
`pointer-events: none` on its own shapes; the pointer is read on the canvas
|
||||||
|
box and mapped to drawing units through the overlay's
|
||||||
`getScreenCTM().inverse()`. No overlay shape carries `data-anno-id`, so click
|
`getScreenCTM().inverse()`. No overlay shape carries `data-anno-id`, so click
|
||||||
targeting still reads the core's markers only.
|
targeting still reads the core's markers only.
|
||||||
|
|
||||||
@@ -158,13 +159,14 @@ Handles live in a third `<svg>` of their own (the handle layer), above the
|
|||||||
overlay in the same transformed container, with the same `viewBox` and
|
overlay in the same transformed container, with the same `viewBox` and
|
||||||
`preserveAspectRatio`. It is not `aria-hidden`: each handle is a focusable
|
`preserveAspectRatio`. It is not `aria-hidden`: each handle is a focusable
|
||||||
`role="button"` (`tabindex="0"`) named after what it moves (« Point {nom} » for
|
`role="button"` (`tabindex="0"`) named after what it moves (« Point {nom} » for
|
||||||
a point), with a visible focus ring. The layer's root sets
|
a point, « Accès {nom} » for a link circle), with a visible focus ring. The
|
||||||
`pointer-events: none`; each handle's hit shape turns it back on
|
layer's root sets `pointer-events: none`; each handle's hit shape turns it
|
||||||
(`pointer-events: auto`, painted shapes only) with a transparent fill and carries `data-handle` (the JSON of its handle
|
back on (`pointer-events: auto`, painted shapes only) with a transparent fill
|
||||||
reference), which the press machine reads through `elementsFromPoint`. Handle
|
and carries `data-handle` (the JSON of its handle reference), which the press
|
||||||
sizes are constant in CSS px under zoom: the layer divides them by the drawing's
|
machine reads through `elementsFromPoint`. Handle sizes are constant in CSS px
|
||||||
px per unit (the box size over the frame, times the zoom). The device size is
|
under zoom: the layer divides them by the drawing's px per unit (the box size
|
||||||
read once from `(any-pointer: coarse)`:
|
over the frame, times the zoom). The device size is read once per handle layer
|
||||||
|
from `(any-pointer: coarse)`:
|
||||||
|
|
||||||
| Device | Vertex | « + » | « − » bubble | Hit radius |
|
| Device | Vertex | « + » | « − » bubble | Hit radius |
|
||||||
|---|---|---|---|---|
|
|---|---|---|---|---|
|
||||||
|
|||||||
Reference in new issue
Block a user