@yorab/react-paint 0.2.2 → 0.3.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.
Files changed (73) hide show
  1. package/Changelog.md +24 -0
  2. package/LICENSE.txt +21 -0
  3. package/README.md +6 -89
  4. package/dist/components/App.js +125 -102
  5. package/dist/components/Canvas.js +17 -14
  6. package/dist/components/settings/LayoutButton.js +3 -3
  7. package/dist/components/settings/Layouts.js +6 -19
  8. package/dist/components/settings/SettingsBar.js +3 -3
  9. package/dist/components/toolbox/EditTextBox.js +3 -2
  10. package/dist/components/toolbox/MenuGroup.js +1 -0
  11. package/dist/components/toolbox/PictureUrlInput.js +8 -7
  12. package/dist/hooks/useDrawableCanvas.js +19 -17
  13. package/dist/hooks/useResizeObserver.js +40 -0
  14. package/dist/hooks/useShapes.js +12 -8
  15. package/dist/styles.css +16 -17
  16. package/dist/utils/data.js +71 -19
  17. package/dist/utils/draw.js +53 -44
  18. package/dist/utils/file.js +26 -60
  19. package/dist/utils/intersect.js +18 -14
  20. package/dist/utils/selection.js +3 -3
  21. package/dist/utils/transform.js +18 -2
  22. package/package.json +6 -7
  23. package/dist/components/App.d.ts +0 -20
  24. package/dist/components/Canvas.d.ts +0 -28
  25. package/dist/components/common/Button.d.ts +0 -14
  26. package/dist/components/common/Loading.d.ts +0 -6
  27. package/dist/components/common/Modal.d.ts +0 -8
  28. package/dist/components/common/Panel.d.ts +0 -10
  29. package/dist/components/common/Snackbar.d.ts +0 -7
  30. package/dist/components/settings/ColorField.d.ts +0 -12
  31. package/dist/components/settings/DeleteButton.d.ts +0 -9
  32. package/dist/components/settings/FontFamilyField.d.ts +0 -10
  33. package/dist/components/settings/LayoutButton.d.ts +0 -8
  34. package/dist/components/settings/Layouts.d.ts +0 -18
  35. package/dist/components/settings/LineArrowField.d.ts +0 -10
  36. package/dist/components/settings/LineTypeField.d.ts +0 -14
  37. package/dist/components/settings/PointsNumberField.d.ts +0 -11
  38. package/dist/components/settings/RangeField.d.ts +0 -16
  39. package/dist/components/settings/SelectField.d.ts +0 -16
  40. package/dist/components/settings/SettingsBar.d.ts +0 -16
  41. package/dist/components/toolbox/EditTextBox.d.ts +0 -10
  42. package/dist/components/toolbox/LoadFileTool.d.ts +0 -11
  43. package/dist/components/toolbox/MenuGroup.d.ts +0 -23
  44. package/dist/components/toolbox/PictureUrlInput.d.ts +0 -7
  45. package/dist/components/toolbox/Tool.d.ts +0 -13
  46. package/dist/components/toolbox/Toolbar.d.ts +0 -20
  47. package/dist/components/toolbox/ToolbarGroup.d.ts +0 -18
  48. package/dist/constants/draw.d.ts +0 -2
  49. package/dist/constants/draw.js +0 -10
  50. package/dist/constants/icons.d.ts +0 -36
  51. package/dist/constants/shapes.d.ts +0 -5
  52. package/dist/constants/snackbar.d.ts +0 -11
  53. package/dist/constants/style.d.ts +0 -12
  54. package/dist/hooks/useComponent.d.ts +0 -9
  55. package/dist/hooks/useDrag.d.ts +0 -15
  56. package/dist/hooks/useDrawableCanvas.d.ts +0 -30
  57. package/dist/hooks/useKeyboard.d.ts +0 -15
  58. package/dist/hooks/useShapes.d.ts +0 -22
  59. package/dist/hooks/useSnackbar.d.ts +0 -16
  60. package/dist/schemas/drawableShape.json +0 -1021
  61. package/dist/types/Mode.d.ts +0 -51
  62. package/dist/types/Shapes.d.ts +0 -122
  63. package/dist/types/keyboard.d.ts +0 -15
  64. package/dist/utils/data.d.ts +0 -4
  65. package/dist/utils/draw.d.ts +0 -18
  66. package/dist/utils/file.d.ts +0 -33
  67. package/dist/utils/intersect.d.ts +0 -8
  68. package/dist/utils/selection.d.ts +0 -7
  69. package/dist/utils/shapeData.d.ts +0 -5
  70. package/dist/utils/string.d.ts +0 -3
  71. package/dist/utils/style.d.ts +0 -2
  72. package/dist/utils/toolbar.d.ts +0 -12
  73. package/dist/utils/transform.d.ts +0 -271
@@ -1,51 +0,0 @@
1
- import { Point, DrawableShape } from './Shapes';
2
- export declare enum SelectionModeLib {
3
- 'default' = "default",
4
- 'brush' = "brush",
5
- 'resize' = "resize",
6
- 'rotate' = "rotate",
7
- 'translate' = "translate",
8
- 'textedition' = "textedition"
9
- }
10
- export declare type SelectionModeDefault = {
11
- mode: SelectionModeLib.default;
12
- };
13
- export declare type SelectionModeBrush = {
14
- mode: SelectionModeLib.brush;
15
- };
16
- export declare type SelectionModeEditText = {
17
- mode: SelectionModeLib.textedition;
18
- defaultValue: string[];
19
- };
20
- export declare type SelectionModeResize<AnchorType extends Point | number = Point> = {
21
- mode: SelectionModeLib.resize;
22
- cursorStartPosition: Point;
23
- originalShape: DrawableShape;
24
- anchor: AnchorType;
25
- };
26
- export declare type SelectionModeRotate = {
27
- mode: SelectionModeLib.rotate;
28
- cursorStartPosition: Point;
29
- originalShape: DrawableShape;
30
- center: Point;
31
- };
32
- export declare type SelectionModeTranslate = {
33
- mode: SelectionModeLib.translate;
34
- cursorStartPosition: Point;
35
- originalShape: DrawableShape;
36
- };
37
- export declare type SelectionModeData<AnchorType extends Point | number> = SelectionModeDefault | SelectionModeBrush | SelectionModeResize<AnchorType> | SelectionModeRotate | SelectionModeTranslate | SelectionModeEditText;
38
- export declare type HoverModeData = {
39
- mode: SelectionModeLib.default;
40
- } | {
41
- mode: SelectionModeLib.resize;
42
- anchor: Point | number;
43
- } | {
44
- mode: SelectionModeLib.brush;
45
- } | {
46
- mode: SelectionModeLib.rotate;
47
- } | {
48
- mode: SelectionModeLib.translate;
49
- } | {
50
- mode: SelectionModeLib.textedition;
51
- };
@@ -1,122 +0,0 @@
1
- export declare enum ShapeEnum {
2
- 'brush' = "brush",
3
- 'rect' = "rect",
4
- 'square' = "square",
5
- 'line' = "line",
6
- 'polygon' = "polygon",
7
- 'circle' = "circle",
8
- 'curve' = "curve",
9
- 'ellipse' = "ellipse",
10
- 'picture' = "picture",
11
- 'text' = "text"
12
- }
13
- export declare enum ToolEnum {
14
- selection = "selection",
15
- undo = "undo",
16
- redo = "redo",
17
- clear = "clear",
18
- export = "export",
19
- loadFile = "loadfile",
20
- saveFile = "savefile",
21
- move = "move"
22
- }
23
- export declare type ToolsType = ShapeEnum | ToolEnum;
24
- export declare type Point = [number, number];
25
- export declare type StyledShape = {
26
- visible?: boolean;
27
- locked?: boolean;
28
- style?: {
29
- fillColor?: string;
30
- globalAlpha?: number;
31
- strokeColor?: string;
32
- lineWidth?: number;
33
- lineDash?: number;
34
- lineArrow?: number;
35
- pointsCount?: number;
36
- fontFamily?: string;
37
- };
38
- };
39
- declare type Drawable = {
40
- id: string;
41
- translation: Point;
42
- rotation: number;
43
- };
44
- export declare type Rect = StyledShape & {
45
- x: number;
46
- y: number;
47
- width: number;
48
- height: number;
49
- };
50
- export declare type Square = Rect;
51
- export declare type StoredPicture = Rect & {
52
- src: string;
53
- };
54
- export declare type Picture = StoredPicture & {
55
- img: HTMLImageElement;
56
- };
57
- export declare type Text = Rect & {
58
- value: string[];
59
- fontSize: number;
60
- };
61
- export declare type Line = StyledShape & {
62
- points: [Point, Point];
63
- };
64
- export declare type Triangle = StyledShape & {
65
- points: [Point, Point, Point];
66
- };
67
- export declare type Polygon = StyledShape & {
68
- points: Point[];
69
- };
70
- export declare type Curve = StyledShape & {
71
- points: Point[];
72
- };
73
- export declare type Brush = StyledShape & {
74
- points: Point[][];
75
- };
76
- export declare type Circle = StyledShape & {
77
- x: number;
78
- y: number;
79
- radius: number;
80
- };
81
- export declare type Ellipse = StyledShape & {
82
- x: number;
83
- y: number;
84
- radiusX: number;
85
- radiusY: number;
86
- };
87
- export declare type DrawableRect = Rect & Drawable & {
88
- type: ShapeEnum.rect;
89
- };
90
- export declare type DrawableSquare = Square & Drawable & {
91
- type: ShapeEnum.square;
92
- };
93
- export declare type DrawablePictureJson = StoredPicture & Drawable & {
94
- type: ShapeEnum.picture;
95
- };
96
- export declare type DrawablePicture = Picture & Drawable & {
97
- type: ShapeEnum.picture;
98
- };
99
- export declare type DrawableText = Text & Drawable & {
100
- type: ShapeEnum.text;
101
- };
102
- export declare type DrawableLine = Line & Drawable & {
103
- type: ShapeEnum.line;
104
- };
105
- export declare type DrawablePolygon = Polygon & Drawable & {
106
- type: ShapeEnum.polygon;
107
- };
108
- export declare type DrawableCurve = Curve & Drawable & {
109
- type: ShapeEnum.curve;
110
- };
111
- export declare type DrawableBrush = Brush & Drawable & {
112
- type: ShapeEnum.brush;
113
- };
114
- export declare type DrawableCircle = Circle & Drawable & {
115
- type: ShapeEnum.circle;
116
- };
117
- export declare type DrawableEllipse = Ellipse & Drawable & {
118
- type: ShapeEnum.ellipse;
119
- };
120
- export declare type DrawableShape = DrawableRect | DrawableSquare | DrawablePicture | DrawableText | DrawableLine | DrawablePolygon | DrawableCurve | DrawableBrush | DrawableCircle | DrawableEllipse;
121
- export declare type DrawableShapeJson = DrawableRect | DrawableSquare | DrawablePictureJson | DrawableText | DrawableLine | DrawableCurve | DrawablePolygon | DrawableBrush | DrawableCircle | DrawableEllipse;
122
- export {};
@@ -1,15 +0,0 @@
1
- export declare enum KeyboardCode {
2
- ArrowUp = "ArrowUp",
3
- ArrowDown = "ArrowDown",
4
- ArrowLeft = "ArrowLeft",
5
- ArrowRight = "ArrowRight",
6
- Delete = "Delete",
7
- Backspace = "Backspace",
8
- Escape = "Escape",
9
- Z = "z",
10
- Y = "y"
11
- }
12
- export declare enum KeyboardCommand {
13
- Copy = "copy",
14
- Paste = "paste"
15
- }
@@ -1,4 +0,0 @@
1
- import { DrawablePicture, Point, DrawableShape, ShapeEnum, StyledShape } from 'types/Shapes';
2
- export declare const createPicture: (fileOrUrl: File | string, maxPictureSize: number) => Promise<DrawablePicture>;
3
- export declare const createShape: (ctx: CanvasRenderingContext2D, shape: ShapeEnum, cursorPosition: Point, defaultConf: StyledShape) => DrawableShape;
4
- export declare const copyShape: (shape: DrawableShape) => DrawableShape;
@@ -1,18 +0,0 @@
1
- import { Circle, Ellipse, Line, Picture, Polygon, Rect, DrawableShape, Point, Brush, Text, Triangle, Curve } from 'types/Shapes';
2
- export declare const drawBrush: (ctx: CanvasRenderingContext2D, brush: Brush) => void;
3
- export declare const drawTriangle: (ctx: CanvasRenderingContext2D, triangle: Triangle) => void;
4
- export declare const drawLine: (ctx: CanvasRenderingContext2D, line: Line) => void;
5
- export declare const drawPolygon: (ctx: CanvasRenderingContext2D, polygon: Polygon) => void;
6
- export declare const drawCurve: (ctx: CanvasRenderingContext2D, curve: Curve) => void;
7
- export declare const drawCircle: (ctx: CanvasRenderingContext2D, circle: Circle) => void;
8
- export declare const drawEllipse: (ctx: CanvasRenderingContext2D, ellipse: Ellipse) => void;
9
- export declare const drawRect: (ctx: CanvasRenderingContext2D, rect: Rect) => void;
10
- export declare const drawText: (ctx: CanvasRenderingContext2D, text: Text) => void;
11
- export declare const drawPicture: (ctx: CanvasRenderingContext2D, picture: Picture) => void;
12
- export declare const drawShape: (ctx: CanvasRenderingContext2D, shape: DrawableShape, canvasOffset: Point) => void;
13
- export declare const drawSelection: ({ ctx, shape, canvasOffset, withAnchors }: {
14
- ctx: CanvasRenderingContext2D;
15
- shape: DrawableShape;
16
- canvasOffset: Point;
17
- withAnchors?: boolean | undefined;
18
- }) => void;
@@ -1,33 +0,0 @@
1
- /// <reference types="lodash" />
2
- import { DrawableShape, DrawableShapeJson, ShapeEnum } from 'types/Shapes';
3
- export declare const fetchAndStringify: (url: string) => Promise<string>;
4
- export declare const downloadFile: (content: string, fileName: string) => void;
5
- export declare const getCanvasImage: (canvas: HTMLCanvasElement) => string;
6
- export declare const encodePicturesInShapes: (shapes: DrawableShape[]) => (import("types/Shapes").DrawableRect | import("types/Shapes").DrawableSquare | import("types/Shapes").DrawableText | import("types/Shapes").DrawableLine | import("types/Shapes").DrawablePolygon | import("types/Shapes").DrawableCurve | import("types/Shapes").DrawableBrush | import("types/Shapes").DrawableCircle | import("types/Shapes").DrawableEllipse | import("lodash").Omit<import("types/Shapes").DrawablePicture, "img"> | {
7
- src: string;
8
- img: undefined;
9
- visible?: boolean | undefined;
10
- locked?: boolean | undefined;
11
- style?: {
12
- fillColor?: string | undefined;
13
- globalAlpha?: number | undefined;
14
- strokeColor?: string | undefined;
15
- lineWidth?: number | undefined;
16
- lineDash?: number | undefined;
17
- lineArrow?: number | undefined;
18
- pointsCount?: number | undefined;
19
- fontFamily?: string | undefined;
20
- } | undefined;
21
- x: number;
22
- y: number;
23
- width: number;
24
- height: number;
25
- id: string;
26
- translation: import("types/Shapes").Point;
27
- rotation: number;
28
- type: ShapeEnum.picture;
29
- })[];
30
- export declare const encodeShapesInString: (shapes: DrawableShape[]) => string;
31
- export declare const decodeJson: (file: File) => Promise<unknown>;
32
- export declare const decodePicturesInShapes: (shapesForJson: DrawableShapeJson[]) => Promise<DrawableShape[]>;
33
- export declare const validateJson: (json: unknown) => boolean;
@@ -1,8 +0,0 @@
1
- import { HoverModeData } from 'types/Mode';
2
- import { Point, DrawableShape } from 'types/Shapes';
3
- export declare const getCursorPosition: (e: MouseEvent | TouchEvent, canvas: HTMLCanvasElement | null, givenWidth: number, givenHeight: number) => Point;
4
- export declare const getSettingsPosition: (shape: DrawableShape, canvas: HTMLCanvasElement | null, givenWidth: number, givenHeight: number) => number[];
5
- export declare const getPointPositionAfterCanvasTransformation: ([positionX, positionY]: Point, [canvasOffsetX, canvasOffsetY]: Point, [translationX, translationY]: Point, shapeRotation: number, [centerX, centerY]: Point) => Point;
6
- export declare const getPointPositionBeforeCanvasTransformation: ([positionX, positionY]: Point, [translationX, translationY]: Point, shapeRotation: number, [centerX, centerY]: Point) => Point;
7
- export declare const applyRotationToVector: (vector: Point, shapeRotation: number) => Point;
8
- export declare const checkPositionIntersection: (shape: DrawableShape, position: Point, canvasOffset: Point, checkAnchors?: boolean) => false | HoverModeData;
@@ -1,7 +0,0 @@
1
- import { HoverModeData, SelectionModeData } from 'types/Mode';
2
- import { Point, DrawableShape } from 'types/Shapes';
3
- export declare const getNewSelectionData: (hoverMode: HoverModeData, selectedShape: DrawableShape, cursorPosition: Point) => SelectionModeData<Point | number> | undefined;
4
- export declare const selectShape: (shapes: DrawableShape[], cursorPosition: Point, canvasOffset: Point, selectedShape: DrawableShape | undefined) => {
5
- mode: SelectionModeData<Point | number>;
6
- shape: DrawableShape | undefined;
7
- };
@@ -1,5 +0,0 @@
1
- import { Point, Rect, DrawableShape } from 'types/Shapes';
2
- export declare const getShapeInfos: (shape: DrawableShape) => {
3
- borders: Rect;
4
- center: Point;
5
- };
@@ -1,3 +0,0 @@
1
- export declare const convertStringArrayToDivContent: (toConvert: string[]) => string;
2
- export declare const decodeHtmlEntities: (html: string) => string;
3
- export declare const convertDivContentToStringArray: (toConvert: string) => string[];
@@ -1,2 +0,0 @@
1
- import { ShapeEnum } from 'types/Shapes';
2
- export declare const getShapePicture: (shape: ShapeEnum) => "<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=\"M4.25 15.833Q3.521 15.833 3.01 15.323Q2.5 14.812 2.5 14.083V5.917Q2.5 5.188 3.01 4.677Q3.521 4.167 4.25 4.167H15.75Q16.479 4.167 16.99 4.677Q17.5 5.188 17.5 5.917V14.083Q17.5 14.812 16.99 15.323Q16.479 15.833 15.75 15.833ZM4.25 14.083H15.75Q15.75 14.083 15.75 14.083Q15.75 14.083 15.75 14.083V5.917Q15.75 5.917 15.75 5.917Q15.75 5.917 15.75 5.917H4.25Q4.25 5.917 4.25 5.917Q4.25 5.917 4.25 5.917V14.083Q4.25 14.083 4.25 14.083Q4.25 14.083 4.25 14.083ZM4.25 14.083Q4.25 14.083 4.25 14.083Q4.25 14.083 4.25 14.083V5.917Q4.25 5.917 4.25 5.917Q4.25 5.917 4.25 5.917Q4.25 5.917 4.25 5.917Q4.25 5.917 4.25 5.917V14.083Q4.25 14.083 4.25 14.083Q4.25 14.083 4.25 14.083Z\"/></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=\"M10 15.833Q7.917 15.833 6.667 14.177Q5.417 12.521 5.417 10Q5.417 7.479 6.667 5.823Q7.917 4.167 10 4.167Q12.083 4.167 13.333 5.823Q14.583 7.479 14.583 10Q14.583 12.521 13.333 14.177Q12.083 15.833 10 15.833ZM10 14.042Q11.375 14.042 12.021 12.833Q12.667 11.625 12.667 10Q12.667 8.375 12.021 7.167Q11.375 5.958 10 5.958Q8.625 5.958 7.979 7.167Q7.333 8.375 7.333 10Q7.333 11.625 7.979 12.833Q8.625 14.042 10 14.042Z\"/></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,12 +0,0 @@
1
- import { ShapeEnum } from 'types/Shapes';
2
- export declare const getCurrentStructure: (availableTools: ShapeEnum[], defaultStructure: (ShapeEnum | {
3
- title: string;
4
- img: string;
5
- tools: ShapeEnum[];
6
- vertical: boolean;
7
- })[]) => (ShapeEnum | {
8
- tools: ShapeEnum[];
9
- title: string;
10
- vertical: boolean;
11
- img: string;
12
- })[];
@@ -1,271 +0,0 @@
1
- import { SelectionModeData, SelectionModeResize } from 'types/Mode';
2
- import { DrawableCircle, DrawableEllipse, Point, DrawableShape, DrawablePicture, Rect, DrawableLine, DrawablePolygon, DrawableBrush, DrawableCurve } from 'types/Shapes';
3
- export declare const getNormalizedSize: (originalShape: Rect, width: number, height: number) => number[];
4
- export declare const translateShape: (shape: DrawableShape, cursorPosition: Point, originalShape: DrawableShape, originalCursorPosition: Point) => DrawableShape;
5
- export declare const rotateShape: (shape: DrawableShape, cursorPosition: Point, originalShape: DrawableShape, originalCursorPosition: Point, shapeCenter: Point) => {
6
- rotation: number;
7
- visible?: boolean | undefined;
8
- locked?: boolean | undefined;
9
- style?: {
10
- fillColor?: string | undefined;
11
- globalAlpha?: number | undefined;
12
- strokeColor?: string | undefined;
13
- lineWidth?: number | undefined;
14
- lineDash?: number | undefined;
15
- lineArrow?: number | undefined;
16
- pointsCount?: number | undefined;
17
- fontFamily?: string | undefined;
18
- } | undefined;
19
- x: number;
20
- y: number;
21
- width: number;
22
- height: number;
23
- id: string;
24
- translation: Point;
25
- type: import("types/Shapes").ShapeEnum.rect;
26
- } | {
27
- rotation: number;
28
- visible?: boolean | undefined;
29
- locked?: boolean | undefined;
30
- style?: {
31
- fillColor?: string | undefined;
32
- globalAlpha?: number | undefined;
33
- strokeColor?: string | undefined;
34
- lineWidth?: number | undefined;
35
- lineDash?: number | undefined;
36
- lineArrow?: number | undefined;
37
- pointsCount?: number | undefined;
38
- fontFamily?: string | undefined;
39
- } | undefined;
40
- x: number;
41
- y: number;
42
- width: number;
43
- height: number;
44
- id: string;
45
- translation: Point;
46
- type: import("types/Shapes").ShapeEnum.square;
47
- } | {
48
- rotation: number;
49
- visible?: boolean | undefined;
50
- locked?: boolean | undefined;
51
- style?: {
52
- fillColor?: string | undefined;
53
- globalAlpha?: number | undefined;
54
- strokeColor?: string | undefined;
55
- lineWidth?: number | undefined;
56
- lineDash?: number | undefined;
57
- lineArrow?: number | undefined;
58
- pointsCount?: number | undefined;
59
- fontFamily?: string | undefined;
60
- } | undefined;
61
- x: number;
62
- y: number;
63
- width: number;
64
- height: number;
65
- src: string;
66
- img: HTMLImageElement;
67
- id: string;
68
- translation: Point;
69
- type: import("types/Shapes").ShapeEnum.picture;
70
- } | {
71
- rotation: number;
72
- visible?: boolean | undefined;
73
- locked?: boolean | undefined;
74
- style?: {
75
- fillColor?: string | undefined;
76
- globalAlpha?: number | undefined;
77
- strokeColor?: string | undefined;
78
- lineWidth?: number | undefined;
79
- lineDash?: number | undefined;
80
- lineArrow?: number | undefined;
81
- pointsCount?: number | undefined;
82
- fontFamily?: string | undefined;
83
- } | undefined;
84
- x: number;
85
- y: number;
86
- width: number;
87
- height: number;
88
- value: string[];
89
- fontSize: number;
90
- id: string;
91
- translation: Point;
92
- type: import("types/Shapes").ShapeEnum.text;
93
- } | {
94
- rotation: number;
95
- visible?: boolean | undefined;
96
- locked?: boolean | undefined;
97
- style?: {
98
- fillColor?: string | undefined;
99
- globalAlpha?: number | undefined;
100
- strokeColor?: string | undefined;
101
- lineWidth?: number | undefined;
102
- lineDash?: number | undefined;
103
- lineArrow?: number | undefined;
104
- pointsCount?: number | undefined;
105
- fontFamily?: string | undefined;
106
- } | undefined;
107
- points: [Point, Point];
108
- id: string;
109
- translation: Point;
110
- type: import("types/Shapes").ShapeEnum.line;
111
- } | {
112
- rotation: number;
113
- visible?: boolean | undefined;
114
- locked?: boolean | undefined;
115
- style?: {
116
- fillColor?: string | undefined;
117
- globalAlpha?: number | undefined;
118
- strokeColor?: string | undefined;
119
- lineWidth?: number | undefined;
120
- lineDash?: number | undefined;
121
- lineArrow?: number | undefined;
122
- pointsCount?: number | undefined;
123
- fontFamily?: string | undefined;
124
- } | undefined;
125
- points: Point[];
126
- id: string;
127
- translation: Point;
128
- type: import("types/Shapes").ShapeEnum.polygon;
129
- } | {
130
- rotation: number;
131
- visible?: boolean | undefined;
132
- locked?: boolean | undefined;
133
- style?: {
134
- fillColor?: string | undefined;
135
- globalAlpha?: number | undefined;
136
- strokeColor?: string | undefined;
137
- lineWidth?: number | undefined;
138
- lineDash?: number | undefined;
139
- lineArrow?: number | undefined;
140
- pointsCount?: number | undefined;
141
- fontFamily?: string | undefined;
142
- } | undefined;
143
- points: Point[];
144
- id: string;
145
- translation: Point;
146
- type: import("types/Shapes").ShapeEnum.curve;
147
- } | {
148
- rotation: number;
149
- visible?: boolean | undefined;
150
- locked?: boolean | undefined;
151
- style?: {
152
- fillColor?: string | undefined;
153
- globalAlpha?: number | undefined;
154
- strokeColor?: string | undefined;
155
- lineWidth?: number | undefined;
156
- lineDash?: number | undefined;
157
- lineArrow?: number | undefined;
158
- pointsCount?: number | undefined;
159
- fontFamily?: string | undefined;
160
- } | undefined;
161
- points: Point[][];
162
- id: string;
163
- translation: Point;
164
- type: import("types/Shapes").ShapeEnum.brush;
165
- } | {
166
- rotation: number;
167
- visible?: boolean | undefined;
168
- locked?: boolean | undefined;
169
- style?: {
170
- fillColor?: string | undefined;
171
- globalAlpha?: number | undefined;
172
- strokeColor?: string | undefined;
173
- lineWidth?: number | undefined;
174
- lineDash?: number | undefined;
175
- lineArrow?: number | undefined;
176
- pointsCount?: number | undefined;
177
- fontFamily?: string | undefined;
178
- } | undefined;
179
- x: number;
180
- y: number;
181
- radius: number;
182
- id: string;
183
- translation: Point;
184
- type: import("types/Shapes").ShapeEnum.circle;
185
- } | {
186
- rotation: number;
187
- visible?: boolean | undefined;
188
- locked?: boolean | undefined;
189
- style?: {
190
- fillColor?: string | undefined;
191
- globalAlpha?: number | undefined;
192
- strokeColor?: string | undefined;
193
- lineWidth?: number | undefined;
194
- lineDash?: number | undefined;
195
- lineArrow?: number | undefined;
196
- pointsCount?: number | undefined;
197
- fontFamily?: string | undefined;
198
- } | undefined;
199
- x: number;
200
- y: number;
201
- radiusX: number;
202
- radiusY: number;
203
- id: string;
204
- translation: Point;
205
- type: import("types/Shapes").ShapeEnum.ellipse;
206
- };
207
- export declare const paintNewPointToShape: (shape: DrawableBrush, cursorPosition: Point) => {
208
- points: Point[][];
209
- visible?: boolean | undefined;
210
- locked?: boolean | undefined;
211
- style?: {
212
- fillColor?: string | undefined;
213
- globalAlpha?: number | undefined;
214
- strokeColor?: string | undefined;
215
- lineWidth?: number | undefined;
216
- lineDash?: number | undefined;
217
- lineArrow?: number | undefined;
218
- pointsCount?: number | undefined;
219
- fontFamily?: string | undefined;
220
- } | undefined;
221
- id: string;
222
- translation: Point;
223
- rotation: number;
224
- type: import("types/Shapes").ShapeEnum.brush;
225
- };
226
- export declare const createNewPointGroupToShape: (shape: DrawableBrush, cursorPosition: Point) => {
227
- points: Point[][];
228
- visible?: boolean | undefined;
229
- locked?: boolean | undefined;
230
- style?: {
231
- fillColor?: string | undefined;
232
- globalAlpha?: number | undefined;
233
- strokeColor?: string | undefined;
234
- lineWidth?: number | undefined;
235
- lineDash?: number | undefined;
236
- lineArrow?: number | undefined;
237
- pointsCount?: number | undefined;
238
- fontFamily?: string | undefined;
239
- } | undefined;
240
- id: string;
241
- translation: Point;
242
- rotation: number;
243
- type: import("types/Shapes").ShapeEnum.brush;
244
- };
245
- export declare const resizeBrush: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableBrush, selectionMode: SelectionModeResize) => DrawableBrush;
246
- export declare const resizeLine: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableLine | DrawablePolygon | DrawableCurve, selectionMode: SelectionModeResize<number>) => DrawableLine | DrawablePolygon | DrawableCurve;
247
- export declare const updatePolygonLinesCount: (shape: DrawablePolygon, newPointsCount: number) => DrawablePolygon;
248
- export declare const resizeCircle: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableCircle, selectionMode: SelectionModeResize) => DrawableCircle;
249
- export declare const resizeEllipse: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableEllipse, selectionMode: SelectionModeResize) => DrawableEllipse;
250
- export declare const resizeRect: <T extends DrawableShape & import("types/Shapes").StyledShape & {
251
- x: number;
252
- y: number;
253
- width: number;
254
- height: number;
255
- }>(cursorPosition: Point, canvasOffset: Point, originalShape: T, selectionMode: SelectionModeResize, keepRatio?: boolean) => T;
256
- export declare const resizeText: <T extends DrawableShape & import("types/Shapes").StyledShape & {
257
- x: number;
258
- y: number;
259
- width: number;
260
- height: number;
261
- } & {
262
- value: string[];
263
- fontSize: number;
264
- }>(ctx: CanvasRenderingContext2D, cursorPosition: Point, canvasOffset: Point, originalShape: T, selectionMode: SelectionModeResize) => T;
265
- export declare const resizePicture: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawablePicture, selectionMode: SelectionModeResize) => DrawablePicture;
266
- export declare const resizeShape: (ctx: CanvasRenderingContext2D, shape: DrawableShape, cursorPosition: Point, canvasOffset: Point, originalShape: DrawableShape, selectionMode: SelectionModeData<Point | number>) => DrawableShape;
267
- export declare const transformShape: (ctx: CanvasRenderingContext2D, shape: DrawableShape, cursorPosition: Point, canvasOffset: Point, selectionMode: SelectionModeData<Point | number>) => DrawableShape;
268
- export declare const calculateTextFontSize: (ctx: CanvasRenderingContext2D, text: string[], maxWidth: number, fontFamily?: string | undefined) => number;
269
- export declare const calculateTextWidth: (ctx: CanvasRenderingContext2D, text: string[], fontSize: number, fontFamily?: string | undefined) => number;
270
- export declare const degreesToRadians: (degrees: number) => number;
271
- export declare const radiansToDegrees: (radians: number) => number;