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
+157
-40
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { useState } from 'react'
|
||||
|
||||
/** R-9: handle sizes in CSS px, constant under zoom. */
|
||||
export interface HandleSizes {
|
||||
vertex: number
|
||||
@@ -9,18 +11,19 @@ export interface HandleSizes {
|
||||
const FINE: HandleSizes = { vertex: 12, insert: 16, hit: 10 }
|
||||
const COARSE: HandleSizes = { vertex: 18, insert: 24, hit: 22 }
|
||||
|
||||
let device: HandleSizes | null = null
|
||||
function deviceSizes(): HandleSizes {
|
||||
const coarse =
|
||||
typeof window.matchMedia === 'function' &&
|
||||
window.matchMedia('(any-pointer: coarse)').matches
|
||||
return coarse ? COARSE : FINE
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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 handleSizes(): HandleSizes {
|
||||
if (device === null) {
|
||||
const coarse =
|
||||
typeof window.matchMedia === 'function' &&
|
||||
window.matchMedia('(any-pointer: coarse)').matches
|
||||
device = coarse ? COARSE : FINE
|
||||
}
|
||||
return device
|
||||
export function useHandleSizes(): HandleSizes {
|
||||
const [sizes] = useState(deviceSizes)
|
||||
return sizes
|
||||
}
|
||||
Reference in new issue
Block a user