@yorab/react-paint 0.17.0 → 0.17.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/dist/canvas/hooks/useReactPaint.d.ts +1 -1
- package/dist/canvas/hooks/useShapes.d.ts +1 -1
- package/dist/canvas/utils/shapes/brush.d.ts +0 -6
- package/dist/canvas/utils/shapes/circle.d.ts +1 -7
- package/dist/canvas/utils/shapes/curve.d.ts +1 -7
- package/dist/canvas/utils/shapes/ellipse.d.ts +1 -7
- package/dist/canvas/utils/shapes/index.d.ts +1 -6
- package/dist/canvas/utils/shapes/line.d.ts +1 -7
- package/dist/canvas/utils/shapes/picture.d.ts +0 -6
- package/dist/canvas/utils/shapes/polygon.d.ts +0 -6
- package/dist/canvas/utils/shapes/rectangle.d.ts +0 -6
- package/dist/editor/components/toolbox/ContextMenu.d.ts +1 -1
- package/dist/react-paint.js +1320 -1261
- package/dist/react-paint.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ type EditorProps = {
|
|
|
33
33
|
backwardShape: () => void;
|
|
34
34
|
forwardShape: () => void;
|
|
35
35
|
removeShapePoint: (shape: ShapeEntity<'curve' | 'polygon'>, pointIndex: number) => void;
|
|
36
|
-
transformShape: (shapes: ShapeEntity[], center: Point, action: 'flipHorizontally' | 'flipVertically' | 'rotateClockwise' | 'rotateCounterclockwise') => void;
|
|
36
|
+
transformShape: (ctx: CanvasRenderingContext2D, shapes: ShapeEntity[], center: Point, action: 'flipHorizontally' | 'flipVertically' | 'rotateClockwise' | 'rotateCounterclockwise') => void;
|
|
37
37
|
refs: {
|
|
38
38
|
canvas: React.RefObject<HTMLCanvasElement | null>;
|
|
39
39
|
editor: React.RefObject<HTMLElement | null>;
|
|
@@ -27,7 +27,7 @@ declare const useShapes: (settings: UtilsSettings, width: number, height: number
|
|
|
27
27
|
toggleShapeLock: (shapeGroup: ShapeEntity[]) => void;
|
|
28
28
|
removeShape: (shapes: ShapeEntity[]) => void;
|
|
29
29
|
updateShape: (updatedShapes: ShapeEntity[], withSave?: boolean) => void;
|
|
30
|
-
transformShape: (shapes: ShapeEntity[], center: Point, action: "flipHorizontally" | "flipVertically" | "rotateClockwise" | "rotateCounterclockwise") => void;
|
|
30
|
+
transformShape: (ctx: CanvasRenderingContext2D, shapes: ShapeEntity[], center: Point, action: "flipHorizontally" | "flipVertically" | "rotateClockwise" | "rotateCounterclockwise") => void;
|
|
31
31
|
backwardShape: () => void;
|
|
32
32
|
forwardShape: () => void;
|
|
33
33
|
clearShapes: (shapesToInit: ShapeEntity[], options: {
|
|
@@ -4,12 +4,6 @@ import type { DrawableShape, Point, Rect, SelectionType, ShapeEntity } from './.
|
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
import { type GroupResizeContext } from './group';
|
|
6
6
|
export declare const getBrushBorder: (brush: DrawableShape<"brush">, { selectionPadding }: Pick<UtilsSettings, "selectionPadding">) => Rect;
|
|
7
|
-
export declare const getComputedBrush: (brush: DrawableShape<"brush">, settings: UtilsSettings) => {
|
|
8
|
-
borders: Rect;
|
|
9
|
-
outerBorders: Rect;
|
|
10
|
-
center: Point;
|
|
11
|
-
boundingBox: Rect;
|
|
12
|
-
};
|
|
13
7
|
export declare const refreshBrush: <T extends DrawableShape<"brush">>(brush: T & {
|
|
14
8
|
id: string;
|
|
15
9
|
}, settings: UtilsSettings) => ShapeEntity<"brush">;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
2
|
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
-
import type { DrawableShape, Point,
|
|
3
|
+
import type { DrawableShape, Point, SelectionType, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
import { type GroupResizeContext } from './group';
|
|
6
|
-
export declare const getComputedCircle: (circle: DrawableShape<"circle">, settings: UtilsSettings) => {
|
|
7
|
-
borders: Rect;
|
|
8
|
-
outerBorders: Rect;
|
|
9
|
-
center: Point;
|
|
10
|
-
boundingBox: Rect;
|
|
11
|
-
};
|
|
12
6
|
export declare const refreshCircle: <T extends DrawableShape<"circle">>(shape: T & {
|
|
13
7
|
id: string;
|
|
14
8
|
}, settings: UtilsSettings) => ShapeEntity<"circle">;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
2
|
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
-
import type { DrawableShape, Point,
|
|
3
|
+
import type { DrawableShape, Point, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
|
-
export declare const getComputedCurve: (curve: DrawableShape<"curve">, settings: UtilsSettings) => {
|
|
6
|
-
borders: Rect;
|
|
7
|
-
outerBorders: Rect;
|
|
8
|
-
center: Point;
|
|
9
|
-
boundingBox: Rect;
|
|
10
|
-
};
|
|
11
5
|
export declare const refreshCurve: <T extends DrawableShape<"curve">>(shape: T & {
|
|
12
6
|
id: string;
|
|
13
7
|
}, settings: UtilsSettings) => ShapeEntity<"curve">;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
2
|
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
-
import type { DrawableShape, Point,
|
|
3
|
+
import type { DrawableShape, Point, SelectionType, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
import { type GroupResizeContext } from './group';
|
|
6
|
-
export declare const getComputedEllipse: (ellipse: DrawableShape<"ellipse">, settings: UtilsSettings) => {
|
|
7
|
-
borders: Rect;
|
|
8
|
-
outerBorders: Rect;
|
|
9
|
-
center: Point;
|
|
10
|
-
boundingBox: Rect;
|
|
11
|
-
};
|
|
12
6
|
export declare const refreshEllipse: <T extends DrawableShape<"ellipse">>(shape: T & {
|
|
13
7
|
id: string;
|
|
14
8
|
}, settings: UtilsSettings) => ShapeEntity<"ellipse">;
|
|
@@ -10,16 +10,11 @@ export declare const drawShape: (ctx: CanvasRenderingContext2D, shape: ShapeEnti
|
|
|
10
10
|
export declare const rotateShape: <T extends ShapeEntity>(shape: T, rotationToApply: number, selectionCenter: Point) => T;
|
|
11
11
|
export declare const resizeShape: <T extends ShapeEntity>(ctx: CanvasRenderingContext2D, cursorPosition: Point, originalShape: T, selectionMode: SelectionModeData<Point | number>, settings: UtilsSettings, isShiftPressed: boolean, isAltPressed: boolean) => T;
|
|
12
12
|
export declare const resizeShapes: (ctx: CanvasRenderingContext2D, cursorPosition: Point, originalShape: SelectionType, selectionMode: SelectionModeResize<Point | number>, settings: UtilsSettings, isShiftPressed: boolean, isAltPressed: boolean) => ShapeEntity[];
|
|
13
|
+
export declare const flipShapes: (ctx: CanvasRenderingContext2D, shapes: ShapeEntity[], selectedShapes: ShapeEntity[], center: Point, action: "flipHorizontally" | "flipVertically", settings: UtilsSettings) => ShapeEntity[];
|
|
13
14
|
export declare const translateShapes: (cursorPosition: Point, originalShape: SelectionType, originalCursorPosition: Point, settings: UtilsSettings, isShiftPressed: boolean) => ShapeEntity[];
|
|
14
15
|
export declare const refreshShape: (shape: DrawableShape & {
|
|
15
16
|
id: string;
|
|
16
17
|
}, settings: UtilsSettings) => ShapeEntity;
|
|
17
|
-
export declare const getShapeComputedData: (shape: DrawableShape, settings: UtilsSettings) => {
|
|
18
|
-
borders: import("./../../../common/types/Shapes").Rect;
|
|
19
|
-
outerBorders: import("./../../../common/types/Shapes").Rect;
|
|
20
|
-
center: Point;
|
|
21
|
-
boundingBox: import("./../../../common/types/Shapes").Rect;
|
|
22
|
-
} | undefined;
|
|
23
18
|
export declare const drawShapeSelection: ({ ctx, shape, settings, selectionWidth, selectionColor, hoverMode, selectionMode, withAnchors }: {
|
|
24
19
|
ctx: CanvasRenderingContext2D;
|
|
25
20
|
shape: SelectionType;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
2
2
|
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
|
-
import type { DrawableShape, Point,
|
|
3
|
+
import type { DrawableShape, Point, SelectionType, ShapeEntity, StyleShape, Triangle } from './../../../common/types/Shapes';
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
import { type GroupResizeContext } from './group';
|
|
6
|
-
export declare const getComputedLine: (line: DrawableShape<"line">, settings: UtilsSettings) => {
|
|
7
|
-
borders: Rect;
|
|
8
|
-
outerBorders: Rect;
|
|
9
|
-
center: Point;
|
|
10
|
-
boundingBox: Rect;
|
|
11
|
-
};
|
|
12
6
|
export declare const refreshLine: <T extends DrawableShape<"line">>(line: T & {
|
|
13
7
|
id: string;
|
|
14
8
|
}, settings: UtilsSettings) => ShapeEntity<"line">;
|
|
@@ -2,12 +2,6 @@ import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
|
2
2
|
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
3
|
import type { DrawableShape, Point, SelectionType, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
4
|
import { type GroupResizeContext } from './group';
|
|
5
|
-
export declare const getComputedPicture: (picture: DrawableShape<"picture">, settings: UtilsSettings) => {
|
|
6
|
-
borders: import("./../../../common/types/Shapes").Rect;
|
|
7
|
-
outerBorders: import("./../../../common/types/Shapes").Rect;
|
|
8
|
-
center: Point;
|
|
9
|
-
boundingBox: import("./../../../common/types/Shapes").Rect;
|
|
10
|
-
};
|
|
11
5
|
export declare const refreshPicture: <T extends DrawableShape<"picture">>(shape: T & {
|
|
12
6
|
id: string;
|
|
13
7
|
}, settings: UtilsSettings) => ShapeEntity<"picture">;
|
|
@@ -2,12 +2,6 @@ import type { UtilsSettings } from './../../../canvas/constants/app';
|
|
|
2
2
|
import type { SelectionModeResize } from './../../../common/types/Mode';
|
|
3
3
|
import type { DrawableShape, Point, Polygon, Rect, ShapeEntity } from './../../../common/types/Shapes';
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
|
-
export declare const getComputedPolygon: (polygon: DrawableShape<"polygon">, settings: UtilsSettings) => {
|
|
6
|
-
borders: Rect;
|
|
7
|
-
outerBorders: Rect;
|
|
8
|
-
center: Point;
|
|
9
|
-
boundingBox: Rect;
|
|
10
|
-
};
|
|
11
5
|
export declare const refreshPolygon: <T extends DrawableShape<"polygon">>(shape: T & {
|
|
12
6
|
id: string;
|
|
13
7
|
}, settings: UtilsSettings) => ShapeEntity<"polygon">;
|
|
@@ -4,12 +4,6 @@ import type { DrawableShape, Point, Rect, SelectionType, ShapeEntity } from './.
|
|
|
4
4
|
import type { ToolsSettingsType } from './../../../common/types/tools';
|
|
5
5
|
import { type GroupResizeContext } from './group';
|
|
6
6
|
type rectish = 'rect' | 'square';
|
|
7
|
-
export declare const getComputedRect: (rect: DrawableShape<rectish>, settings: UtilsSettings) => {
|
|
8
|
-
borders: Rect;
|
|
9
|
-
outerBorders: Rect;
|
|
10
|
-
center: Point;
|
|
11
|
-
boundingBox: Rect;
|
|
12
|
-
};
|
|
13
7
|
export declare const refreshRect: <T extends rectish>(rect: DrawableShape<rectish> & {
|
|
14
8
|
id: string;
|
|
15
9
|
}, settings: UtilsSettings) => ShapeEntity<T>;
|
|
@@ -17,7 +17,7 @@ type ContextMenuType = {
|
|
|
17
17
|
pasteShapes: (shapes: ShapeEntity[]) => void;
|
|
18
18
|
moveShapes: (shapes: ShapeEntity[], action: 'first' | 'last' | 'forward' | 'backward') => void;
|
|
19
19
|
removeShapePoint: (shape: ShapeEntity<'curve' | 'polygon'>, pointIndex: number) => void;
|
|
20
|
-
transformShape: (shapes: ShapeEntity[], center: Point, action: 'flipHorizontally' | 'flipVertically' | 'rotateClockwise' | 'rotateCounterclockwise') => void;
|
|
20
|
+
transformShape: (ctx: CanvasRenderingContext2D, shapes: ShapeEntity[], center: Point, action: 'flipHorizontally' | 'flipVertically' | 'rotateClockwise' | 'rotateCounterclockwise') => void;
|
|
21
21
|
};
|
|
22
22
|
declare const ContextMenu: ({ moveShapes, selectAllShapes, selectionMode, transformShape, settings, canvasRef, closeContextMenu, toggleShapeVisibility, toggleShapeLock, removeShape, duplicateShapes, copiedShape, setCopiedShape, pasteShapes, removeShapePoint }: ContextMenuType) => import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export default ContextMenu;
|