@leapfrog/interactive-canvas 2.0.9 → 2.0.10
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/abstract-interactive-canvas.d.ts +375 -372
- package/dist/dimensions/millimeter-dimensions.d.ts +15 -15
- package/dist/dimensions/pixel-canvas-dimensions.d.ts +13 -13
- package/dist/dimensions/print-6-col-canvas-dimensions.d.ts +18 -18
- package/dist/dimensions/print-8-col-canvas-dimensions.d.ts +18 -18
- package/dist/font/font-library.d.ts +27 -27
- package/dist/font/font-library.interface.d.ts +24 -24
- package/dist/font/font.interface.d.ts +20 -20
- package/dist/font/unknown-font.d.ts +6 -6
- package/dist/headless-interactive-canvas.d.ts +10 -10
- package/dist/index.d.ts +54 -54
- package/dist/interactive-canvas.d.ts +25 -25
- package/dist/interactive-canvas.es.js +3910 -3905
- package/dist/interactive-canvas.interface.d.ts +297 -297
- package/dist/interactive-canvas.js +3907 -3902
- package/dist/layout/abstract-layout-manager.d.ts +17 -17
- package/dist/layout/advanced-layout-manager.d.ts +16 -16
- package/dist/layout/function/pin-to-bottom.layout-function.d.ts +4 -4
- package/dist/layout/function/redraw-all.layout-function.d.ts +4 -4
- package/dist/layout/function/reposition-backgrounds.layout-function.d.ts +4 -4
- package/dist/layout/function/reposition-borders.layout-function.d.ts +4 -4
- package/dist/layout/function/reposition-cutoffs.layout-function.d.ts +4 -4
- package/dist/layout/function/resize-canvas.layout-function.d.ts +4 -4
- package/dist/layout/function/stack-objects.layout-function.d.ts +11 -11
- package/dist/layout/function/update-object-dimensions.layout-function.d.ts +4 -4
- package/dist/layout/layout-manager.enum.d.ts +5 -5
- package/dist/layout/layout-manager.interface.d.ts +13 -13
- package/dist/layout/standard-layout-manager.d.ts +40 -40
- package/dist/mutator/mutable-background-color.interface.d.ts +15 -15
- package/dist/mutator/mutable-color.interface.d.ts +6 -6
- package/dist/mutator/mutable-image.interface.d.ts +28 -28
- package/dist/mutator/mutable-position.interface.d.ts +63 -63
- package/dist/mutator/mutable-stroke.interface.d.ts +8 -8
- package/dist/mutator/mutable-text-style.interface.d.ts +163 -163
- package/dist/mutator/mutable-text.interface.d.ts +80 -80
- package/dist/object/abstract-canvas-object.d.ts +207 -207
- package/dist/object/canvas-object-data.d.ts +24 -24
- package/dist/object/canvas-object.interface.d.ts +109 -109
- package/dist/object/impl/background-image.d.ts +38 -38
- package/dist/object/impl/border.d.ts +70 -70
- package/dist/object/impl/cutoff.d.ts +59 -59
- package/dist/object/impl/extended-fabric-object.interface.d.ts +7 -7
- package/dist/object/impl/extended-fabric-textbox.interface.d.ts +7 -7
- package/dist/object/impl/horizontal-rule.d.ts +83 -83
- package/dist/object/impl/image.d.ts +76 -76
- package/dist/object/impl/rectangle.d.ts +78 -78
- package/dist/object/impl/rich-text.d.ts +39 -39
- package/dist/object/impl/text.d.ts +314 -314
- package/dist/object/impl/vertical-rule.d.ts +83 -83
- package/dist/profile/canvas-profile.interface.d.ts +22 -22
- package/dist/profile/default-canvas-profile.d.ts +23 -23
- package/dist/types/canvas-dimension-restrictions.interface.d.ts +15 -15
- package/dist/types/canvas-dimensions.interface.d.ts +21 -21
- package/dist/types/canvas-state.interface.d.ts +11 -11
- package/dist/types/dimension-restrictions.interface.d.ts +6 -6
- package/dist/types/image-type.enum.d.ts +6 -6
- package/dist/types/margin.interface.d.ts +6 -6
- package/dist/types/object-dimensions.interface.d.ts +23 -23
- package/dist/types/object-type.enum.d.ts +12 -12
- package/dist/types/overflow.interface.d.ts +4 -4
- package/dist/types/position.interface.d.ts +9 -9
- package/dist/types/rect.interface.d.ts +6 -6
- package/dist/types/selection-data.interface.d.ts +24 -19
- package/dist/types/text-alignment.interface.d.ts +1 -1
- package/dist/undo-stack.d.ts +27 -27
- package/dist/undo-stack.interface.d.ts +6 -6
- package/package.json +2 -2
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
|
-
import { ICanvasObject } from "../canvas-object.interface";
|
|
3
|
-
import { IInteractiveCanvas, IMutableColor, IMutablePosition } from "../..";
|
|
4
|
-
import { AbstractCanvasObject } from "../abstract-canvas-object";
|
|
5
|
-
import { CanvasObjectData } from "../canvas-object-data";
|
|
6
|
-
import { fabric } from "fabric";
|
|
7
|
-
/**
|
|
8
|
-
* Vertical rule. A basic block of color that spans the canvas/row height.
|
|
9
|
-
*/
|
|
10
|
-
export interface IVerticalRule extends ICanvasObject, IMutableColor, IMutablePosition {
|
|
11
|
-
/**
|
|
12
|
-
* Get the width of the rule.
|
|
13
|
-
*/
|
|
14
|
-
getStrokeWidth(): number;
|
|
15
|
-
/**
|
|
16
|
-
* Get an observable of the width of the rule.
|
|
17
|
-
*/
|
|
18
|
-
getStrokeWidth$(): Observable<number>;
|
|
19
|
-
/**
|
|
20
|
-
* Set the rule width.
|
|
21
|
-
* @param width New width.
|
|
22
|
-
*/
|
|
23
|
-
setStrokeWidth(width: number): void;
|
|
24
|
-
}
|
|
25
|
-
export declare class VerticalRule extends AbstractCanvasObject<fabric.Rect> implements IVerticalRule {
|
|
26
|
-
private readonly strokeWidth$;
|
|
27
|
-
constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
|
|
28
|
-
/**
|
|
29
|
-
* @override
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
getStrokeWidth(): number;
|
|
33
|
-
/**
|
|
34
|
-
* @override
|
|
35
|
-
* @inheritDoc
|
|
36
|
-
*/
|
|
37
|
-
getStrokeWidth$(): Observable<number>;
|
|
38
|
-
/**
|
|
39
|
-
* @override
|
|
40
|
-
* @inheritDoc
|
|
41
|
-
*/
|
|
42
|
-
setStrokeWidth(width: number): void;
|
|
43
|
-
/**
|
|
44
|
-
* @override
|
|
45
|
-
* @inheritDoc
|
|
46
|
-
*/
|
|
47
|
-
getColor(): string;
|
|
48
|
-
/**
|
|
49
|
-
* @override
|
|
50
|
-
* @inheritDoc
|
|
51
|
-
*/
|
|
52
|
-
setColor(color: string): void;
|
|
53
|
-
/**
|
|
54
|
-
* @override
|
|
55
|
-
* @inheritDoc
|
|
56
|
-
*/
|
|
57
|
-
centerHorizontally(): void;
|
|
58
|
-
/**
|
|
59
|
-
* @override
|
|
60
|
-
* @inheritDoc
|
|
61
|
-
*/
|
|
62
|
-
centerVertically(): void;
|
|
63
|
-
/**
|
|
64
|
-
* @override
|
|
65
|
-
* @inheritDoc
|
|
66
|
-
*/
|
|
67
|
-
nudgeUp(): void;
|
|
68
|
-
/**
|
|
69
|
-
* @override
|
|
70
|
-
* @inheritDoc
|
|
71
|
-
*/
|
|
72
|
-
nudgeDown(): void;
|
|
73
|
-
/**
|
|
74
|
-
* @override
|
|
75
|
-
* @inheritDoc
|
|
76
|
-
*/
|
|
77
|
-
nudgeLeft(): void;
|
|
78
|
-
/**
|
|
79
|
-
* @override
|
|
80
|
-
* @inheritDoc
|
|
81
|
-
*/
|
|
82
|
-
nudgeRight(): void;
|
|
83
|
-
}
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { ICanvasObject } from "../canvas-object.interface";
|
|
3
|
+
import { IInteractiveCanvas, IMutableColor, IMutablePosition } from "../..";
|
|
4
|
+
import { AbstractCanvasObject } from "../abstract-canvas-object";
|
|
5
|
+
import { CanvasObjectData } from "../canvas-object-data";
|
|
6
|
+
import { fabric } from "fabric";
|
|
7
|
+
/**
|
|
8
|
+
* Vertical rule. A basic block of color that spans the canvas/row height.
|
|
9
|
+
*/
|
|
10
|
+
export interface IVerticalRule extends ICanvasObject, IMutableColor, IMutablePosition {
|
|
11
|
+
/**
|
|
12
|
+
* Get the width of the rule.
|
|
13
|
+
*/
|
|
14
|
+
getStrokeWidth(): number;
|
|
15
|
+
/**
|
|
16
|
+
* Get an observable of the width of the rule.
|
|
17
|
+
*/
|
|
18
|
+
getStrokeWidth$(): Observable<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Set the rule width.
|
|
21
|
+
* @param width New width.
|
|
22
|
+
*/
|
|
23
|
+
setStrokeWidth(width: number): void;
|
|
24
|
+
}
|
|
25
|
+
export declare class VerticalRule extends AbstractCanvasObject<fabric.Rect> implements IVerticalRule {
|
|
26
|
+
private readonly strokeWidth$;
|
|
27
|
+
constructor(canvas: IInteractiveCanvas, fabricObject: fabric.Rect, persistedField?: CanvasObjectData);
|
|
28
|
+
/**
|
|
29
|
+
* @override
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
32
|
+
getStrokeWidth(): number;
|
|
33
|
+
/**
|
|
34
|
+
* @override
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
getStrokeWidth$(): Observable<number>;
|
|
38
|
+
/**
|
|
39
|
+
* @override
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
setStrokeWidth(width: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* @override
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
getColor(): string;
|
|
48
|
+
/**
|
|
49
|
+
* @override
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
setColor(color: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* @override
|
|
55
|
+
* @inheritDoc
|
|
56
|
+
*/
|
|
57
|
+
centerHorizontally(): void;
|
|
58
|
+
/**
|
|
59
|
+
* @override
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
centerVertically(): void;
|
|
63
|
+
/**
|
|
64
|
+
* @override
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
nudgeUp(): void;
|
|
68
|
+
/**
|
|
69
|
+
* @override
|
|
70
|
+
* @inheritDoc
|
|
71
|
+
*/
|
|
72
|
+
nudgeDown(): void;
|
|
73
|
+
/**
|
|
74
|
+
* @override
|
|
75
|
+
* @inheritDoc
|
|
76
|
+
*/
|
|
77
|
+
nudgeLeft(): void;
|
|
78
|
+
/**
|
|
79
|
+
* @override
|
|
80
|
+
* @inheritDoc
|
|
81
|
+
*/
|
|
82
|
+
nudgeRight(): void;
|
|
83
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { TextAlignment } from "..";
|
|
2
|
-
/**
|
|
3
|
-
* Defines the set of behaviors that can be adjusted on the interactive canvas, and provides an interface for grouping feature settings into a reusable profile.
|
|
4
|
-
*/
|
|
5
|
-
export interface ICanvasProfile {
|
|
6
|
-
readonly allowMultiSelect: boolean;
|
|
7
|
-
readonly allowObjectsToLeaveCanvas: boolean;
|
|
8
|
-
readonly enterTextEditImmediatelyOnSelect: boolean;
|
|
9
|
-
readonly allowMove: boolean;
|
|
10
|
-
readonly allowRotate: boolean;
|
|
11
|
-
readonly allowScale: boolean;
|
|
12
|
-
readonly defaultFont?: string;
|
|
13
|
-
readonly defaultFontSize: number;
|
|
14
|
-
readonly defaultFontColor: string;
|
|
15
|
-
readonly defaultLineHeight: number;
|
|
16
|
-
readonly defaultCharacterSpacing: number;
|
|
17
|
-
readonly defaultTextAlignment: TextAlignment;
|
|
18
|
-
readonly defaultBorderColor: string;
|
|
19
|
-
readonly defaultBorderWidth: number;
|
|
20
|
-
readonly defaultCutoffColor: string;
|
|
21
|
-
readonly defaultCutoffWidth: number;
|
|
22
|
-
}
|
|
1
|
+
import { TextAlignment } from "..";
|
|
2
|
+
/**
|
|
3
|
+
* Defines the set of behaviors that can be adjusted on the interactive canvas, and provides an interface for grouping feature settings into a reusable profile.
|
|
4
|
+
*/
|
|
5
|
+
export interface ICanvasProfile {
|
|
6
|
+
readonly allowMultiSelect: boolean;
|
|
7
|
+
readonly allowObjectsToLeaveCanvas: boolean;
|
|
8
|
+
readonly enterTextEditImmediatelyOnSelect: boolean;
|
|
9
|
+
readonly allowMove: boolean;
|
|
10
|
+
readonly allowRotate: boolean;
|
|
11
|
+
readonly allowScale: boolean;
|
|
12
|
+
readonly defaultFont?: string;
|
|
13
|
+
readonly defaultFontSize: number;
|
|
14
|
+
readonly defaultFontColor: string;
|
|
15
|
+
readonly defaultLineHeight: number;
|
|
16
|
+
readonly defaultCharacterSpacing: number;
|
|
17
|
+
readonly defaultTextAlignment: TextAlignment;
|
|
18
|
+
readonly defaultBorderColor: string;
|
|
19
|
+
readonly defaultBorderWidth: number;
|
|
20
|
+
readonly defaultCutoffColor: string;
|
|
21
|
+
readonly defaultCutoffWidth: number;
|
|
22
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { TextAlignment } from "..";
|
|
2
|
-
import { ICanvasProfile } from "./canvas-profile.interface";
|
|
3
|
-
/**
|
|
4
|
-
* Profile with as many features disabled as possible.
|
|
5
|
-
*/
|
|
6
|
-
export declare class DefaultCanvasProfile implements ICanvasProfile {
|
|
7
|
-
readonly allowMultiSelect: boolean;
|
|
8
|
-
readonly enterTextEditImmediatelyOnSelect: boolean;
|
|
9
|
-
readonly allowObjectsToLeaveCanvas: boolean;
|
|
10
|
-
readonly allowMove: boolean;
|
|
11
|
-
readonly allowRotate: boolean;
|
|
12
|
-
readonly allowScale: boolean;
|
|
13
|
-
readonly defaultFont?: string;
|
|
14
|
-
readonly defaultFontSize: number;
|
|
15
|
-
readonly defaultFontColor: string;
|
|
16
|
-
readonly defaultLineHeight: number;
|
|
17
|
-
readonly defaultCharacterSpacing: number;
|
|
18
|
-
readonly defaultTextAlignment: TextAlignment;
|
|
19
|
-
readonly defaultBorderColor: string;
|
|
20
|
-
readonly defaultBorderWidth: number;
|
|
21
|
-
readonly defaultCutoffColor: string;
|
|
22
|
-
readonly defaultCutoffWidth: number;
|
|
23
|
-
}
|
|
1
|
+
import { TextAlignment } from "..";
|
|
2
|
+
import { ICanvasProfile } from "./canvas-profile.interface";
|
|
3
|
+
/**
|
|
4
|
+
* Profile with as many features disabled as possible.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DefaultCanvasProfile implements ICanvasProfile {
|
|
7
|
+
readonly allowMultiSelect: boolean;
|
|
8
|
+
readonly enterTextEditImmediatelyOnSelect: boolean;
|
|
9
|
+
readonly allowObjectsToLeaveCanvas: boolean;
|
|
10
|
+
readonly allowMove: boolean;
|
|
11
|
+
readonly allowRotate: boolean;
|
|
12
|
+
readonly allowScale: boolean;
|
|
13
|
+
readonly defaultFont?: string;
|
|
14
|
+
readonly defaultFontSize: number;
|
|
15
|
+
readonly defaultFontColor: string;
|
|
16
|
+
readonly defaultLineHeight: number;
|
|
17
|
+
readonly defaultCharacterSpacing: number;
|
|
18
|
+
readonly defaultTextAlignment: TextAlignment;
|
|
19
|
+
readonly defaultBorderColor: string;
|
|
20
|
+
readonly defaultBorderWidth: number;
|
|
21
|
+
readonly defaultCutoffColor: string;
|
|
22
|
+
readonly defaultCutoffWidth: number;
|
|
23
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export interface ICanvasDimensionRestrictions {
|
|
2
|
-
readonly width?: {
|
|
3
|
-
min?: number;
|
|
4
|
-
max?: number;
|
|
5
|
-
};
|
|
6
|
-
readonly height?: {
|
|
7
|
-
min?: number;
|
|
8
|
-
max?: number;
|
|
9
|
-
};
|
|
10
|
-
readonly volume?: {
|
|
11
|
-
min?: number;
|
|
12
|
-
max?: number;
|
|
13
|
-
};
|
|
14
|
-
readonly fixed?: boolean;
|
|
15
|
-
}
|
|
1
|
+
export interface ICanvasDimensionRestrictions {
|
|
2
|
+
readonly width?: {
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
};
|
|
6
|
+
readonly height?: {
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
};
|
|
10
|
+
readonly volume?: {
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
};
|
|
14
|
+
readonly fixed?: boolean;
|
|
15
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export interface ICanvasDimensions {
|
|
2
|
-
readonly width: number;
|
|
3
|
-
readonly widthPx: number;
|
|
4
|
-
readonly widthMm?: number;
|
|
5
|
-
readonly widthUnit: string;
|
|
6
|
-
readonly height: number;
|
|
7
|
-
readonly heightPx: number;
|
|
8
|
-
readonly heightMm?: number;
|
|
9
|
-
readonly heightUnit: string;
|
|
10
|
-
withSize(width: number, height: number): ICanvasDimensions;
|
|
11
|
-
/**
|
|
12
|
-
* Convert a number of pixels on the width to millimeters.
|
|
13
|
-
* @param px Pixel count.
|
|
14
|
-
*/
|
|
15
|
-
widthPxToMm(px: number): number | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Convert a number of pixels on the height to millimeters.
|
|
18
|
-
* @param px Pixel count.
|
|
19
|
-
*/
|
|
20
|
-
heightPxToMm(px: number): number | undefined;
|
|
21
|
-
}
|
|
1
|
+
export interface ICanvasDimensions {
|
|
2
|
+
readonly width: number;
|
|
3
|
+
readonly widthPx: number;
|
|
4
|
+
readonly widthMm?: number;
|
|
5
|
+
readonly widthUnit: string;
|
|
6
|
+
readonly height: number;
|
|
7
|
+
readonly heightPx: number;
|
|
8
|
+
readonly heightMm?: number;
|
|
9
|
+
readonly heightUnit: string;
|
|
10
|
+
withSize(width: number, height: number): ICanvasDimensions;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a number of pixels on the width to millimeters.
|
|
13
|
+
* @param px Pixel count.
|
|
14
|
+
*/
|
|
15
|
+
widthPxToMm(px: number): number | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Convert a number of pixels on the height to millimeters.
|
|
18
|
+
* @param px Pixel count.
|
|
19
|
+
*/
|
|
20
|
+
heightPxToMm(px: number): number | undefined;
|
|
21
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ICanvasDimensions } from "./canvas-dimensions.interface";
|
|
2
|
-
import { CanvasObjectData } from "..";
|
|
3
|
-
/**
|
|
4
|
-
* Serialized canvas state that can be used to save the canvas.
|
|
5
|
-
*/
|
|
6
|
-
export interface ICanvasState {
|
|
7
|
-
readonly dimensions: ICanvasDimensions;
|
|
8
|
-
readonly canvasJson: string;
|
|
9
|
-
readonly objects: CanvasObjectData[];
|
|
10
|
-
readonly backgroundColor?: string;
|
|
11
|
-
}
|
|
1
|
+
import { ICanvasDimensions } from "./canvas-dimensions.interface";
|
|
2
|
+
import { CanvasObjectData } from "..";
|
|
3
|
+
/**
|
|
4
|
+
* Serialized canvas state that can be used to save the canvas.
|
|
5
|
+
*/
|
|
6
|
+
export interface ICanvasState {
|
|
7
|
+
readonly dimensions: ICanvasDimensions;
|
|
8
|
+
readonly canvasJson: string;
|
|
9
|
+
readonly objects: CanvasObjectData[];
|
|
10
|
+
readonly backgroundColor?: string;
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface IDimensionRestrictions {
|
|
2
|
-
minWidth: number;
|
|
3
|
-
minHeight: number;
|
|
4
|
-
maxWidth?: number;
|
|
5
|
-
maxHeight?: number;
|
|
6
|
-
}
|
|
1
|
+
export interface IDimensionRestrictions {
|
|
2
|
+
minWidth: number;
|
|
3
|
+
minHeight: number;
|
|
4
|
+
maxWidth?: number;
|
|
5
|
+
maxHeight?: number;
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare enum ImageType {
|
|
2
|
-
DEFAULT = "DEFAULT",
|
|
3
|
-
BACKGROUND = "BACKGROUND",
|
|
4
|
-
LOGO = "LOGO",
|
|
5
|
-
PHOTO = "PHOTO"
|
|
6
|
-
}
|
|
1
|
+
export declare enum ImageType {
|
|
2
|
+
DEFAULT = "DEFAULT",
|
|
3
|
+
BACKGROUND = "BACKGROUND",
|
|
4
|
+
LOGO = "LOGO",
|
|
5
|
+
PHOTO = "PHOTO"
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface IMargin {
|
|
2
|
-
top?: number | null;
|
|
3
|
-
right?: number | null;
|
|
4
|
-
bottom?: number | null;
|
|
5
|
-
left?: number | null;
|
|
6
|
-
}
|
|
1
|
+
export interface IMargin {
|
|
2
|
+
top?: number | null;
|
|
3
|
+
right?: number | null;
|
|
4
|
+
bottom?: number | null;
|
|
5
|
+
left?: number | null;
|
|
6
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export interface IObjectDimensions {
|
|
2
|
-
readonly top: {
|
|
3
|
-
readonly px: number;
|
|
4
|
-
readonly mm: number;
|
|
5
|
-
};
|
|
6
|
-
readonly left: {
|
|
7
|
-
readonly px: number;
|
|
8
|
-
readonly mm: number;
|
|
9
|
-
};
|
|
10
|
-
readonly width: {
|
|
11
|
-
readonly px: number;
|
|
12
|
-
readonly mm: number;
|
|
13
|
-
};
|
|
14
|
-
readonly height: {
|
|
15
|
-
readonly px: number;
|
|
16
|
-
readonly mm: number;
|
|
17
|
-
};
|
|
18
|
-
readonly angle: number;
|
|
19
|
-
readonly scale: {
|
|
20
|
-
readonly x: number;
|
|
21
|
-
readonly y: number;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
1
|
+
export interface IObjectDimensions {
|
|
2
|
+
readonly top: {
|
|
3
|
+
readonly px: number;
|
|
4
|
+
readonly mm: number;
|
|
5
|
+
};
|
|
6
|
+
readonly left: {
|
|
7
|
+
readonly px: number;
|
|
8
|
+
readonly mm: number;
|
|
9
|
+
};
|
|
10
|
+
readonly width: {
|
|
11
|
+
readonly px: number;
|
|
12
|
+
readonly mm: number;
|
|
13
|
+
};
|
|
14
|
+
readonly height: {
|
|
15
|
+
readonly px: number;
|
|
16
|
+
readonly mm: number;
|
|
17
|
+
};
|
|
18
|
+
readonly angle: number;
|
|
19
|
+
readonly scale: {
|
|
20
|
+
readonly x: number;
|
|
21
|
+
readonly y: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare enum ObjectType {
|
|
2
|
-
TEXT = "TEXT",
|
|
3
|
-
BORDER = "BORDER",
|
|
4
|
-
IMAGE = "IMAGE",
|
|
5
|
-
RECTANGLE = "RECTANGLE",
|
|
6
|
-
LIBRARY_IMAGE = "LIBRARY_IMAGE",
|
|
7
|
-
CUTOFF = "CUTOFF",
|
|
8
|
-
VERTICAL_RULE = "VERTICAL_RULE",
|
|
9
|
-
HORIZONTAL_RULE = "HORIZONTAL_RULE",
|
|
10
|
-
RICH_TEXT = "RICH_TEXT",
|
|
11
|
-
BACKGROUND_IMAGE = "BACKGROUND_IMAGE"
|
|
12
|
-
}
|
|
1
|
+
export declare enum ObjectType {
|
|
2
|
+
TEXT = "TEXT",
|
|
3
|
+
BORDER = "BORDER",
|
|
4
|
+
IMAGE = "IMAGE",
|
|
5
|
+
RECTANGLE = "RECTANGLE",
|
|
6
|
+
LIBRARY_IMAGE = "LIBRARY_IMAGE",
|
|
7
|
+
CUTOFF = "CUTOFF",
|
|
8
|
+
VERTICAL_RULE = "VERTICAL_RULE",
|
|
9
|
+
HORIZONTAL_RULE = "HORIZONTAL_RULE",
|
|
10
|
+
RICH_TEXT = "RICH_TEXT",
|
|
11
|
+
BACKGROUND_IMAGE = "BACKGROUND_IMAGE"
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRect } from "./rect.interface";
|
|
2
|
-
export interface IOverflow extends IRect {
|
|
3
|
-
readonly hasOverflow: boolean;
|
|
4
|
-
}
|
|
1
|
+
import { IRect } from "./rect.interface";
|
|
2
|
+
export interface IOverflow extends IRect {
|
|
3
|
+
readonly hasOverflow: boolean;
|
|
4
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface IPosition {
|
|
2
|
-
readonly top?: number;
|
|
3
|
-
readonly left?: number;
|
|
4
|
-
readonly width?: number;
|
|
5
|
-
readonly height?: number;
|
|
6
|
-
readonly angle?: number;
|
|
7
|
-
readonly scaleX?: number;
|
|
8
|
-
readonly scaleY?: number;
|
|
9
|
-
}
|
|
1
|
+
export interface IPosition {
|
|
2
|
+
readonly top?: number;
|
|
3
|
+
readonly left?: number;
|
|
4
|
+
readonly width?: number;
|
|
5
|
+
readonly height?: number;
|
|
6
|
+
readonly angle?: number;
|
|
7
|
+
readonly scaleX?: number;
|
|
8
|
+
readonly scaleY?: number;
|
|
9
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface IRect {
|
|
2
|
-
readonly top: number;
|
|
3
|
-
readonly right: number;
|
|
4
|
-
readonly bottom: number;
|
|
5
|
-
readonly left: number;
|
|
6
|
-
}
|
|
1
|
+
export interface IRect {
|
|
2
|
+
readonly top: number;
|
|
3
|
+
readonly right: number;
|
|
4
|
+
readonly bottom: number;
|
|
5
|
+
readonly left: number;
|
|
6
|
+
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import { ICanvasObject, ITextSelection } from "..";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { ICanvasObject, ITextSelection } from "..";
|
|
2
|
+
import { IEvent } from "fabric/fabric-impl";
|
|
3
|
+
export interface ISelectionData {
|
|
4
|
+
/**
|
|
5
|
+
* The currently selected fields.
|
|
6
|
+
*/
|
|
7
|
+
readonly objects: ICanvasObject[];
|
|
8
|
+
/**
|
|
9
|
+
* True if there is nothing selected.
|
|
10
|
+
*/
|
|
11
|
+
readonly empty: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* True if text is currently being edited.
|
|
14
|
+
*/
|
|
15
|
+
readonly isText: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Text selection data.
|
|
18
|
+
*/
|
|
19
|
+
readonly textSelection: ITextSelection | null;
|
|
20
|
+
/**
|
|
21
|
+
* Set raw event
|
|
22
|
+
*/
|
|
23
|
+
setEvent(event: IEvent<MouseEvent>): void;
|
|
24
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare type TextAlignment = "left" | "center" | "right" | "justify";
|
|
1
|
+
export declare type TextAlignment = "left" | "center" | "right" | "justify";
|
package/dist/undo-stack.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { ICanvasState } from "./types/canvas-state.interface";
|
|
2
|
-
import { IInteractiveCanvas } from "./interactive-canvas.interface";
|
|
3
|
-
import { IUndoStack } from "./undo-stack.interface";
|
|
4
|
-
export declare class UndoStack implements IUndoStack {
|
|
5
|
-
protected canvas: IInteractiveCanvas;
|
|
6
|
-
private readonly size;
|
|
7
|
-
private undoStates;
|
|
8
|
-
private redoStates;
|
|
9
|
-
private lastState;
|
|
10
|
-
constructor(canvas: IInteractiveCanvas, size?: number);
|
|
11
|
-
/**
|
|
12
|
-
* @override
|
|
13
|
-
* @inheritDoc
|
|
14
|
-
*/
|
|
15
|
-
save(state: ICanvasState): void;
|
|
16
|
-
/**
|
|
17
|
-
* @override
|
|
18
|
-
* @inheritDoc
|
|
19
|
-
*/
|
|
20
|
-
undo(): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* @override
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
*/
|
|
25
|
-
redo(): Promise<void>;
|
|
26
|
-
private clearRedoStackIfCanvasChanged;
|
|
27
|
-
}
|
|
1
|
+
import { ICanvasState } from "./types/canvas-state.interface";
|
|
2
|
+
import { IInteractiveCanvas } from "./interactive-canvas.interface";
|
|
3
|
+
import { IUndoStack } from "./undo-stack.interface";
|
|
4
|
+
export declare class UndoStack implements IUndoStack {
|
|
5
|
+
protected canvas: IInteractiveCanvas;
|
|
6
|
+
private readonly size;
|
|
7
|
+
private undoStates;
|
|
8
|
+
private redoStates;
|
|
9
|
+
private lastState;
|
|
10
|
+
constructor(canvas: IInteractiveCanvas, size?: number);
|
|
11
|
+
/**
|
|
12
|
+
* @override
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
save(state: ICanvasState): void;
|
|
16
|
+
/**
|
|
17
|
+
* @override
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
undo(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* @override
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
redo(): Promise<void>;
|
|
26
|
+
private clearRedoStackIfCanvasChanged;
|
|
27
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ICanvasState } from "./types/canvas-state.interface";
|
|
2
|
-
export interface IUndoStack {
|
|
3
|
-
save(state: ICanvasState): void;
|
|
4
|
-
undo(): Promise<void>;
|
|
5
|
-
redo(): Promise<void>;
|
|
6
|
-
}
|
|
1
|
+
import { ICanvasState } from "./types/canvas-state.interface";
|
|
2
|
+
export interface IUndoStack {
|
|
3
|
+
save(state: ICanvasState): void;
|
|
4
|
+
undo(): Promise<void>;
|
|
5
|
+
redo(): Promise<void>;
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leapfrog/interactive-canvas",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "Leapfrog interactive canvas",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"watch": "rollup -cw"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@types/fabric": "^
|
|
16
|
+
"@types/fabric": "^5.3.0",
|
|
17
17
|
"@types/lodash": "^4.14.153",
|
|
18
18
|
"typescript": "^3.5.3"
|
|
19
19
|
},
|