@fieldnotes/core 0.31.0 → 0.31.1
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/README.md +1 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -711,6 +711,7 @@ declare class PencilTool implements Tool {
|
|
|
711
711
|
}
|
|
712
712
|
|
|
713
713
|
interface EraserToolOptions {
|
|
714
|
+
/** Eraser radius in SCREEN pixels (matches the cursor circle; converted to world units per zoom). */
|
|
714
715
|
radius?: number;
|
|
715
716
|
mode?: 'partial' | 'stroke';
|
|
716
717
|
}
|
|
@@ -972,6 +973,6 @@ declare class TemplateTool implements Tool {
|
|
|
972
973
|
private notifyOptionsChange;
|
|
973
974
|
}
|
|
974
975
|
|
|
975
|
-
declare const VERSION = "0.31.
|
|
976
|
+
declare const VERSION = "0.31.1";
|
|
976
977
|
|
|
977
978
|
export { type ActiveFormats, type ArrowElement, 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, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, 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, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.d.ts
CHANGED
|
@@ -711,6 +711,7 @@ declare class PencilTool implements Tool {
|
|
|
711
711
|
}
|
|
712
712
|
|
|
713
713
|
interface EraserToolOptions {
|
|
714
|
+
/** Eraser radius in SCREEN pixels (matches the cursor circle; converted to world units per zoom). */
|
|
714
715
|
radius?: number;
|
|
715
716
|
mode?: 'partial' | 'stroke';
|
|
716
717
|
}
|
|
@@ -972,6 +973,6 @@ declare class TemplateTool implements Tool {
|
|
|
972
973
|
private notifyOptionsChange;
|
|
973
974
|
}
|
|
974
975
|
|
|
975
|
-
declare const VERSION = "0.31.
|
|
976
|
+
declare const VERSION = "0.31.1";
|
|
976
977
|
|
|
977
978
|
export { type ActiveFormats, type ArrowElement, 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, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, 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, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.js
CHANGED
|
@@ -6376,11 +6376,12 @@ var EraserTool = class {
|
|
|
6376
6376
|
}
|
|
6377
6377
|
eraseAt(state, ctx) {
|
|
6378
6378
|
const world = ctx.camera.screenToWorld({ x: state.x, y: state.y });
|
|
6379
|
+
const worldRadius = this.radius / ctx.camera.zoom;
|
|
6379
6380
|
const queryBounds = {
|
|
6380
|
-
x: world.x -
|
|
6381
|
-
y: world.y -
|
|
6382
|
-
w:
|
|
6383
|
-
h:
|
|
6381
|
+
x: world.x - worldRadius,
|
|
6382
|
+
y: world.y - worldRadius,
|
|
6383
|
+
w: worldRadius * 2,
|
|
6384
|
+
h: worldRadius * 2
|
|
6384
6385
|
};
|
|
6385
6386
|
const candidates = ctx.store.queryRect(queryBounds);
|
|
6386
6387
|
let erased = false;
|
|
@@ -6388,14 +6389,14 @@ var EraserTool = class {
|
|
|
6388
6389
|
if (el.type !== "stroke") continue;
|
|
6389
6390
|
if (ctx.isLayerVisible && !ctx.isLayerVisible(el.layerId)) continue;
|
|
6390
6391
|
if (ctx.isLayerLocked && ctx.isLayerLocked(el.layerId)) continue;
|
|
6391
|
-
if (!this.strokeIntersects(el, world)) continue;
|
|
6392
|
+
if (!this.strokeIntersects(el, world, worldRadius)) continue;
|
|
6392
6393
|
if (this.mode === "stroke") {
|
|
6393
6394
|
ctx.store.remove(el.id);
|
|
6394
6395
|
erased = true;
|
|
6395
6396
|
continue;
|
|
6396
6397
|
}
|
|
6397
6398
|
const localEraser = { x: world.x - el.position.x, y: world.y - el.position.y };
|
|
6398
|
-
const runs = erasePoints(el.points, localEraser,
|
|
6399
|
+
const runs = erasePoints(el.points, localEraser, worldRadius);
|
|
6399
6400
|
if (runs === null) continue;
|
|
6400
6401
|
ctx.store.remove(el.id);
|
|
6401
6402
|
for (const run of runs) {
|
|
@@ -6415,8 +6416,8 @@ var EraserTool = class {
|
|
|
6415
6416
|
}
|
|
6416
6417
|
if (erased) ctx.requestRender();
|
|
6417
6418
|
}
|
|
6418
|
-
strokeIntersects(stroke, point) {
|
|
6419
|
-
return hitTestStroke(stroke, point,
|
|
6419
|
+
strokeIntersects(stroke, point, worldRadius) {
|
|
6420
|
+
return hitTestStroke(stroke, point, worldRadius);
|
|
6420
6421
|
}
|
|
6421
6422
|
};
|
|
6422
6423
|
|
|
@@ -8023,7 +8024,7 @@ var TemplateTool = class {
|
|
|
8023
8024
|
};
|
|
8024
8025
|
|
|
8025
8026
|
// src/index.ts
|
|
8026
|
-
var VERSION = "0.31.
|
|
8027
|
+
var VERSION = "0.31.1";
|
|
8027
8028
|
export {
|
|
8028
8029
|
ArrowTool,
|
|
8029
8030
|
AutoSave,
|