@fieldnotes/core 0.56.0 → 0.57.0
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/index.cjs +274 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -35
- package/dist/index.d.ts +147 -35
- package/dist/index.js +270 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -986,6 +986,151 @@ declare class RemotePingOverlay {
|
|
|
986
986
|
private renderPings;
|
|
987
987
|
}
|
|
988
988
|
|
|
989
|
+
interface MeasureToolOptions {
|
|
990
|
+
feetPerCell?: number;
|
|
991
|
+
color?: string;
|
|
992
|
+
}
|
|
993
|
+
interface Measurement {
|
|
994
|
+
start: Point;
|
|
995
|
+
end: Point;
|
|
996
|
+
worldDistance: number;
|
|
997
|
+
cells: number;
|
|
998
|
+
feet: number;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* A raf-coalesced snapshot of the in-progress measurement — the outgoing
|
|
1002
|
+
* side of a shared live ruler. Emissions carry world coordinates, derived
|
|
1003
|
+
* distance, and the tool's current color so a host can forward them as
|
|
1004
|
+
* ephemeral presence without duplicating the tool's input handling.
|
|
1005
|
+
* Ephemeral by contract: presence only — never elements, history, or
|
|
1006
|
+
* persisted state.
|
|
1007
|
+
*/
|
|
1008
|
+
interface MeasureEmission {
|
|
1009
|
+
readonly start: Point;
|
|
1010
|
+
readonly end: Point;
|
|
1011
|
+
readonly worldDistance: number;
|
|
1012
|
+
readonly cells: number;
|
|
1013
|
+
readonly feet: number;
|
|
1014
|
+
readonly color: string;
|
|
1015
|
+
}
|
|
1016
|
+
declare class MeasureTool implements Tool {
|
|
1017
|
+
readonly name = "measure";
|
|
1018
|
+
private start;
|
|
1019
|
+
private end;
|
|
1020
|
+
private gridSize;
|
|
1021
|
+
private gridType;
|
|
1022
|
+
private hexOrientation;
|
|
1023
|
+
private feetPerCell;
|
|
1024
|
+
private color;
|
|
1025
|
+
private optionListeners;
|
|
1026
|
+
private measurementListeners;
|
|
1027
|
+
private emissionRafId;
|
|
1028
|
+
constructor(options?: MeasureToolOptions);
|
|
1029
|
+
getOptions(): MeasureToolOptions;
|
|
1030
|
+
setOptions(options: MeasureToolOptions): void;
|
|
1031
|
+
onOptionsChange(listener: () => void): () => void;
|
|
1032
|
+
/**
|
|
1033
|
+
* Subscribes to raf-coalesced measurement snapshots. While a measurement is
|
|
1034
|
+
* in progress, listeners receive at most one snapshot per animation frame
|
|
1035
|
+
* carrying the latest state; `null` is delivered synchronously when the
|
|
1036
|
+
* measurement clears (pointer-up or deactivate). Emissions are ephemeral by
|
|
1037
|
+
* contract: presence only — never elements, history, or persisted state.
|
|
1038
|
+
*/
|
|
1039
|
+
onMeasurement(listener: (emission: MeasureEmission | null) => void): () => void;
|
|
1040
|
+
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
1041
|
+
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
1042
|
+
onPointerUp(_state: PointerState, ctx: ToolContext): void;
|
|
1043
|
+
onDeactivate(_ctx: ToolContext): void;
|
|
1044
|
+
getMeasurement(): Measurement | null;
|
|
1045
|
+
renderOverlay(ctx: CanvasRenderingContext2D): void;
|
|
1046
|
+
private snapToGrid;
|
|
1047
|
+
private notifyOptionsChange;
|
|
1048
|
+
private scheduleEmission;
|
|
1049
|
+
private emitClear;
|
|
1050
|
+
private emit;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* The wire shape of a shared-ruler presence payload. Presence data is untyped
|
|
1055
|
+
* on the wire, so hosts discriminate on `kind`; `isMeasurePresence` validates
|
|
1056
|
+
* a received payload before it reaches the overlay. Distance is
|
|
1057
|
+
* sender-authoritative: receivers render the payload's `feet`/`cells` and
|
|
1058
|
+
* never recompute from their own grid. Measurements are ephemeral by
|
|
1059
|
+
* contract: presence only — never elements, undo history, persisted canvas
|
|
1060
|
+
* state, or durable operations.
|
|
1061
|
+
*/
|
|
1062
|
+
type MeasurePresence = {
|
|
1063
|
+
readonly kind: 'measure';
|
|
1064
|
+
readonly start: Point;
|
|
1065
|
+
readonly end: Point;
|
|
1066
|
+
readonly cells: number;
|
|
1067
|
+
readonly feet: number;
|
|
1068
|
+
readonly color?: string;
|
|
1069
|
+
} | {
|
|
1070
|
+
readonly kind: 'measure';
|
|
1071
|
+
readonly cleared: true;
|
|
1072
|
+
};
|
|
1073
|
+
declare const MEASURE_PRESENCE_KIND = "measure";
|
|
1074
|
+
declare function isMeasurePresence(data: unknown): data is MeasurePresence;
|
|
1075
|
+
/** Builds the presence payload for one local `MeasureTool` emission. */
|
|
1076
|
+
declare function toMeasurePresence(emission: MeasureEmission | null): MeasurePresence;
|
|
1077
|
+
/** The two viewport capabilities the overlay needs; `Viewport` satisfies it. */
|
|
1078
|
+
interface RemoteMeasureOverlayHost {
|
|
1079
|
+
registerOverlay(draw: OverlayRenderer): () => void;
|
|
1080
|
+
requestRender(): void;
|
|
1081
|
+
}
|
|
1082
|
+
interface RemoteMeasureOverlayOptions {
|
|
1083
|
+
/** Style fallback when a payload omits `color`. Default `'#FF5722'`. */
|
|
1084
|
+
color?: string;
|
|
1085
|
+
/** Full-opacity hold after a cleared payload. Default `1500`. */
|
|
1086
|
+
holdMs?: number;
|
|
1087
|
+
/** Linear fade to 0 after the hold. Default `400`. */
|
|
1088
|
+
fadeMs?: number;
|
|
1089
|
+
/** Stale active entries are treated as cleared after this. Default `30000`. */
|
|
1090
|
+
maxAgeMs?: number;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Renders remote shared-ruler measurements through the viewport overlay
|
|
1094
|
+
* registration, independent of the viewer's active tool. Entries are stamped
|
|
1095
|
+
* with local receive time (remote clocks are never trusted). A cleared
|
|
1096
|
+
* payload holds the final measurement for `holdMs`, fades over `fadeMs`, and
|
|
1097
|
+
* deletes; presence-leave (`remove`) deletes immediately. An active entry not
|
|
1098
|
+
* updated for `maxAgeMs` is expired by a timer — an idle map never renders,
|
|
1099
|
+
* so expiry cannot ride on the draw path. The overlay never touches elements,
|
|
1100
|
+
* history, or persisted state, and never moves the viewer's camera.
|
|
1101
|
+
*/
|
|
1102
|
+
declare class RemoteMeasureOverlay {
|
|
1103
|
+
private readonly host;
|
|
1104
|
+
private readonly color;
|
|
1105
|
+
private readonly holdMs;
|
|
1106
|
+
private readonly fadeMs;
|
|
1107
|
+
private readonly maxAgeMs;
|
|
1108
|
+
private readonly measurements;
|
|
1109
|
+
private unregister;
|
|
1110
|
+
private rafId;
|
|
1111
|
+
private disposed;
|
|
1112
|
+
constructor(host: RemoteMeasureOverlayHost, options?: RemoteMeasureOverlayOptions);
|
|
1113
|
+
private now;
|
|
1114
|
+
/**
|
|
1115
|
+
* Applies a presence payload from `sender` (any opaque per-sender key, e.g.
|
|
1116
|
+
* the envelope `from`). Non-measure or malformed payloads are ignored and
|
|
1117
|
+
* reported as `false`, so hosts can feed every presence frame through.
|
|
1118
|
+
*/
|
|
1119
|
+
apply(sender: string, data: unknown): boolean;
|
|
1120
|
+
/** Removes a sender's ruler immediately (presence-leave/disconnect). */
|
|
1121
|
+
remove(sender: string): void;
|
|
1122
|
+
/** Removes every ruler immediately. */
|
|
1123
|
+
clear(): void;
|
|
1124
|
+
/** Number of senders with a visible (active or lingering) ruler. */
|
|
1125
|
+
get activeSenderCount(): number;
|
|
1126
|
+
/** Unregisters the overlay, cancels timers, stops animating. Idempotent. */
|
|
1127
|
+
dispose(): void;
|
|
1128
|
+
private beginLinger;
|
|
1129
|
+
private ensureAnimating;
|
|
1130
|
+
private tick;
|
|
1131
|
+
private renderMeasurements;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
989
1134
|
/**
|
|
990
1135
|
* The one camera capability `PingInput` needs; `Camera` satisfies it. Screen
|
|
991
1136
|
* coordinates are element-local (the same space `Camera.screenToWorld`
|
|
@@ -1460,39 +1605,6 @@ declare class ShapeTool implements Tool {
|
|
|
1460
1605
|
private onKeyUp;
|
|
1461
1606
|
}
|
|
1462
1607
|
|
|
1463
|
-
interface MeasureToolOptions {
|
|
1464
|
-
feetPerCell?: number;
|
|
1465
|
-
}
|
|
1466
|
-
interface Measurement {
|
|
1467
|
-
start: Point;
|
|
1468
|
-
end: Point;
|
|
1469
|
-
worldDistance: number;
|
|
1470
|
-
cells: number;
|
|
1471
|
-
feet: number;
|
|
1472
|
-
}
|
|
1473
|
-
declare class MeasureTool implements Tool {
|
|
1474
|
-
readonly name = "measure";
|
|
1475
|
-
private start;
|
|
1476
|
-
private end;
|
|
1477
|
-
private gridSize;
|
|
1478
|
-
private gridType;
|
|
1479
|
-
private hexOrientation;
|
|
1480
|
-
private feetPerCell;
|
|
1481
|
-
private optionListeners;
|
|
1482
|
-
constructor(options?: MeasureToolOptions);
|
|
1483
|
-
getOptions(): MeasureToolOptions;
|
|
1484
|
-
setOptions(options: MeasureToolOptions): void;
|
|
1485
|
-
onOptionsChange(listener: () => void): () => void;
|
|
1486
|
-
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
1487
|
-
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
1488
|
-
onPointerUp(_state: PointerState, ctx: ToolContext): void;
|
|
1489
|
-
onDeactivate(_ctx: ToolContext): void;
|
|
1490
|
-
getMeasurement(): Measurement | null;
|
|
1491
|
-
renderOverlay(ctx: CanvasRenderingContext2D): void;
|
|
1492
|
-
private snapToGrid;
|
|
1493
|
-
private notifyOptionsChange;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
1608
|
interface TemplateToolOptions {
|
|
1497
1609
|
templateShape?: TemplateShape;
|
|
1498
1610
|
fillColor?: string;
|
|
@@ -1538,6 +1650,6 @@ declare class TemplateTool implements Tool {
|
|
|
1538
1650
|
private notifyOptionsChange;
|
|
1539
1651
|
}
|
|
1540
1652
|
|
|
1541
|
-
declare const VERSION = "0.
|
|
1653
|
+
declare const VERSION = "0.57.0";
|
|
1542
1654
|
|
|
1543
|
-
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PING_PRESENCE_KIND, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isLaserTrailPresence, isNearBezier, isPingPresence, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toLaserTrailPresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
|
1655
|
+
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MEASURE_PRESENCE_KIND, type MeasureEmission, type MeasurePresence, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PING_PRESENCE_KIND, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemoteMeasureOverlay, type RemoteMeasureOverlayHost, type RemoteMeasureOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPingPresence, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toLaserTrailPresence, toMeasurePresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.d.ts
CHANGED
|
@@ -986,6 +986,151 @@ declare class RemotePingOverlay {
|
|
|
986
986
|
private renderPings;
|
|
987
987
|
}
|
|
988
988
|
|
|
989
|
+
interface MeasureToolOptions {
|
|
990
|
+
feetPerCell?: number;
|
|
991
|
+
color?: string;
|
|
992
|
+
}
|
|
993
|
+
interface Measurement {
|
|
994
|
+
start: Point;
|
|
995
|
+
end: Point;
|
|
996
|
+
worldDistance: number;
|
|
997
|
+
cells: number;
|
|
998
|
+
feet: number;
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* A raf-coalesced snapshot of the in-progress measurement — the outgoing
|
|
1002
|
+
* side of a shared live ruler. Emissions carry world coordinates, derived
|
|
1003
|
+
* distance, and the tool's current color so a host can forward them as
|
|
1004
|
+
* ephemeral presence without duplicating the tool's input handling.
|
|
1005
|
+
* Ephemeral by contract: presence only — never elements, history, or
|
|
1006
|
+
* persisted state.
|
|
1007
|
+
*/
|
|
1008
|
+
interface MeasureEmission {
|
|
1009
|
+
readonly start: Point;
|
|
1010
|
+
readonly end: Point;
|
|
1011
|
+
readonly worldDistance: number;
|
|
1012
|
+
readonly cells: number;
|
|
1013
|
+
readonly feet: number;
|
|
1014
|
+
readonly color: string;
|
|
1015
|
+
}
|
|
1016
|
+
declare class MeasureTool implements Tool {
|
|
1017
|
+
readonly name = "measure";
|
|
1018
|
+
private start;
|
|
1019
|
+
private end;
|
|
1020
|
+
private gridSize;
|
|
1021
|
+
private gridType;
|
|
1022
|
+
private hexOrientation;
|
|
1023
|
+
private feetPerCell;
|
|
1024
|
+
private color;
|
|
1025
|
+
private optionListeners;
|
|
1026
|
+
private measurementListeners;
|
|
1027
|
+
private emissionRafId;
|
|
1028
|
+
constructor(options?: MeasureToolOptions);
|
|
1029
|
+
getOptions(): MeasureToolOptions;
|
|
1030
|
+
setOptions(options: MeasureToolOptions): void;
|
|
1031
|
+
onOptionsChange(listener: () => void): () => void;
|
|
1032
|
+
/**
|
|
1033
|
+
* Subscribes to raf-coalesced measurement snapshots. While a measurement is
|
|
1034
|
+
* in progress, listeners receive at most one snapshot per animation frame
|
|
1035
|
+
* carrying the latest state; `null` is delivered synchronously when the
|
|
1036
|
+
* measurement clears (pointer-up or deactivate). Emissions are ephemeral by
|
|
1037
|
+
* contract: presence only — never elements, history, or persisted state.
|
|
1038
|
+
*/
|
|
1039
|
+
onMeasurement(listener: (emission: MeasureEmission | null) => void): () => void;
|
|
1040
|
+
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
1041
|
+
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
1042
|
+
onPointerUp(_state: PointerState, ctx: ToolContext): void;
|
|
1043
|
+
onDeactivate(_ctx: ToolContext): void;
|
|
1044
|
+
getMeasurement(): Measurement | null;
|
|
1045
|
+
renderOverlay(ctx: CanvasRenderingContext2D): void;
|
|
1046
|
+
private snapToGrid;
|
|
1047
|
+
private notifyOptionsChange;
|
|
1048
|
+
private scheduleEmission;
|
|
1049
|
+
private emitClear;
|
|
1050
|
+
private emit;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* The wire shape of a shared-ruler presence payload. Presence data is untyped
|
|
1055
|
+
* on the wire, so hosts discriminate on `kind`; `isMeasurePresence` validates
|
|
1056
|
+
* a received payload before it reaches the overlay. Distance is
|
|
1057
|
+
* sender-authoritative: receivers render the payload's `feet`/`cells` and
|
|
1058
|
+
* never recompute from their own grid. Measurements are ephemeral by
|
|
1059
|
+
* contract: presence only — never elements, undo history, persisted canvas
|
|
1060
|
+
* state, or durable operations.
|
|
1061
|
+
*/
|
|
1062
|
+
type MeasurePresence = {
|
|
1063
|
+
readonly kind: 'measure';
|
|
1064
|
+
readonly start: Point;
|
|
1065
|
+
readonly end: Point;
|
|
1066
|
+
readonly cells: number;
|
|
1067
|
+
readonly feet: number;
|
|
1068
|
+
readonly color?: string;
|
|
1069
|
+
} | {
|
|
1070
|
+
readonly kind: 'measure';
|
|
1071
|
+
readonly cleared: true;
|
|
1072
|
+
};
|
|
1073
|
+
declare const MEASURE_PRESENCE_KIND = "measure";
|
|
1074
|
+
declare function isMeasurePresence(data: unknown): data is MeasurePresence;
|
|
1075
|
+
/** Builds the presence payload for one local `MeasureTool` emission. */
|
|
1076
|
+
declare function toMeasurePresence(emission: MeasureEmission | null): MeasurePresence;
|
|
1077
|
+
/** The two viewport capabilities the overlay needs; `Viewport` satisfies it. */
|
|
1078
|
+
interface RemoteMeasureOverlayHost {
|
|
1079
|
+
registerOverlay(draw: OverlayRenderer): () => void;
|
|
1080
|
+
requestRender(): void;
|
|
1081
|
+
}
|
|
1082
|
+
interface RemoteMeasureOverlayOptions {
|
|
1083
|
+
/** Style fallback when a payload omits `color`. Default `'#FF5722'`. */
|
|
1084
|
+
color?: string;
|
|
1085
|
+
/** Full-opacity hold after a cleared payload. Default `1500`. */
|
|
1086
|
+
holdMs?: number;
|
|
1087
|
+
/** Linear fade to 0 after the hold. Default `400`. */
|
|
1088
|
+
fadeMs?: number;
|
|
1089
|
+
/** Stale active entries are treated as cleared after this. Default `30000`. */
|
|
1090
|
+
maxAgeMs?: number;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Renders remote shared-ruler measurements through the viewport overlay
|
|
1094
|
+
* registration, independent of the viewer's active tool. Entries are stamped
|
|
1095
|
+
* with local receive time (remote clocks are never trusted). A cleared
|
|
1096
|
+
* payload holds the final measurement for `holdMs`, fades over `fadeMs`, and
|
|
1097
|
+
* deletes; presence-leave (`remove`) deletes immediately. An active entry not
|
|
1098
|
+
* updated for `maxAgeMs` is expired by a timer — an idle map never renders,
|
|
1099
|
+
* so expiry cannot ride on the draw path. The overlay never touches elements,
|
|
1100
|
+
* history, or persisted state, and never moves the viewer's camera.
|
|
1101
|
+
*/
|
|
1102
|
+
declare class RemoteMeasureOverlay {
|
|
1103
|
+
private readonly host;
|
|
1104
|
+
private readonly color;
|
|
1105
|
+
private readonly holdMs;
|
|
1106
|
+
private readonly fadeMs;
|
|
1107
|
+
private readonly maxAgeMs;
|
|
1108
|
+
private readonly measurements;
|
|
1109
|
+
private unregister;
|
|
1110
|
+
private rafId;
|
|
1111
|
+
private disposed;
|
|
1112
|
+
constructor(host: RemoteMeasureOverlayHost, options?: RemoteMeasureOverlayOptions);
|
|
1113
|
+
private now;
|
|
1114
|
+
/**
|
|
1115
|
+
* Applies a presence payload from `sender` (any opaque per-sender key, e.g.
|
|
1116
|
+
* the envelope `from`). Non-measure or malformed payloads are ignored and
|
|
1117
|
+
* reported as `false`, so hosts can feed every presence frame through.
|
|
1118
|
+
*/
|
|
1119
|
+
apply(sender: string, data: unknown): boolean;
|
|
1120
|
+
/** Removes a sender's ruler immediately (presence-leave/disconnect). */
|
|
1121
|
+
remove(sender: string): void;
|
|
1122
|
+
/** Removes every ruler immediately. */
|
|
1123
|
+
clear(): void;
|
|
1124
|
+
/** Number of senders with a visible (active or lingering) ruler. */
|
|
1125
|
+
get activeSenderCount(): number;
|
|
1126
|
+
/** Unregisters the overlay, cancels timers, stops animating. Idempotent. */
|
|
1127
|
+
dispose(): void;
|
|
1128
|
+
private beginLinger;
|
|
1129
|
+
private ensureAnimating;
|
|
1130
|
+
private tick;
|
|
1131
|
+
private renderMeasurements;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
989
1134
|
/**
|
|
990
1135
|
* The one camera capability `PingInput` needs; `Camera` satisfies it. Screen
|
|
991
1136
|
* coordinates are element-local (the same space `Camera.screenToWorld`
|
|
@@ -1460,39 +1605,6 @@ declare class ShapeTool implements Tool {
|
|
|
1460
1605
|
private onKeyUp;
|
|
1461
1606
|
}
|
|
1462
1607
|
|
|
1463
|
-
interface MeasureToolOptions {
|
|
1464
|
-
feetPerCell?: number;
|
|
1465
|
-
}
|
|
1466
|
-
interface Measurement {
|
|
1467
|
-
start: Point;
|
|
1468
|
-
end: Point;
|
|
1469
|
-
worldDistance: number;
|
|
1470
|
-
cells: number;
|
|
1471
|
-
feet: number;
|
|
1472
|
-
}
|
|
1473
|
-
declare class MeasureTool implements Tool {
|
|
1474
|
-
readonly name = "measure";
|
|
1475
|
-
private start;
|
|
1476
|
-
private end;
|
|
1477
|
-
private gridSize;
|
|
1478
|
-
private gridType;
|
|
1479
|
-
private hexOrientation;
|
|
1480
|
-
private feetPerCell;
|
|
1481
|
-
private optionListeners;
|
|
1482
|
-
constructor(options?: MeasureToolOptions);
|
|
1483
|
-
getOptions(): MeasureToolOptions;
|
|
1484
|
-
setOptions(options: MeasureToolOptions): void;
|
|
1485
|
-
onOptionsChange(listener: () => void): () => void;
|
|
1486
|
-
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
1487
|
-
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
1488
|
-
onPointerUp(_state: PointerState, ctx: ToolContext): void;
|
|
1489
|
-
onDeactivate(_ctx: ToolContext): void;
|
|
1490
|
-
getMeasurement(): Measurement | null;
|
|
1491
|
-
renderOverlay(ctx: CanvasRenderingContext2D): void;
|
|
1492
|
-
private snapToGrid;
|
|
1493
|
-
private notifyOptionsChange;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
1608
|
interface TemplateToolOptions {
|
|
1497
1609
|
templateShape?: TemplateShape;
|
|
1498
1610
|
fillColor?: string;
|
|
@@ -1538,6 +1650,6 @@ declare class TemplateTool implements Tool {
|
|
|
1538
1650
|
private notifyOptionsChange;
|
|
1539
1651
|
}
|
|
1540
1652
|
|
|
1541
|
-
declare const VERSION = "0.
|
|
1653
|
+
declare const VERSION = "0.57.0";
|
|
1542
1654
|
|
|
1543
|
-
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PING_PRESENCE_KIND, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isLaserTrailPresence, isNearBezier, isPingPresence, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toLaserTrailPresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
|
1655
|
+
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MEASURE_PRESENCE_KIND, type MeasureEmission, type MeasurePresence, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PING_PRESENCE_KIND, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemoteMeasureOverlay, type RemoteMeasureOverlayHost, type RemoteMeasureOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPingPresence, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toLaserTrailPresence, toMeasurePresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|