@yorab/react-paint 0.9.3 → 0.10.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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/components/App.d.ts +1 -1
  3. package/dist/components/Canvas.d.ts +10 -5
  4. package/dist/components/settings/SettingsBar.d.ts +3 -3
  5. package/dist/components/toolbox/EditTextBox.d.ts +3 -2
  6. package/dist/constants/app.d.ts +18 -1
  7. package/dist/hooks/useDrawableCanvas.d.ts +8 -11
  8. package/dist/hooks/useKeyboard.d.ts +3 -5
  9. package/dist/hooks/useShapes.d.ts +8 -6
  10. package/dist/react-paint.css +1 -1
  11. package/dist/react-paint.js +1106 -1003
  12. package/dist/react-paint.umd.cjs +1 -1
  13. package/dist/types/Mode.d.ts +6 -1
  14. package/dist/types/Shapes.d.ts +5 -5
  15. package/dist/types/react.d.ts +0 -1
  16. package/dist/utils/canvas.d.ts +3 -1
  17. package/dist/utils/data.d.ts +2 -1
  18. package/dist/utils/file.d.ts +4 -3
  19. package/dist/utils/grid.d.ts +2 -3
  20. package/dist/utils/intersect.d.ts +8 -3
  21. package/dist/utils/selection/lineSelection.d.ts +6 -5
  22. package/dist/utils/selection/rectSelection.d.ts +5 -5
  23. package/dist/utils/selection/selectionFrame.d.ts +3 -0
  24. package/dist/utils/selection.d.ts +3 -2
  25. package/dist/utils/shapes/brush.d.ts +9 -9
  26. package/dist/utils/shapes/circle.d.ts +7 -7
  27. package/dist/utils/shapes/curve.d.ts +8 -8
  28. package/dist/utils/shapes/ellipse.d.ts +7 -7
  29. package/dist/utils/shapes/index.d.ts +18 -15
  30. package/dist/utils/shapes/line.d.ts +7 -7
  31. package/dist/utils/shapes/path.d.ts +3 -2
  32. package/dist/utils/shapes/picture.d.ts +7 -7
  33. package/dist/utils/shapes/polygon.d.ts +9 -9
  34. package/dist/utils/shapes/rectangle.d.ts +8 -8
  35. package/dist/utils/shapes/text.d.ts +9 -9
  36. package/dist/utils/style.d.ts +1 -1
  37. package/dist/utils/transform.d.ts +11 -5
  38. package/dist/utils/trigo.d.ts +2 -1
  39. package/package.json +55 -69
  40. package/dist/utils/migration.d.ts +0 -2
@@ -1,10 +1,11 @@
1
- import type { DrawableShape, ExportDataType, Point, ShapeEntity } from '../types/Shapes';
1
+ import { UtilsSettings } from 'src/constants/app';
2
+ import type { DrawableShape, ExportDataType, ShapeEntity } from '../types/Shapes';
2
3
  export declare const addSizeAndConvertSvgToObjectUrl: (svgFileContent: string) => string;
3
4
  export declare const isSvg: (fileOrUrl: File | string) => boolean;
4
5
  export declare const fetchAndStringify: (url: string) => Promise<string>;
5
6
  export declare const downloadFile: (content: string, fileName: string) => void;
6
7
  export declare const getBase64Image: (img: HTMLImageElement) => string;
7
- export declare const getCanvasImage: (shapes: DrawableShape[], canvasOffset: Point, width: number, height: number, selectionPadding: number) => string;
8
+ export declare const getCanvasImage: (shapes: DrawableShape[], width: number, height: number, settings: UtilsSettings) => string;
8
9
  export declare const encodeShapesInString: (shapes: DrawableShape[], width: number, height: number) => string;
9
10
  export declare const decodeJson: (file: File) => Promise<unknown>;
10
- export declare const decodeImportedData: (shapesForJson: ExportDataType, currentScale: number, selectionPadding: number) => Promise<ShapeEntity[]>;
11
+ export declare const decodeImportedData: (shapesForJson: ExportDataType, settings: UtilsSettings) => Promise<ShapeEntity[]>;
@@ -1,3 +1,2 @@
1
- import { GridFormatType } from '../constants/app';
2
- import type { Point } from '../types/Shapes';
3
- export declare const drawGrid: (ctx: CanvasRenderingContext2D, width: number, height: number, responsiveScale: number, canvasOffset: Point, gridFormat: GridFormatType) => void;
1
+ import { UtilsSettings } from '../constants/app';
2
+ export declare const drawGrid: (ctx: CanvasRenderingContext2D, width: number, height: number, settings: UtilsSettings) => void;
@@ -1,6 +1,11 @@
1
1
  import type { HoverModeData } from '../types/Mode';
2
- import type { Point, DrawableShape } from '../types/Shapes';
3
- export declare const getCursorPosition: (e: MouseEvent | TouchEvent, canvas: HTMLCanvasElement | null, givenWidth: number, givenHeight: number, scaleRatio?: number) => Point;
2
+ import type { DrawableShape, Point, Rect } from '../types/Shapes';
3
+ import { UtilsSettings } from 'src/constants/app';
4
+ export declare const getCursorPosition: (e: MouseEvent | TouchEvent, canvas: HTMLCanvasElement | null, settings: UtilsSettings) => Point;
5
+ export declare const isTouchGesture: (e: MouseEvent | TouchEvent) => e is TouchEvent;
4
6
  export declare const getPointPositionAfterCanvasTransformation: (point: Point, shapeRotation: number, [originX, originY]: Point, [canvasOffsetX, canvasOffsetY]: Point) => Point;
5
7
  export declare const getPointPositionBeforeCanvasTransformation: (point: Point, shapeRotation: number, [originX, originY]: Point, [canvasOffsetX, canvasOffsetY]: Point) => Point;
6
- export declare const checkPositionIntersection: (shape: DrawableShape, position: Point, canvasOffset: Point, selectionPadding: number, currentScale?: number, checkAnchors?: boolean) => false | HoverModeData;
8
+ export declare const checkSelectionIntersection: (shape: DrawableShape, position: Point, settings: UtilsSettings, checkAnchors?: boolean, radius?: number) => false | HoverModeData;
9
+ export declare const checkPositionIntersection: (ctx: CanvasRenderingContext2D, shape: DrawableShape, position: Point, settings: UtilsSettings) => false | HoverModeData;
10
+ export declare function getRectIntersection(rect1: Rect, rect2: Rect): Rect | undefined;
11
+ export declare const checkSelectionFrameCollision: (ctx: CanvasRenderingContext2D, shape: DrawableShape, selectionFrame: [Point, Point], settings: UtilsSettings) => boolean;
@@ -1,12 +1,13 @@
1
- import { DrawableShape, Point, SelectionLinesType } from "src/types/Shapes";
2
- export declare const createLineSelectionPath: (shape: DrawableShape & {
1
+ import { UtilsSettings } from 'src/constants/app';
2
+ import { DrawableShape, Point, SelectionLinesType } from 'src/types/Shapes';
3
+ export declare const createLineSelectionPath: (path: Path2D | undefined, shape: DrawableShape<'line' | 'polygon' | 'curve'> & {
3
4
  points: readonly Point[];
4
- }, currentScale: number, selectionPadding: number, gravityAnchors?: boolean) => SelectionLinesType;
5
- export declare const drawLineSelection: ({ ctx, shape, withAnchors, selectionWidth, selectionColor, currentScale }: {
5
+ }, settings: UtilsSettings, gravityAnchors?: boolean) => SelectionLinesType;
6
+ export declare const drawLineSelection: ({ ctx, shape, withAnchors, selectionWidth, selectionColor, settings }: {
6
7
  ctx: CanvasRenderingContext2D;
7
8
  shape: DrawableShape<'line'> | DrawableShape<'polygon'> | DrawableShape<'curve'>;
8
9
  withAnchors: boolean;
9
10
  selectionWidth: number;
10
11
  selectionColor: string;
11
- currentScale?: number | undefined;
12
+ settings: UtilsSettings;
12
13
  }) => void;
@@ -1,11 +1,11 @@
1
- import type { Point, DrawableShape, SelectionDefaultType } from '../../types/Shapes';
1
+ import type { UtilsSettings } from '../../constants/app';
2
2
  import type { SelectionModeResize } from '../../types/Mode';
3
- import type { GridFormatType } from '../../constants/app';
4
- export declare const createRecSelectionPath: (rect: DrawableShape, currentScale: number, selectionPadding: number) => SelectionDefaultType;
3
+ import type { DrawableShape, Point, SelectionDefaultType } from '../../types/Shapes';
4
+ export declare const createRecSelectionPath: (path: Path2D | undefined, rect: DrawableShape, settings: UtilsSettings) => SelectionDefaultType;
5
5
  export declare const drawSelectionRect: (ctx: CanvasRenderingContext2D, shape: DrawableShape & {
6
6
  selection?: SelectionDefaultType;
7
- }, selectionColor: string, selectionWidth: number, currentScale: number, withAnchors: boolean) => void;
8
- export declare const resizeRectSelection: (cursorPosition: Point, originalShape: DrawableShape, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, keepRatio?: boolean) => {
7
+ }, selectionColor: string, selectionWidth: number, settings: UtilsSettings, withAnchors: boolean) => void;
8
+ export declare const resizeRectSelection: (cursorPosition: Point, originalShape: DrawableShape, selectionMode: SelectionModeResize, settings: UtilsSettings, keepRatio?: boolean) => {
9
9
  borderX: number;
10
10
  borderHeight: number;
11
11
  borderY: number;
@@ -0,0 +1,3 @@
1
+ import { UtilsSettings } from 'src/constants/app';
2
+ import type { Point } from '../../types/Shapes';
3
+ export declare const drawFrame: (ctx: CanvasRenderingContext2D, selectionFrame: [Point, Point], settings: UtilsSettings) => void;
@@ -1,7 +1,8 @@
1
+ import { UtilsSettings } from 'src/constants/app';
1
2
  import type { HoverModeData, SelectionModeData } from '../types/Mode';
2
3
  import type { Point, ShapeEntity } from '../types/Shapes';
3
- export declare const getNewSelectionData: (hoverMode: HoverModeData, selectedShape: ShapeEntity, cursorPosition: Point, selectionPadding: number) => SelectionModeData<Point | number> | undefined;
4
- export declare const selectShape: (shapes: ShapeEntity[], cursorPosition: Point, currentScale: number, canvasOffset: Point, selectedShape: ShapeEntity | undefined, selectionPadding: number) => {
4
+ export declare const getNewSelectionData: (hoverMode: HoverModeData, selectedShape: ShapeEntity, cursorPosition: Point, settings: UtilsSettings) => SelectionModeData<Point | number> | undefined;
5
+ export declare const selectShape: (ctx: CanvasRenderingContext2D, shapes: ShapeEntity[], cursorPosition: Point, settings: UtilsSettings, selectedShape: ShapeEntity | undefined, isTouchGesture: boolean, withFrameSelection: boolean) => {
5
6
  mode: SelectionModeData<Point | number>;
6
7
  shape: ShapeEntity | undefined;
7
8
  };
@@ -1,20 +1,20 @@
1
- import { GridFormatType } from '../../constants/app';
1
+ import { UtilsSettings } from '../../constants/app';
2
2
  import { SelectionModeResize } from '../../types/Mode';
3
- import type { Point, Rect, DrawableShape, ShapeEntity } from '../../types/Shapes';
3
+ import type { DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
4
4
  import type { ToolsSettingsType } from '../../types/tools';
5
- export declare const refreshBrush: <T extends DrawableShape<"brush">>(brush: T, currentScale: number, selectionPadding: number) => T;
5
+ export declare const refreshBrush: <T extends DrawableShape<"brush">>(brush: T, settings: UtilsSettings) => T;
6
6
  export declare const createBrush: (shape: {
7
7
  id: string;
8
8
  type: 'brush';
9
9
  settings: ToolsSettingsType<'brush'>;
10
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'brush'>;
10
+ }, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<'brush'>;
11
11
  export declare const drawBrush: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'brush'>) => void;
12
- export declare const getBrushBorder: (brush: DrawableShape<'brush'>, selectionPadding: number) => Rect;
13
- export declare const translateBrush: <U extends DrawableShape<"brush">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
12
+ export declare const getBrushBorder: (brush: DrawableShape<'brush'>, { selectionPadding }: UtilsSettings) => Rect;
13
+ export declare const translateBrush: <U extends DrawableShape<"brush">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
14
14
  points: Point[][];
15
15
  };
16
- export declare const resizeBrush: (cursorPosition: Point, originalShape: DrawableShape<'brush'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio: boolean) => DrawableShape<'brush'>;
17
- export declare const addNewPointToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, currentScale: number, selectionPadding: number) => T & {
16
+ export declare const resizeBrush: (cursorPosition: Point, originalShape: DrawableShape<'brush'>, selectionMode: SelectionModeResize, settings: UtilsSettings, keepRatio: boolean) => DrawableShape<'brush'>;
17
+ export declare const addNewPointToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, settings: UtilsSettings) => T & {
18
18
  points: Point[][];
19
19
  };
20
- export declare const addNewPointGroupToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, currentScale: number, selectionPadding: number) => T;
20
+ export declare const addNewPointGroupToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, settings: UtilsSettings) => T;
@@ -1,17 +1,17 @@
1
- import { GridFormatType } from '../../constants/app';
1
+ import { UtilsSettings } from '../../constants/app';
2
2
  import { SelectionModeResize } from '../../types/Mode';
3
- import type { Point, Circle, Rect, DrawableShape, ShapeEntity } from '../../types/Shapes';
3
+ import type { Circle, DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
4
4
  import type { ToolsSettingsType } from '../../types/tools';
5
- export declare const refreshCircle: <T extends DrawableShape<"circle">>(shape: T, currentScale: number, selectionPadding: number) => T;
5
+ export declare const refreshCircle: <T extends DrawableShape<"circle">>(shape: T, settings: UtilsSettings) => T;
6
6
  export declare const createCircle: (shape: {
7
7
  id: string;
8
8
  type: 'circle';
9
9
  settings: ToolsSettingsType<'circle'>;
10
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'circle'>;
10
+ }, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<'circle'>;
11
11
  export declare const drawCircle: (ctx: CanvasRenderingContext2D, circle: DrawableShape<'circle'>) => void;
12
- export declare const getCircleBorder: (circle: Circle, selectionPadding: number) => Rect;
13
- export declare const translateCircle: <U extends DrawableShape<"circle">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
12
+ export declare const getCircleBorder: (circle: Circle, settings: UtilsSettings) => Rect;
13
+ export declare const translateCircle: <U extends DrawableShape<"circle">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
14
14
  x: number;
15
15
  y: number;
16
16
  };
17
- export declare const resizeCircle: (cursorPosition: Point, originalShape: DrawableShape<'circle'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'circle'>;
17
+ export declare const resizeCircle: (cursorPosition: Point, originalShape: DrawableShape<'circle'>, selectionMode: SelectionModeResize, settings: UtilsSettings) => DrawableShape<'circle'>;
@@ -1,17 +1,17 @@
1
- import { GridFormatType } from '../../constants/app';
1
+ import { UtilsSettings } from '../../constants/app';
2
2
  import { SelectionModeResize } from '../../types/Mode';
3
- import type { Point, DrawableShape, ShapeEntity } from '../../types/Shapes';
3
+ import type { DrawableShape, Point, ShapeEntity } from '../../types/Shapes';
4
4
  import type { ToolsSettingsType } from '../../types/tools';
5
- export declare const refreshCurve: <T extends DrawableShape<"curve">>(shape: T, currentScale: number, selectionPadding: number) => T;
5
+ export declare const refreshCurve: <T extends DrawableShape<"curve">>(shape: T, settings: UtilsSettings) => T;
6
6
  export declare const createCurve: (shape: {
7
7
  id: string;
8
8
  type: 'curve';
9
9
  settings: ToolsSettingsType<'curve'>;
10
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'curve'>;
11
- export declare const resizeCurve: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableShape<'curve'>, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'curve'>;
10
+ }, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<'curve'>;
11
+ export declare const resizeCurve: (cursorPosition: Point, originalShape: DrawableShape<'curve'>, selectionMode: SelectionModeResize<number>, settings: UtilsSettings) => DrawableShape<'curve'>;
12
12
  export declare const drawCurve: (ctx: CanvasRenderingContext2D, curve: DrawableShape<'curve'>) => void;
13
- export declare const getCurveBorder: (polygon: import("../../types/Shapes").Polygon, selectionPadding: number) => import("../../types/Shapes").Rect;
14
- export declare const translateCurve: <U extends DrawableShape<"curve">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
13
+ export declare const getCurveBorder: (polygon: import("../../types/Shapes").Polygon, settings: UtilsSettings) => import("../../types/Shapes").Rect;
14
+ export declare const translateCurve: <U extends DrawableShape<"curve">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
15
15
  points: [number, number][];
16
16
  };
17
- export declare const updateCurveLinesCount: <T extends DrawableShape<"curve">>(shape: T, newPointsCount: number, currentScale: number, selectionPadding: number) => T;
17
+ export declare const updateCurveLinesCount: <T extends DrawableShape<"curve">>(shape: T, newPointsCount: number, settings: UtilsSettings) => T;
@@ -1,17 +1,17 @@
1
- import { GridFormatType } from '../../constants/app';
1
+ import { UtilsSettings } from '../../constants/app';
2
2
  import { SelectionModeResize } from '../../types/Mode';
3
- import type { Point, Ellipse, Rect, DrawableShape, ShapeEntity } from '../../types/Shapes';
3
+ import type { DrawableShape, Ellipse, Point, Rect, ShapeEntity } from '../../types/Shapes';
4
4
  import type { ToolsSettingsType } from '../../types/tools';
5
- export declare const refreshEllipse: <T extends DrawableShape<"ellipse">>(shape: T, currentScale: number, selectionPadding: number) => T;
5
+ export declare const refreshEllipse: <T extends DrawableShape<"ellipse">>(shape: T, settings: UtilsSettings) => T;
6
6
  export declare const createEllipse: (shape: {
7
7
  id: string;
8
8
  type: 'ellipse';
9
9
  settings: ToolsSettingsType<'ellipse'>;
10
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'ellipse'>;
10
+ }, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<'ellipse'>;
11
11
  export declare const drawEllipse: (ctx: CanvasRenderingContext2D, ellipse: DrawableShape<'ellipse'>) => void;
12
- export declare const getEllipseBorder: (ellipse: Ellipse, selectionPadding: number) => Rect;
13
- export declare const translateEllipse: <U extends DrawableShape<"ellipse">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
12
+ export declare const getEllipseBorder: (ellipse: Ellipse, settings: UtilsSettings) => Rect;
13
+ export declare const translateEllipse: <U extends DrawableShape<"ellipse">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
14
14
  x: number;
15
15
  y: number;
16
16
  };
17
- export declare const resizeEllipse: (cursorPosition: Point, originalShape: DrawableShape<'ellipse'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio?: boolean) => DrawableShape<'ellipse'>;
17
+ export declare const resizeEllipse: (cursorPosition: Point, originalShape: DrawableShape<'ellipse'>, selectionMode: SelectionModeResize, settings: UtilsSettings, keepRatio?: boolean) => DrawableShape<'ellipse'>;
@@ -1,29 +1,32 @@
1
- import type { Point, DrawableShape, Rect, ShapeEntity } from '../../types/Shapes';
2
- import type { CustomTool } from '../../types/tools';
3
- import type { GridFormatType } from '../../constants/app';
1
+ import type { UtilsSettings } from '../../constants/app';
4
2
  import { SelectionModeData } from '../../types/Mode';
3
+ import type { DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
4
+ import type { CustomTool } from '../../types/tools';
5
5
  export declare const createShape: (ctx: CanvasRenderingContext2D, shape: Exclude<CustomTool, {
6
6
  type: 'picture';
7
- }>, cursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
8
- export declare const drawShape: (ctx: CanvasRenderingContext2D, shape: DrawableShape, responsiveScale: number, canvasOffset: Point, selectionPadding: number) => void;
9
- export declare const getShapeInfos: (shape: DrawableShape, selectionPadding: number) => {
7
+ }>, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity;
8
+ export declare const drawShape: (ctx: CanvasRenderingContext2D, shape: DrawableShape, settings: UtilsSettings) => void;
9
+ export declare const getShapeInfos: (shape: DrawableShape, settings: UtilsSettings) => {
10
10
  borders: Rect;
11
11
  center: Point;
12
12
  };
13
- export declare const rotateShape: <T extends DrawableShape>(shape: T, cursorPosition: Point, originalShape: T, originalCursorPosition: Point, shapeCenter: Point, gridFormat: GridFormatType) => T & {
13
+ export declare const rotateShape: <T extends DrawableShape>(shape: T, cursorPosition: Point, originalShape: T, originalCursorPosition: Point, shapeCenter: Point, settings: UtilsSettings) => T & {
14
14
  rotation: number;
15
15
  };
16
- export declare const resizeShape: <T extends DrawableShape>(ctx: CanvasRenderingContext2D, shape: T, cursorPosition: Point, canvasOffset: Point, originalShape: T, selectionMode: SelectionModeData<Point | number>, gridFormat: GridFormatType, selectionPadding: number, isShiftPressed: boolean, currentScale: number) => T;
17
- export declare const translateShape: (cursorPosition: Point, originalShape: ShapeEntity, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
18
- export declare const refreshShape: (shape: ShapeEntity, currentScale: number, selectionPadding: number) => ShapeEntity;
19
- export declare const drawShapeSelection: ({ ctx, shape, currentScale, canvasOffset, selectionPadding, selectionWidth, selectionColor, withAnchors }: {
16
+ export declare const resizeShape: <T extends DrawableShape>(ctx: CanvasRenderingContext2D, shape: T, cursorPosition: Point, originalShape: T, selectionMode: SelectionModeData<Point | number>, settings: UtilsSettings, isShiftPressed: boolean) => T;
17
+ export declare const translateShape: (cursorPosition: Point, originalShape: ShapeEntity, originalCursorPosition: Point, settings: UtilsSettings) => ShapeEntity;
18
+ export declare const refreshShape: (shape: ShapeEntity, settings: UtilsSettings) => ShapeEntity;
19
+ export declare const drawShapeSelection: ({ ctx, shape, settings, selectionWidth, selectionColor, withAnchors }: {
20
20
  ctx: CanvasRenderingContext2D;
21
21
  shape: DrawableShape;
22
- currentScale: number;
23
- canvasOffset: Point;
24
- selectionPadding: number;
22
+ settings: UtilsSettings;
25
23
  selectionWidth: number;
26
24
  selectionColor: string;
27
25
  withAnchors?: boolean | undefined;
28
26
  }) => void;
29
- export declare const copyShape: (shape: ShapeEntity, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
27
+ export declare const drawSelectionFrame: ({ ctx, selectionFrame, settings }: {
28
+ ctx: CanvasRenderingContext2D;
29
+ selectionFrame: [Point, Point];
30
+ settings: UtilsSettings;
31
+ }) => void;
32
+ export declare const copyShape: (shape: ShapeEntity, settings: UtilsSettings) => ShapeEntity;
@@ -1,17 +1,17 @@
1
- import { GridFormatType } from '../../constants/app';
1
+ import { UtilsSettings } from '../../constants/app';
2
2
  import { SelectionModeResize } from '../../types/Mode';
3
- import type { Point, DrawableShape, Line, Triangle, ShapeEntity, Rect, StyleShape } from '../../types/Shapes';
3
+ import type { DrawableShape, Line, Point, Rect, ShapeEntity, StyleShape, Triangle } from '../../types/Shapes';
4
4
  import type { ToolsSettingsType } from '../../types/tools';
5
- export declare const refreshLine: <T extends DrawableShape<"line">>(line: T, currentScale: number, selectionPadding: number) => T;
5
+ export declare const refreshLine: <T extends DrawableShape<"line">>(line: T, settings: UtilsSettings) => T;
6
6
  export declare const createLine: (shape: {
7
7
  id: string;
8
8
  type: 'line';
9
9
  settings: ToolsSettingsType<'line'>;
10
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'line'>;
10
+ }, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<'line'>;
11
11
  export declare const buildTriangleOnLine: (center: Point, rotation: number, lineStyle: StyleShape) => Triangle;
12
12
  export declare const drawLine: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'line'>) => void;
13
- export declare const getLineBorder: (line: Line, selectionPadding: number) => Rect;
14
- export declare const translateLine: <U extends DrawableShape<"line">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
13
+ export declare const getLineBorder: (line: Line, settings: UtilsSettings) => Rect;
14
+ export declare const translateLine: <U extends DrawableShape<"line">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
15
15
  points: [Point, Point];
16
16
  };
17
- export declare const resizeLine: <U extends DrawableShape<"line">>(cursorPosition: Point, canvasOffset: Point, originalShape: U, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => U;
17
+ export declare const resizeLine: <U extends DrawableShape<"line">>(cursorPosition: Point, originalShape: U, selectionMode: SelectionModeResize<number>, settings: UtilsSettings) => U;
@@ -1,9 +1,10 @@
1
- import { Circle, DrawableShape, Line, Rect } from "../../types/Shapes";
1
+ import { UtilsSettings } from 'src/constants/app';
2
+ import { Circle, DrawableShape, Line, Rect } from '../../types/Shapes';
2
3
  export declare const createRecPath: (rect: Rect) => Path2D;
3
4
  export declare const createCirclePath: (shape: Circle) => Path2D;
4
5
  export declare const createEllipsePath: (ellipse: DrawableShape<'ellipse'>) => Path2D;
5
6
  export declare const createLinePath: (line: Line) => Path2D;
6
- export declare const createBrushPath: (brush: DrawableShape<'brush'>, selectionPadding: number) => Path2D | undefined;
7
+ export declare const createBrushPath: (brush: DrawableShape<'brush'>, settings: UtilsSettings) => Path2D | undefined;
7
8
  export declare const createCurvePath: (curve: DrawableShape<'curve'>) => Path2D | undefined;
8
9
  export declare const createPolygonPath: (polygon: DrawableShape<'polygon'>) => Path2D | undefined;
9
10
  export declare const createTrianglePath: (triangle: DrawableShape<'triangle'>) => Path2D;
@@ -1,12 +1,12 @@
1
- import type { DrawableShape, Picture, Point, Rect, ShapeEntity } from '../../types/Shapes';
1
+ import { UtilsSettings } from '../../constants/app';
2
2
  import { SelectionModeResize } from '../../types/Mode';
3
- import { GridFormatType } from '../../constants/app';
4
- export declare const refreshPicture: <T extends DrawableShape<"picture">>(shape: T, currentScale: number, selectionPadding: number) => T;
5
- export declare const createPicture: (fileOrUrl: File | string, maxPictureWidth: number, maxPictureHeight: number, currentScale: number, selectionPadding: number) => Promise<ShapeEntity<"picture">>;
3
+ import type { DrawableShape, Picture, Point, Rect, ShapeEntity } from '../../types/Shapes';
4
+ export declare const refreshPicture: <T extends DrawableShape<"picture">>(shape: T, settings: UtilsSettings) => T;
5
+ export declare const createPicture: (fileOrUrl: File | string, maxPictureWidth: number, maxPictureHeight: number, settings: UtilsSettings) => Promise<ShapeEntity<"picture">>;
6
6
  export declare const drawPicture: (ctx: CanvasRenderingContext2D, picture: DrawableShape<'picture'>) => void;
7
- export declare const getPictureBorder: (picture: Picture, selectionPadding: number) => Rect;
8
- export declare const translatePicture: <U extends DrawableShape<"picture">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
7
+ export declare const getPictureBorder: (picture: Picture, settings: UtilsSettings) => Rect;
8
+ export declare const translatePicture: <U extends DrawableShape<"picture">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
9
9
  x: number;
10
10
  y: number;
11
11
  };
12
- export declare const resizePicture: (cursorPosition: Point, originalShape: DrawableShape<'picture'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio: boolean) => DrawableShape<'picture'>;
12
+ export declare const resizePicture: (cursorPosition: Point, originalShape: DrawableShape<'picture'>, selectionMode: SelectionModeResize, settings: UtilsSettings, keepRatio: boolean) => DrawableShape<'picture'>;
@@ -1,17 +1,17 @@
1
- import { GridFormatType } from '../../constants/app';
1
+ import { UtilsSettings } from '../../constants/app';
2
2
  import { SelectionModeResize } from '../../types/Mode';
3
- import type { Point, DrawableShape, Polygon, Rect, ShapeEntity } from '../../types/Shapes';
3
+ import type { DrawableShape, Point, Polygon, Rect, ShapeEntity } from '../../types/Shapes';
4
4
  import type { ToolsSettingsType } from '../../types/tools';
5
- export declare const refreshPolygon: <T extends DrawableShape<"polygon">>(shape: T, currentScale: number, selectionPadding: number) => T;
5
+ export declare const refreshPolygon: <T extends DrawableShape<"polygon">>(shape: T, settings: UtilsSettings) => T;
6
6
  export declare const createPolygon: (shape: {
7
7
  id: string;
8
8
  type: 'polygon';
9
9
  settings: ToolsSettingsType<'polygon'>;
10
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'polygon'>;
10
+ }, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<'polygon'>;
11
11
  export declare const drawPolygon: (ctx: CanvasRenderingContext2D, polygon: DrawableShape<'polygon'>) => void;
12
- export declare const getPolygonBorder: (polygon: Polygon, selectionPadding: number) => Rect;
13
- export declare const translatePolygon: <U extends DrawableShape<"polygon">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
14
- points: Point[];
12
+ export declare const getPolygonBorder: (polygon: Polygon, settings: UtilsSettings) => Rect;
13
+ export declare const translatePolygon: <U extends DrawableShape<"polygon">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
14
+ points: [number, number][];
15
15
  };
16
- export declare const resizePolygon: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableShape<'polygon'>, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'polygon'>;
17
- export declare const updatePolygonLinesCount: <T extends DrawableShape<"polygon">>(shape: T, newPointsCount: number, currentScale: number, selectionPadding: number) => T;
16
+ export declare const resizePolygon: (cursorPosition: Point, originalShape: DrawableShape<'polygon'>, selectionMode: SelectionModeResize<number>, settings: UtilsSettings) => DrawableShape<'polygon'>;
17
+ export declare const updatePolygonLinesCount: <T extends DrawableShape<"polygon">>(shape: T, newPointsCount: number, settings: UtilsSettings) => T;
@@ -1,20 +1,20 @@
1
- import type { GridFormatType } from '../../constants/app';
1
+ import type { UtilsSettings } from '../../constants/app';
2
2
  import type { SelectionModeResize } from '../../types/Mode';
3
- import type { Point, DrawableShape, ShapeEntity, Rect } from '../../types/Shapes';
3
+ import type { DrawableShape, Point, Rect, ShapeEntity } from '../../types/Shapes';
4
4
  import type { ToolsSettingsType } from '../../types/tools';
5
5
  type rectish = 'text' | 'rect' | 'square' | 'picture';
6
- export declare const refreshRect: <T extends DrawableShape<rectish>>(rect: T, currentScale: number, selectionPadding: number) => T;
6
+ export declare const refreshRect: <T extends DrawableShape<rectish>>(rect: T, settings: UtilsSettings) => T;
7
7
  export declare const createRectangle: <T extends "rect" | "square">(shape: {
8
8
  id: string;
9
9
  type: T;
10
10
  settings: ToolsSettingsType<T>;
11
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<T>;
11
+ }, cursorPosition: Point, settings: UtilsSettings, width?: number, height?: number) => ShapeEntity<T>;
12
12
  export declare const drawRect: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'rect' | 'square'>) => void;
13
- export declare const getRectBorder: (rect: Rect, selectionPadding: number) => Rect;
14
- export declare const getRectOppositeAnchorAbsolutePosition: <T extends DrawableShape & Rect>(anchor: Point, center: Point, shape: T, canvasOffset: Point, [negW, negH]?: [boolean, boolean]) => Point;
15
- export declare const translateRect: <T extends "rect" | "square", U extends DrawableShape<T>>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
13
+ export declare const getRectBorder: (rect: Rect, settings: UtilsSettings) => Rect;
14
+ export declare const getRectOppositeAnchorAbsolutePosition: <T extends DrawableShape & Rect>(anchor: Point, center: Point, shape: T, settings: UtilsSettings, [negW, negH]?: [boolean, boolean]) => Point;
15
+ export declare const translateRect: <T extends "rect" | "square", U extends DrawableShape<T>>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
16
16
  x: number;
17
17
  y: number;
18
18
  };
19
- export declare const resizeRect: <T extends rectish>(cursorPosition: Point, originalShape: DrawableShape<T>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio?: boolean) => DrawableShape<T>;
19
+ export declare const resizeRect: <T extends rectish>(cursorPosition: Point, originalShape: DrawableShape<T>, selectionMode: SelectionModeResize, settings: UtilsSettings, keepRatio?: boolean) => DrawableShape<T>;
20
20
  export {};
@@ -1,19 +1,19 @@
1
- import type { Point, DrawableShape, Text, Rect, ShapeEntity } from '../../types/Shapes';
2
- import type { ToolsSettingsType } from '../../types/tools';
1
+ import { UtilsSettings } from '../../constants/app';
3
2
  import { SelectionModeResize } from '../../types/Mode';
4
- import { GridFormatType } from '../../constants/app';
5
- export declare const refreshText: <T extends DrawableShape<"text">>(shape: T, currentScale: number, selectionPadding: number) => T;
3
+ import type { DrawableShape, Point, Rect, ShapeEntity, Text } from '../../types/Shapes';
4
+ import type { ToolsSettingsType } from '../../types/tools';
5
+ export declare const refreshText: <T extends DrawableShape<"text">>(shape: T, settings: UtilsSettings) => T;
6
6
  export declare const calculateTextFontSize: (ctx: CanvasRenderingContext2D, text: string[], maxWidth: number, fontBold: boolean, fontItalic: boolean, fontFamily?: string | undefined) => number;
7
7
  export declare const createText: (ctx: CanvasRenderingContext2D, shape: {
8
8
  id: string;
9
9
  type: 'text';
10
10
  settings: ToolsSettingsType<'text'>;
11
- }, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'text'>;
11
+ }, cursorPosition: Point, settings: UtilsSettings) => ShapeEntity<'text'>;
12
12
  export declare const drawText: (ctx: CanvasRenderingContext2D, text: DrawableShape<'text'>) => void;
13
- export declare const getTextBorder: (text: Text, selectionPadding: number) => Rect;
14
- export declare const translateText: <U extends DrawableShape<"text">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
13
+ export declare const getTextBorder: (text: Text, settings: UtilsSettings) => Rect;
14
+ export declare const translateText: <U extends DrawableShape<"text">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, settings: UtilsSettings) => U & {
15
15
  x: number;
16
16
  y: number;
17
17
  };
18
- export declare const resizeText: (ctx: CanvasRenderingContext2D, cursorPosition: Point, originalShape: DrawableShape<'text'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'text'>;
19
- export declare const resizeTextShapeWithNewContent: <U extends DrawableShape<"text">>(ctx: CanvasRenderingContext2D, shape: U, newValue: string[], selectionPadding: number, canvasOffset: Point) => U;
18
+ export declare const resizeText: (ctx: CanvasRenderingContext2D, cursorPosition: Point, originalShape: DrawableShape<'text'>, selectionMode: SelectionModeResize, settings: UtilsSettings) => DrawableShape<'text'>;
19
+ export declare const resizeTextShapeWithNewContent: <U extends DrawableShape<"text">>(ctx: CanvasRenderingContext2D, shape: U, newValue: string[], settings: UtilsSettings) => U;
@@ -1,2 +1,2 @@
1
1
  import type { ShapeType } from '../types/Shapes';
2
- export declare const getShapePicture: (shape: ShapeType) => "" | "<svg><path d=\"M5.146 17.5Q4.146 17.5 3.208 17Q2.271 16.5 1.667 15.708Q2.208 15.75 2.802 15.344Q3.396 14.938 3.396 14.104Q3.396 13.042 4.135 12.292Q4.875 11.542 5.958 11.542Q7.021 11.542 7.76 12.292Q8.5 13.042 8.5 14.104Q8.5 15.5 7.51 16.5Q6.521 17.5 5.146 17.5ZM9.917 12.5 7.562 10.146 14.917 2.729Q15.146 2.5 15.469 2.5Q15.792 2.5 16.021 2.729L17.271 3.958Q17.5 4.188 17.5 4.531Q17.5 4.875 17.271 5.125Z\"/></svg>" | "<svg><path d=\"M2.5 17.5V2.5H17.5V17.5ZM4.25 15.75H15.75V4.25H4.25ZM4.25 15.75V4.25V15.75Z\"/></svg>" | "<svg><path d=\"M10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333ZM10 16.583Q12.75 16.583 14.667 14.667Q16.583 12.75 16.583 10Q16.583 7.25 14.667 5.333Q12.75 3.417 10 3.417Q7.25 3.417 5.333 5.333Q3.417 7.25 3.417 10Q3.417 12.75 5.333 14.667Q7.25 16.583 10 16.583ZM10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Z\"/></svg>" | "<svg><path d=\"M12.25 18.333V16.167L6.833 13.458H2.5V8.208H6.25L8.25 5.917V1.667H13.5V6.917H9.708L7.75 9.146V11.958L12.25 14.208V13.083H17.5V18.333Z\"/></svg>" | "<svg><path d=\"M4.792 15.083 8.333 11.542 9.833 13.021 11.667 10.708 15.167 15.083ZM6.667 8.417Q5.938 8.417 5.427 7.906Q4.917 7.396 4.917 6.667Q4.917 5.938 5.427 5.427Q5.938 4.917 6.667 4.917Q7.396 4.917 7.906 5.427Q8.417 5.938 8.417 6.667Q8.417 7.396 7.906 7.906Q7.396 8.417 6.667 8.417ZM4.167 18.333Q3.125 18.333 2.396 17.604Q1.667 16.875 1.667 15.833V4.167Q1.667 3.125 2.396 2.396Q3.125 1.667 4.167 1.667H15.833Q16.875 1.667 17.604 2.396Q18.333 3.125 18.333 4.167V15.833Q18.333 16.875 17.604 17.604Q16.875 18.333 15.833 18.333ZM4.167 16.583H15.833Q16.146 16.583 16.365 16.365Q16.583 16.146 16.583 15.833V4.167Q16.583 3.854 16.365 3.635Q16.146 3.417 15.833 3.417H4.167Q3.854 3.417 3.635 3.635Q3.417 3.854 3.417 4.167V15.833Q3.417 16.146 3.635 16.365Q3.854 16.583 4.167 16.583Z\"/></svg>" | "<svg><path d=\"M8.708 16.667V5.917H4.167V3.333H15.833V5.917H11.292V16.667Z\"/></svg>" | "<svg><path d=\"M7.5 15.833V14.083H12.833L3.333 4.583L4.583 3.333L14.083 12.833V7.5H15.833V15.833Z\"/></svg>" | "<svg><path d=\"M7.521 17.5Q6.125 17.5 5.146 16.51Q4.167 15.521 4.167 14.125V7.417Q3.438 7.125 2.969 6.49Q2.5 5.854 2.5 5.042Q2.5 3.979 3.24 3.24Q3.979 2.5 5.042 2.5Q6.104 2.5 6.844 3.24Q7.583 3.979 7.583 5.042Q7.583 5.854 7.115 6.49Q6.646 7.125 5.917 7.417V14.125Q5.917 14.792 6.385 15.271Q6.854 15.75 7.521 15.75Q8.188 15.75 8.656 15.271Q9.125 14.792 9.125 14.125V5.875Q9.125 4.479 10.104 3.49Q11.083 2.5 12.479 2.5Q13.875 2.5 14.854 3.49Q15.833 4.479 15.833 5.875V12.583Q16.562 12.875 17.031 13.51Q17.5 14.146 17.5 14.958Q17.5 16.021 16.76 16.76Q16.021 17.5 14.958 17.5Q13.896 17.5 13.156 16.76Q12.417 16.021 12.417 14.958Q12.417 14.146 12.885 13.5Q13.354 12.854 14.083 12.583V5.875Q14.083 5.208 13.615 4.729Q13.146 4.25 12.479 4.25Q11.812 4.25 11.344 4.729Q10.875 5.208 10.875 5.875V14.125Q10.875 15.521 9.896 16.51Q8.917 17.5 7.521 17.5Z\"/></svg>";
2
+ export declare const getShapePicture: (shape: ShapeType) => "<svg><path d=\"M5.146 17.5Q4.146 17.5 3.208 17Q2.271 16.5 1.667 15.708Q2.208 15.75 2.802 15.344Q3.396 14.938 3.396 14.104Q3.396 13.042 4.135 12.292Q4.875 11.542 5.958 11.542Q7.021 11.542 7.76 12.292Q8.5 13.042 8.5 14.104Q8.5 15.5 7.51 16.5Q6.521 17.5 5.146 17.5ZM9.917 12.5 7.562 10.146 14.917 2.729Q15.146 2.5 15.469 2.5Q15.792 2.5 16.021 2.729L17.271 3.958Q17.5 4.188 17.5 4.531Q17.5 4.875 17.271 5.125Z\"/></svg>" | "<svg><path d=\"M2.5 17.5V2.5H17.5V17.5ZM4.25 15.75H15.75V4.25H4.25ZM4.25 15.75V4.25V15.75Z\"/></svg>" | "<svg><path d=\"M10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333ZM10 16.583Q12.75 16.583 14.667 14.667Q16.583 12.75 16.583 10Q16.583 7.25 14.667 5.333Q12.75 3.417 10 3.417Q7.25 3.417 5.333 5.333Q3.417 7.25 3.417 10Q3.417 12.75 5.333 14.667Q7.25 16.583 10 16.583ZM10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Z\"/></svg>" | "<svg><path d=\"M12.25 18.333V16.167L6.833 13.458H2.5V8.208H6.25L8.25 5.917V1.667H13.5V6.917H9.708L7.75 9.146V11.958L12.25 14.208V13.083H17.5V18.333Z\"/></svg>" | "<svg><path d=\"M4.792 15.083 8.333 11.542 9.833 13.021 11.667 10.708 15.167 15.083ZM6.667 8.417Q5.938 8.417 5.427 7.906Q4.917 7.396 4.917 6.667Q4.917 5.938 5.427 5.427Q5.938 4.917 6.667 4.917Q7.396 4.917 7.906 5.427Q8.417 5.938 8.417 6.667Q8.417 7.396 7.906 7.906Q7.396 8.417 6.667 8.417ZM4.167 18.333Q3.125 18.333 2.396 17.604Q1.667 16.875 1.667 15.833V4.167Q1.667 3.125 2.396 2.396Q3.125 1.667 4.167 1.667H15.833Q16.875 1.667 17.604 2.396Q18.333 3.125 18.333 4.167V15.833Q18.333 16.875 17.604 17.604Q16.875 18.333 15.833 18.333ZM4.167 16.583H15.833Q16.146 16.583 16.365 16.365Q16.583 16.146 16.583 15.833V4.167Q16.583 3.854 16.365 3.635Q16.146 3.417 15.833 3.417H4.167Q3.854 3.417 3.635 3.635Q3.417 3.854 3.417 4.167V15.833Q3.417 16.146 3.635 16.365Q3.854 16.583 4.167 16.583Z\"/></svg>" | "<svg><path d=\"M8.708 16.667V5.917H4.167V3.333H15.833V5.917H11.292V16.667Z\"/></svg>" | "<svg><path d=\"M7.5 15.833V14.083H12.833L3.333 4.583L4.583 3.333L14.083 12.833V7.5H15.833V15.833Z\"/></svg>" | "<svg><path d=\"M7.521 17.5Q6.125 17.5 5.146 16.51Q4.167 15.521 4.167 14.125V7.417Q3.438 7.125 2.969 6.49Q2.5 5.854 2.5 5.042Q2.5 3.979 3.24 3.24Q3.979 2.5 5.042 2.5Q6.104 2.5 6.844 3.24Q7.583 3.979 7.583 5.042Q7.583 5.854 7.115 6.49Q6.646 7.125 5.917 7.417V14.125Q5.917 14.792 6.385 15.271Q6.854 15.75 7.521 15.75Q8.188 15.75 8.656 15.271Q9.125 14.792 9.125 14.125V5.875Q9.125 4.479 10.104 3.49Q11.083 2.5 12.479 2.5Q13.875 2.5 14.854 3.49Q15.833 4.479 15.833 5.875V12.583Q16.562 12.875 17.031 13.51Q17.5 14.146 17.5 14.958Q17.5 16.021 16.76 16.76Q16.021 17.5 14.958 17.5Q13.896 17.5 13.156 16.76Q12.417 16.021 12.417 14.958Q12.417 14.146 12.885 13.5Q13.354 12.854 14.083 12.583V5.875Q14.083 5.208 13.615 4.729Q13.146 4.25 12.479 4.25Q11.812 4.25 11.344 4.729Q10.875 5.208 10.875 5.875V14.125Q10.875 15.521 9.896 16.51Q8.917 17.5 7.521 17.5Z\"/></svg>" | "";
@@ -1,9 +1,15 @@
1
+ import type { UtilsSettings } from '../constants/app';
1
2
  import type { SelectionModeData } from '../types/Mode';
2
- import type { Point, ShapeEntity } from '../types/Shapes';
3
- import type { GridFormatType } from '../constants/app';
3
+ import type { DrawableShape, Line, Point, ShapeEntity } from '../types/Shapes';
4
4
  export declare const getNormalizedSize: (originalWidth: number, originalHeight: number, width: number, height: number) => number[];
5
5
  export declare const roundValues: (prop: number, precision?: number) => number;
6
- export declare const roundForGrid: (value: number, gridFormat: GridFormatType, gridOffset?: number) => number;
7
- export declare const roundRotationForGrid: (rotation: number, gridFormat: GridFormatType, gridOffset?: number) => number;
8
- export declare const transformShape: (ctx: CanvasRenderingContext2D, shape: ShapeEntity, cursorPosition: Point, gridFormat: GridFormatType, canvasOffset: Point, selectionMode: SelectionModeData<Point | number>, selectionPadding: number, isShiftPressed: boolean, currentScale: number) => ShapeEntity;
6
+ export declare const scalePoint: (point: Point, minX: number, minY: number, scaleX?: number, scaleY?: number) => Point;
7
+ export declare const roundForGrid: (value: number, settings: UtilsSettings, gridOffset?: number) => number;
8
+ export declare const roundRotationForGrid: (rotation: number, settings: UtilsSettings, gridOffset?: number) => number;
9
+ export declare const transformShape: (ctx: CanvasRenderingContext2D, shape: ShapeEntity, cursorPosition: Point, selectionMode: SelectionModeData<Point | number>, settings: UtilsSettings, isShiftPressed: boolean) => ShapeEntity;
9
10
  export declare const fitContentInsideContainer: (contentWidth: number, contentHeight: number, containerWidth: number, containerHeight: number, shouldFillContainer?: boolean) => number[];
11
+ export declare const shortenLine: ({ line, size, direction }: {
12
+ line: DrawableShape<'line'>;
13
+ size: number;
14
+ direction: 'start' | 'end' | 'both';
15
+ }) => Line;
@@ -1,8 +1,9 @@
1
- import { Point, Rect } from '../types/Shapes';
1
+ import { Circle, Point, Rect } from '../types/Shapes';
2
2
  type Vector = [Point, Point];
3
3
  export declare const degreesToRadians: (degrees: number) => number;
4
4
  export declare const radiansToDegrees: (radians: number) => number;
5
5
  export declare const isPointInsideRect: (rect: Rect, point: Point) => boolean;
6
+ export declare const isCircleIntersectRect: (rect: Rect, circle: Circle) => boolean;
6
7
  export declare const rotatePoint: ({ origin, point, rotation }: {
7
8
  origin?: Point | undefined;
8
9
  point: Point;