@reekon-tools/boldr-utils 1.6.26 → 1.6.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/annotation/canvas/AnnotationCanvasSkia.js +6 -2
- package/dist/annotation/canvas/measurementGeometry.js +2 -3
- package/dist/annotation/canvas/stampLayout.d.ts +1 -2
- package/dist/annotation/canvas/stampLayout.js +21 -30
- package/dist/exports.d.ts +1 -1
- package/dist/exports.js +1 -1
- package/package.json +1 -1
|
@@ -11,8 +11,12 @@ import { StrokeElement } from './elements/StrokeElement.js';
|
|
|
11
11
|
// is a fixed-size overlay; only the line lives in Skia). Width is in doc units,
|
|
12
12
|
// so it scales with zoom like the drawn line/arrow shapes. These are fallbacks:
|
|
13
13
|
// a placed annotation may override them via `lineColor`/`lineWidth`/`lineCap`.
|
|
14
|
+
// The leader line defaults to the medium width preset so it reads clearly
|
|
15
|
+
// against the document; the rectangle border stays thinner (it outlines a
|
|
16
|
+
// region rather than pointing at one).
|
|
14
17
|
const MEASUREMENT_LINE_COLOR = '#0066FF';
|
|
15
|
-
const MEASUREMENT_LINE_WIDTH =
|
|
18
|
+
const MEASUREMENT_LINE_WIDTH = 6;
|
|
19
|
+
const MEASUREMENT_RECT_WIDTH = 2;
|
|
16
20
|
// Endpoint handle color — constant selection chrome, independent of the (now
|
|
17
21
|
// editable) line color so the handles stay legible on any line color.
|
|
18
22
|
const MEASUREMENT_HANDLE_COLOR = '#0066FF';
|
|
@@ -134,7 +138,7 @@ export const AnnotationCanvasSkia = ({ width, height, effectiveCanvas, worldTran
|
|
|
134
138
|
const isSelected = placed.id === selectedId;
|
|
135
139
|
const isRectDrag = placed.id === rectDragId;
|
|
136
140
|
const rectColor = placed.lineColor ?? MEASUREMENT_LINE_COLOR;
|
|
137
|
-
const rectWidth = placed.lineWidth ??
|
|
141
|
+
const rectWidth = placed.lineWidth ?? MEASUREMENT_RECT_WIDTH;
|
|
138
142
|
if (isRectDrag && liveRect) {
|
|
139
143
|
return (_jsx(Rect, { x: liveRect.x, y: liveRect.y, width: liveRect.width, height: liveRect.height, color: rectColor, style: "stroke", strokeWidth: rectWidth, children: placed.lineDash && (_jsx(DashPathEffect, { intervals: dashIntervals(rectWidth) })) }, placed.id));
|
|
140
144
|
}
|
|
@@ -114,9 +114,8 @@ export const hitPlacedMeasurement = (m, p, zoom = 1, tileScaleFactor = 1, viewpo
|
|
|
114
114
|
// The stamp renders as a constant *screen*-size square centered on the
|
|
115
115
|
// anchor, so its doc-space footprint shrinks as you zoom in. Convert the
|
|
116
116
|
// screen-space half-extent (+ padding) back to doc space via the zoom so
|
|
117
|
-
// the hit box always matches what's drawn
|
|
118
|
-
//
|
|
119
|
-
// folds in scale + the associated/blank size so the hit box matches the draw.
|
|
117
|
+
// the hit box always matches what's drawn (blank and populated stamps share
|
|
118
|
+
// the footprint — see stampLayout).
|
|
120
119
|
const half = (stampTileSize(m, tileScaleFactor, viewportScale) / 2 + STAMP_HIT_PADDING) /
|
|
121
120
|
zoom;
|
|
122
121
|
const dx = Math.abs(p.x - m.anchor.x);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { PlacedMeasurementRef } from '../../types/annotation.js';
|
|
2
2
|
export declare const STAMP_TILE_SIZE = 96;
|
|
3
|
-
export declare const STAMP_INPUT_TILE_SIZE = 44;
|
|
4
3
|
export declare const DEFAULT_TILE_SCALE = 1;
|
|
5
4
|
export declare const TILE_SCALE_MIN = 0.4;
|
|
6
5
|
export declare const TILE_SCALE_MAX = 2;
|
|
7
6
|
export declare const clampTileScale: (v: number) => number;
|
|
8
7
|
export declare const isUnassociatedStamp: (m: Pick<PlacedMeasurementRef, "measurementId" | "measurementPath" | "columnId">) => boolean;
|
|
9
|
-
export declare const stampTileSize: (m: Pick<PlacedMeasurementRef, "
|
|
8
|
+
export declare const stampTileSize: (m: Pick<PlacedMeasurementRef, "scale">, tileScaleFactor?: number, viewportScale?: number) => number;
|
|
@@ -3,20 +3,15 @@
|
|
|
3
3
|
// overlay — see measurementStampOverlay.ts) and the hit-test (selectTool,
|
|
4
4
|
// measurementGeometry) can import it without dragging
|
|
5
5
|
// @shopify/react-native-skia into the consumer's static import graph.
|
|
6
|
-
// Constant SCREEN-space edge length of a placed measurement
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
6
|
+
// Constant SCREEN-space edge length of a placed measurement, rendered as a
|
|
7
|
+
// square tile. The tile is a fixed-size pin: its on-screen size is this times
|
|
8
|
+
// `placed.scale` and does NOT change with zoom (only its position tracks the
|
|
9
|
+
// canvas). Also drives the select-tool hit box, which converts it back to doc
|
|
10
|
+
// space via the zoom. Blank "+" input placeholders take the SAME footprint as
|
|
11
|
+
// populated tiles: earlier builds gave them a compact 44px size, but then a
|
|
12
|
+
// user who set the tile-scale slider against blank tiles saw their tiles
|
|
13
|
+
// balloon once populated (Asana 1216233394800417).
|
|
11
14
|
export const STAMP_TILE_SIZE = 96;
|
|
12
|
-
// Edge length for an UNASSOCIATED stamp — a measurement annotation with no
|
|
13
|
-
// measurement picked yet, which renders as a compact "+" input placeholder
|
|
14
|
-
// rather than a full readable tile. Kept noticeably smaller than
|
|
15
|
-
// STAMP_TILE_SIZE so empty inputs read as lightweight tap targets that don't
|
|
16
|
-
// crowd the drawing; associated tiles keep STAMP_TILE_SIZE so existing saved
|
|
17
|
-
// annotations are visually unchanged. Still comfortably tappable once the
|
|
18
|
-
// viewport/tile-scale multipliers (min 1) are folded in. The single knob for #6.
|
|
19
|
-
export const STAMP_INPUT_TILE_SIZE = 44;
|
|
20
15
|
// Document-wide tile scale factor (AnnotationCanvasState.tileScaleFactor): one
|
|
21
16
|
// knob that shrinks/grows EVERY measurement tile on the canvas at once, on top
|
|
22
17
|
// of each tile's own `scale`. Lets a user pull tiles down on a dense drawing
|
|
@@ -50,21 +45,17 @@ export const clampTileScale = (v) => v < TILE_SCALE_MIN ? TILE_SCALE_MIN : v > T
|
|
|
50
45
|
// now always 1.
|
|
51
46
|
// A placed measurement is an unassociated input until a measurement reference
|
|
52
47
|
// is attached (id or path) OR it is bound to a form column (`columnId`). Such
|
|
53
|
-
// stamps
|
|
54
|
-
//
|
|
55
|
-
// full STAMP_TILE_SIZE like an associated tile — only the truly blank "+"
|
|
56
|
-
// placeholder uses the compact input size.
|
|
48
|
+
// stamps render as the blank "+" placeholder (same footprint as a populated
|
|
49
|
+
// tile — see STAMP_TILE_SIZE).
|
|
57
50
|
export const isUnassociatedStamp = (m) => !m.measurementId && !m.measurementPath && !m.columnId;
|
|
58
|
-
// Screen-space edge length for a placed stamp: the
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
// truth for tile footprint — render overlay,
|
|
62
|
-
// classification all call this so the drawn tile and
|
|
63
|
-
// `tileScaleFactor` is the document-wide knob
|
|
64
|
-
// `AnnotationCanvasState.tileScaleFactor`, driven by the
|
|
65
|
-
// `viewportScale` is retained for call compatibility and
|
|
66
|
-
// per-canvas multiplier was retired (see the note
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
tileScaleFactor *
|
|
70
|
-
viewportScale;
|
|
51
|
+
// Screen-space edge length for a placed stamp: the base size scaled by the
|
|
52
|
+
// per-stamp `scale` and the document-wide `tileScaleFactor`. Blank and
|
|
53
|
+
// populated stamps share the footprint so a tile never resizes when it gains a
|
|
54
|
+
// value. The ONE source of truth for tile footprint — render overlay,
|
|
55
|
+
// hit-test, and slide-grab classification all call this so the drawn tile and
|
|
56
|
+
// its touch box always agree. `tileScaleFactor` is the document-wide knob
|
|
57
|
+
// (default 1, from `AnnotationCanvasState.tileScaleFactor`, driven by the
|
|
58
|
+
// "Tile size" slider). `viewportScale` is retained for call compatibility and
|
|
59
|
+
// is always 1 — the old per-canvas multiplier was retired (see the note
|
|
60
|
+
// above). Independent of zoom.
|
|
61
|
+
export const stampTileSize = (m, tileScaleFactor = DEFAULT_TILE_SCALE, viewportScale = 1) => STAMP_TILE_SIZE * (m.scale ?? 1) * tileScaleFactor * viewportScale;
|
package/dist/exports.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type { GestureConfig, PanTrigger, AnnotationCanvasInnerProps, } from './a
|
|
|
22
22
|
export type { CanvasPointerEvent, RequestTextInput, ShapeDrawConfig, Tool, ToolContext, ToolState, } from './annotation/canvas/Tool.js';
|
|
23
23
|
export type { MeasurementRef, PickMeasurement, } from './annotation/canvas/measurementPicker.js';
|
|
24
24
|
export type { MeasurementStampRenderArgs, RenderMeasurementStamp, } from './annotation/canvas/measurementStampOverlay.js';
|
|
25
|
-
export { STAMP_TILE_SIZE,
|
|
25
|
+
export { STAMP_TILE_SIZE, DEFAULT_TILE_SCALE, TILE_SCALE_MIN, TILE_SCALE_MAX, clampTileScale, stampTileSize, isUnassociatedStamp, } from './annotation/canvas/stampLayout.js';
|
|
26
26
|
export { createViewportApi, fitToScreen, fitRectToScreen, imageDocRect, panBy, zoomAt, DEFAULT_VIEWPORT, type ViewportApi, type ViewportState, } from './annotation/canvas/viewport.js';
|
|
27
27
|
export { createPenTool, type PenToolOptions, } from './annotation/canvas/tools/penTool.js';
|
|
28
28
|
export { createSelectTool } from './annotation/canvas/tools/selectTool.js';
|
package/dist/exports.js
CHANGED
|
@@ -22,7 +22,7 @@ export { useAnnotationMutations, } from './annotation/data/hooks/useAnnotationMu
|
|
|
22
22
|
export { useAnnotationCanvasDoc, } from './annotation/data/hooks/useAnnotationCanvasDoc.js';
|
|
23
23
|
export { hydrateCanvasState } from './annotation/data/canvasPersistence.js';
|
|
24
24
|
export { InMemoryAnnotationProvider } from './annotation/data/InMemoryAnnotationProvider.js';
|
|
25
|
-
export { STAMP_TILE_SIZE,
|
|
25
|
+
export { STAMP_TILE_SIZE, DEFAULT_TILE_SCALE, TILE_SCALE_MIN, TILE_SCALE_MAX, clampTileScale, stampTileSize, isUnassociatedStamp, } from './annotation/canvas/stampLayout.js';
|
|
26
26
|
export { createViewportApi, fitToScreen, fitRectToScreen, imageDocRect, panBy, zoomAt, DEFAULT_VIEWPORT, } from './annotation/canvas/viewport.js';
|
|
27
27
|
export { createPenTool, } from './annotation/canvas/tools/penTool.js';
|
|
28
28
|
export { createSelectTool } from './annotation/canvas/tools/selectTool.js';
|