1 |
|
2 |
|
3 |
|
4 | export as namespace fabric;
|
5 |
|
6 | export const isLikelyNode: boolean;
|
7 | export const isTouchSupported: boolean;
|
8 | export const version: string;
|
9 | export const iMatrix: number[];
|
10 | export let textureSize: number;
|
11 | export let copiedText: string;
|
12 | export let copiedTextStyle: any[];
|
13 | export let charWidthsCache: {
|
14 | [key: string]: {
|
15 | [key: string]: {
|
16 | [key: string]: number;
|
17 | }
|
18 | }
|
19 | };
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | export function createCanvasForNode(width: number, height: number): Canvas;
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | export function createSVGRefElementsMarkup(canvas: StaticCanvas): string;
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | export function createSVGFontFacesMarkup(objects: Object[]): string;
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | export function loadSVGFromString(
|
44 | string: string,
|
45 | callback: (results: Object[], options: any) => void,
|
46 | reviver?: Function,
|
47 | ): void;
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | export function loadSVGFromURL(
|
59 | url: string,
|
60 | callback: (results: Object[], options: any) => void,
|
61 | reviver?: Function,
|
62 | options?: { crossOrigin?: string | undefined },
|
63 | ): void;
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | export function getCSSRules(doc: SVGElement): any;
|
69 |
|
70 | export function parseElements(elements: any[], callback: Function, options: any, reviver?: Function): void;
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | export function parsePointsAttribute(points: string): any[];
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | export function parseStyleAttribute(element: SVGElement): any;
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | export function parseElements(elements: SVGElement[], callback: Function, options?: any, reviver?: Function): void;
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | export function parseAttributes(element: HTMLElement, attributes: string[], svgUid?: string): { [key: string]: string };
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | export function getGradientDefs(doc: SVGElement): { [key: string]: any };
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 | export function parseFontDeclaration(value: string, oStyle: any): void;
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | export function parseSVGDocument(
|
114 | doc: SVGElement,
|
115 | callback: (results: Object[], options: any) => void,
|
116 | reviver?: Function,
|
117 | ): void;
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | export function parseTransformAttribute(attributeValue: string): number[];
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 | export function log(...values: any[]): void;
|
130 |
|
131 |
|
132 |
|
133 | export function warn(...values: any[]): void;
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 | interface IDataURLOptions {
|
140 | |
141 |
|
142 |
|
143 | format?: string | undefined;
|
144 | |
145 |
|
146 |
|
147 | quality?: number | undefined;
|
148 | |
149 |
|
150 |
|
151 | multiplier?: number | undefined;
|
152 | |
153 |
|
154 |
|
155 | left?: number | undefined;
|
156 | |
157 |
|
158 |
|
159 | top?: number | undefined;
|
160 | |
161 |
|
162 |
|
163 | width?: number | undefined;
|
164 | |
165 |
|
166 |
|
167 | height?: number | undefined;
|
168 | enableRetinaScaling?: boolean | undefined;
|
169 | withoutTransform?: boolean | undefined;
|
170 | withoutShadow?: boolean | undefined;
|
171 | }
|
172 |
|
173 | interface IEvent<E extends Event = Event> {
|
174 | e: E;
|
175 | target?: Object | undefined;
|
176 | subTargets?: Object[] | undefined;
|
177 | button?: number | undefined;
|
178 | isClick?: boolean | undefined;
|
179 | pointer?: Point | undefined;
|
180 | absolutePointer?: Point | undefined;
|
181 | transform?: { corner: string; original: Object; originX: string; originY: string; width: number } | undefined;
|
182 | }
|
183 |
|
184 | interface IFillOptions {
|
185 | |
186 |
|
187 |
|
188 | source: string | HTMLImageElement;
|
189 | |
190 |
|
191 |
|
192 | repeat?: string | undefined;
|
193 | |
194 |
|
195 |
|
196 | offsetX?: number | undefined;
|
197 | |
198 |
|
199 |
|
200 | offsetY?: number | undefined;
|
201 | }
|
202 |
|
203 | interface IToSVGOptions {
|
204 | |
205 |
|
206 |
|
207 | suppressPreamble?: boolean | undefined;
|
208 | |
209 |
|
210 |
|
211 | viewBox?: IViewBox | undefined;
|
212 | |
213 |
|
214 |
|
215 | encoding?: string | undefined;
|
216 | |
217 |
|
218 |
|
219 | width?: number | string | undefined;
|
220 | |
221 |
|
222 |
|
223 | height?: number | string | undefined;
|
224 | }
|
225 |
|
226 | interface IViewBox {
|
227 | |
228 |
|
229 |
|
230 | x: number;
|
231 | |
232 |
|
233 |
|
234 | y: number;
|
235 | |
236 |
|
237 |
|
238 | width: number;
|
239 | |
240 |
|
241 |
|
242 | height: number;
|
243 | }
|
244 |
|
245 |
|
246 |
|
247 |
|
248 | interface ICollection<T> {
|
249 | _objects: Object[];
|
250 |
|
251 | |
252 |
|
253 |
|
254 |
|
255 |
|
256 | add(...object: Object[]): T;
|
257 |
|
258 | |
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 | insertAt(object: Object, index: number, nonSplicing: boolean): T;
|
268 |
|
269 | |
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | remove(...object: Object[]): T;
|
276 |
|
277 | |
278 |
|
279 |
|
280 |
|
281 |
|
282 | forEachObject(callback: (element: Object, index: number, array: Object[]) => void, context?: any): T;
|
283 |
|
284 | |
285 |
|
286 |
|
287 |
|
288 |
|
289 | getObjects(type?: string): Object[];
|
290 |
|
291 | |
292 |
|
293 |
|
294 |
|
295 | item(index: number): T;
|
296 |
|
297 | |
298 |
|
299 |
|
300 |
|
301 | isEmpty(): boolean;
|
302 |
|
303 | |
304 |
|
305 |
|
306 |
|
307 | size(): number;
|
308 |
|
309 | |
310 |
|
311 |
|
312 |
|
313 |
|
314 | contains(object: Object): boolean;
|
315 |
|
316 | |
317 |
|
318 |
|
319 |
|
320 | complexity(): number;
|
321 | }
|
322 |
|
323 | interface IObservable<T> {
|
324 | |
325 |
|
326 |
|
327 |
|
328 |
|
329 | on(
|
330 | eventName:
|
331 | | 'mouse:up'
|
332 | | 'mouse:down'
|
333 | | 'mouse:move'
|
334 | | 'mouse:up:before'
|
335 | | 'mouse:down:before'
|
336 | | 'mouse:move:before'
|
337 | | 'mouse:dblclick'
|
338 | | 'mouse:over'
|
339 | | 'mouse:out',
|
340 | handler: (e: IEvent<MouseEvent>) => void,
|
341 | ): T;
|
342 | on(eventName: 'mouse:wheel', handler: (e: IEvent<WheelEvent>) => void): T;
|
343 | on(eventName: string, handler: (e: IEvent) => void): T;
|
344 |
|
345 | |
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 | off(eventName?: string | any, handler?: (e: IEvent) => void): T;
|
352 |
|
353 | |
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 | fire(eventName: string, options?: any): T;
|
362 | }
|
363 |
|
364 | interface Callbacks {
|
365 |
|
366 | onComplete?: Function | undefined;
|
367 |
|
368 | onChange?: Function | undefined;
|
369 | }
|
370 |
|
371 |
|
372 |
|
373 | interface ICanvasAnimation<T> {
|
374 | FX_DURATION: number;
|
375 | |
376 |
|
377 |
|
378 |
|
379 | fxCenterObjectH(object: Object, callbacks?: Callbacks): T;
|
380 |
|
381 | |
382 |
|
383 |
|
384 |
|
385 | fxCenterObjectV(object: Object, callbacks?: Callbacks): T;
|
386 |
|
387 | |
388 |
|
389 |
|
390 |
|
391 |
|
392 | fxRemove(object: Object): T;
|
393 |
|
394 | |
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 | fxStraightenObject(object: Object): T;
|
401 | }
|
402 | interface IObjectAnimation<T> {
|
403 | |
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 | animate(property: string, value: number | string, options?: IAnimationOptions): Object;
|
411 | |
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | animate(properties: { [key: string]: number | string }, options?: IAnimationOptions): Object;
|
418 | }
|
419 | interface IAnimationOptions {
|
420 | |
421 |
|
422 |
|
423 | from?: string | number | undefined;
|
424 | |
425 |
|
426 |
|
427 | duration?: number | undefined;
|
428 | |
429 |
|
430 |
|
431 | onChange?: Function | undefined;
|
432 | |
433 |
|
434 |
|
435 | onComplete?: Function | undefined;
|
436 |
|
437 | |
438 |
|
439 |
|
440 | easing?: Function | undefined;
|
441 | |
442 |
|
443 |
|
444 | by?: number | undefined;
|
445 | }
|
446 |
|
447 |
|
448 |
|
449 |
|
450 | export class Color {
|
451 | |
452 |
|
453 |
|
454 |
|
455 |
|
456 | constructor(color?: string);
|
457 |
|
458 | /**
|
459 | * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1])
|
460 | */
|
461 | getSource(): number[];
|
462 |
|
463 | /**
|
464 | * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1])
|
465 | */
|
466 | setSource(source: number[]): void;
|
467 |
|
468 | /**
|
469 | * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255)
|
470 | */
|
471 | toRgb(): string;
|
472 |
|
473 | /**
|
474 | * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1)
|
475 | */
|
476 | toRgba(): string;
|
477 |
|
478 | /**
|
479 | * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%)
|
480 | */
|
481 | toHsl(): string;
|
482 |
|
483 | /**
|
484 | * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1)
|
485 | */
|
486 | toHsla(): string;
|
487 |
|
488 | /**
|
489 | * Returns color represenation in HEX format ex: FF5555
|
490 | */
|
491 | toHex(): string;
|
492 |
|
493 | /**
|
494 | * Returns color representation in HEXA format
|
495 | * @return {String} ex: FF5555CC
|
496 | */
|
497 | toHexa(): string;
|
498 |
|
499 | |
500 |
|
501 |
|
502 | getAlpha(): number;
|
503 |
|
504 | |
505 |
|
506 |
|
507 |
|
508 | setAlpha(alpha: number): void;
|
509 |
|
510 | |
511 |
|
512 |
|
513 | toGrayscale(): Color;
|
514 |
|
515 | |
516 |
|
517 |
|
518 | toBlackWhite(threshold: number): Color;
|
519 | |
520 |
|
521 |
|
522 | overlayWith(otherColor: string | Color): Color;
|
523 |
|
524 | |
525 |
|
526 |
|
527 |
|
528 | static fromRgb(color: string): Color;
|
529 | |
530 |
|
531 |
|
532 |
|
533 | static fromRgba(color: string): Color;
|
534 | |
535 |
|
536 |
|
537 |
|
538 | static sourceFromRgb(color: string): number[];
|
539 | |
540 |
|
541 |
|
542 |
|
543 | static fromHsl(color: string): Color;
|
544 | |
545 |
|
546 |
|
547 |
|
548 | static fromHsla(color: string): Color;
|
549 | |
550 |
|
551 |
|
552 |
|
553 | static sourceFromHsl(color: string): number[];
|
554 | |
555 |
|
556 |
|
557 |
|
558 | static fromHex(color: string): Color;
|
559 |
|
560 | |
561 |
|
562 |
|
563 |
|
564 | static sourceFromHex(color: string): number[];
|
565 | |
566 |
|
567 |
|
568 | static fromSource(source: number[]): Color;
|
569 | |
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 | static reHex: RegExp;
|
576 | |
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 | static reHSLa: RegExp;
|
583 | |
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 | static reRGBa: RegExp;
|
590 | }
|
591 |
|
592 | interface IGradientOptionsCoords {
|
593 | x1?: number | undefined;
|
594 | y1?: number | undefined;
|
595 | x2?: number | undefined;
|
596 | y2?: number | undefined;
|
597 | r1?: number | undefined;
|
598 | r2?: number | undefined;
|
599 | }
|
600 |
|
601 | type IGradientOptionsColorStops = Array<{
|
602 | offset: number;
|
603 | color: string;
|
604 | }>;
|
605 |
|
606 | interface IGradientOptions {
|
607 | |
608 |
|
609 |
|
610 |
|
611 | offsetX?: number | undefined;
|
612 | |
613 |
|
614 |
|
615 |
|
616 | offsetY?: number | undefined;
|
617 | type?: string | undefined;
|
618 | coords?: IGradientOptionsCoords | undefined;
|
619 | |
620 |
|
621 |
|
622 | colorStops?: IGradientOptionsColorStops | undefined;
|
623 | gradientTransform?: any;
|
624 | }
|
625 |
|
626 | interface OGradientOptions {
|
627 | type?: string | undefined;
|
628 | x1?: number | undefined;
|
629 | y1?: number | undefined;
|
630 | x2?: number | undefined;
|
631 | y2?: number | undefined;
|
632 | r1?: number | undefined;
|
633 | r2?: number | undefined;
|
634 | colorStops?: {
|
635 | [key: string]: string;
|
636 | } | undefined;
|
637 | gradientTransform?: any;
|
638 | }
|
639 |
|
640 | export interface Gradient extends IGradientOptions {}
|
641 | export class Gradient {
|
642 | |
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 | constructor(options: {
|
660 | type?: string | undefined;
|
661 | gradientUnits?: any;
|
662 | offsetX?: any;
|
663 | offsetY?: any;
|
664 | colorStops?: IGradientOptionsColorStops | undefined;
|
665 | coords?: IGradientOptionsCoords | undefined;
|
666 | });
|
667 | /**
|
668 | * Adds another colorStop
|
669 | * @param colorStop Object with offset and color
|
670 | */
|
671 | addColorStop(colorStop: any): Gradient;
|
672 | /**
|
673 | * Returns object representation of a gradient
|
674 | */
|
675 | toObject(propertiesToInclude?: any): any;
|
676 | /**
|
677 | * Returns SVG representation of an gradient
|
678 | * @param {Object} object Object to create a gradient for
|
679 | * @return {String} SVG representation of an gradient (linear/radial)
|
680 | */
|
681 | toSVG(object: any): string;
|
682 | |
683 |
|
684 |
|
685 |
|
686 | toLive(ctx: CanvasRenderingContext2D): CanvasGradient;
|
687 | |
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 | static fromElement(el: SVGGradientElement, instance: Object): Gradient;
|
698 | }
|
699 | export class Intersection {
|
700 | constructor(status?: string);
|
701 | /**
|
702 | * Appends a point to intersection
|
703 | */
|
704 | appendPoint(point: Point): Intersection;
|
705 | /**
|
706 | * Appends points to intersection
|
707 | */
|
708 | appendPoints(points: Point[]): Intersection;
|
709 | /**
|
710 | * Checks if one line intersects another
|
711 | */
|
712 | static intersectLineLine(a1: Point, a2: Point, b1: Point, b2: Point): Intersection;
|
713 | /**
|
714 | * Checks if line intersects polygon
|
715 | */
|
716 | static intersectLinePolygon(a1: Point, a2: Point, points: Point[]): Intersection;
|
717 | /**
|
718 | * Checks if polygon intersects another polygon
|
719 | */
|
720 | static intersectPolygonPolygon(points1: Point[], points2: Point[]): Intersection;
|
721 | /**
|
722 | * Checks if polygon intersects rectangle
|
723 | */
|
724 | static intersectPolygonRectangle(points: Point[], r1: number, r2: number): Intersection;
|
725 | }
|
726 |
|
727 | interface IPatternOptions {
|
728 | |
729 |
|
730 |
|
731 | repeat?: string | undefined;
|
732 |
|
733 | |
734 |
|
735 |
|
736 | offsetX?: number | undefined;
|
737 |
|
738 | |
739 |
|
740 |
|
741 | offsetY?: number | undefined;
|
742 | |
743 |
|
744 |
|
745 |
|
746 |
|
747 | crossOrigin?: '' | 'anonymous' | 'use-credentials' | undefined;
|
748 | |
749 |
|
750 |
|
751 | patternTransform?: number[] | undefined;
|
752 | |
753 |
|
754 |
|
755 | source: string | HTMLImageElement;
|
756 | }
|
757 | export interface Pattern extends IPatternOptions {}
|
758 | export class Pattern {
|
759 | |
760 |
|
761 |
|
762 | id: number;
|
763 |
|
764 | constructor(options?: IPatternOptions);
|
765 | /**
|
766 | * Returns object representation of a pattern
|
767 | * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output
|
768 | * @return {Object} Object representation of a pattern instance
|
769 | */
|
770 | toObject(propertiesToInclude: any): any;
|
771 | |
772 |
|
773 |
|
774 |
|
775 |
|
776 | toSVG(object: Object): string;
|
777 | setOptions(options: IPatternOptions): void;
|
778 | |
779 |
|
780 |
|
781 |
|
782 |
|
783 | toLive(ctx: CanvasRenderingContext2D): CanvasPattern;
|
784 | }
|
785 | interface IPoint {
|
786 | x: number;
|
787 | y: number;
|
788 | }
|
789 | export class Point implements IPoint {
|
790 | x: number;
|
791 | y: number;
|
792 | type: string;
|
793 | constructor(x: number, y: number);
|
794 | /**
|
795 | * Adds another point to this one and returns another one
|
796 | * @param {fabric.Point} that
|
797 | * @return {fabric.Point} new Point instance with added values
|
798 | */
|
799 | add(that: IPoint): Point;
|
800 | |
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 | addEquals(that: IPoint): Point;
|
807 | |
808 |
|
809 |
|
810 |
|
811 |
|
812 | scalarAdd(scalar: number): Point;
|
813 | |
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 | scalarAddEquals(scalar: number): Point;
|
820 | |
821 |
|
822 |
|
823 |
|
824 |
|
825 | subtract(that: IPoint): Point;
|
826 | |
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 | subtractEquals(that: IPoint): Point;
|
833 | |
834 |
|
835 |
|
836 |
|
837 |
|
838 | scalarSubtract(scalar: number): Point;
|
839 | |
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 | scalarSubtractEquals(scalar: number): Point;
|
846 | |
847 |
|
848 |
|
849 |
|
850 |
|
851 | multiply(scalar: number): Point;
|
852 | |
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 | multiplyEquals(scalar: number): Point;
|
859 | |
860 |
|
861 |
|
862 |
|
863 |
|
864 | divide(scalar: number): Point;
|
865 | |
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 | divideEquals(scalar: number): Point;
|
872 | |
873 |
|
874 |
|
875 |
|
876 |
|
877 | eq(that: IPoint): Point;
|
878 | |
879 |
|
880 |
|
881 |
|
882 |
|
883 | lt(that: IPoint): Point;
|
884 | |
885 |
|
886 |
|
887 |
|
888 |
|
889 | lte(that: IPoint): Point;
|
890 | |
891 |
|
892 |
|
893 |
|
894 |
|
895 | gt(that: IPoint): Point;
|
896 | |
897 |
|
898 |
|
899 |
|
900 |
|
901 | gte(that: IPoint): Point;
|
902 | |
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 | lerp(that: IPoint, t: number): Point;
|
909 | |
910 |
|
911 |
|
912 |
|
913 |
|
914 | distanceFrom(that: IPoint): number;
|
915 | |
916 |
|
917 |
|
918 |
|
919 |
|
920 | midPointFrom(that: IPoint): Point;
|
921 | |
922 |
|
923 |
|
924 |
|
925 |
|
926 | min(that: IPoint): Point;
|
927 | |
928 |
|
929 |
|
930 |
|
931 |
|
932 | max(that: IPoint): Point;
|
933 | |
934 |
|
935 |
|
936 |
|
937 | toString(): string;
|
938 | |
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 | setXY(x: number, y: number): Point;
|
945 | |
946 |
|
947 |
|
948 |
|
949 |
|
950 | setX(x: number): Point;
|
951 | |
952 |
|
953 |
|
954 |
|
955 |
|
956 | setY(y: number): Point;
|
957 | |
958 |
|
959 |
|
960 |
|
961 |
|
962 | setFromPoint(that: IPoint): Point;
|
963 | |
964 |
|
965 |
|
966 |
|
967 | swap(that: IPoint): Point;
|
968 | |
969 |
|
970 |
|
971 |
|
972 | clone(): Point;
|
973 | }
|
974 | interface IShadowOptions {
|
975 | |
976 |
|
977 |
|
978 | color?: string | undefined;
|
979 | |
980 |
|
981 |
|
982 | blur?: number | undefined;
|
983 | |
984 |
|
985 |
|
986 | offsetX?: number | undefined;
|
987 | |
988 |
|
989 |
|
990 | offsetY?: number | undefined;
|
991 | |
992 |
|
993 |
|
994 | affectStroke?: boolean | undefined;
|
995 | |
996 |
|
997 |
|
998 | includeDefaultValues?: boolean | undefined;
|
999 | |
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 | nonScaling?: boolean | undefined;
|
1007 | }
|
1008 | export interface Shadow extends IShadowOptions {}
|
1009 | export class Shadow {
|
1010 | constructor(options?: IShadowOptions | string);
|
1011 | initialize(options?: IShadowOptions | string): Shadow;
|
1012 | /**
|
1013 | * Returns a string representation of an instance
|
1014 | * @see http://www.w3.org/TR/css-text-decor-3/#text-shadow
|
1015 | * @return {String} Returns CSS3 text-shadow declaration
|
1016 | */
|
1017 | toString(): string;
|
1018 | |
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 | toSVG(object: Object): string;
|
1024 | |
1025 |
|
1026 |
|
1027 |
|
1028 | toObject(): any;
|
1029 | |
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 | static reOffsetsAndBlur: RegExp;
|
1036 | }
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 | interface ICanvasDimensions {
|
1042 | |
1043 |
|
1044 |
|
1045 | width: number | string;
|
1046 | |
1047 |
|
1048 |
|
1049 | height: number | string;
|
1050 | }
|
1051 | interface ICanvasDimensionsOptions {
|
1052 | |
1053 |
|
1054 |
|
1055 | backstoreOnly?: boolean | undefined;
|
1056 | |
1057 |
|
1058 |
|
1059 | cssOnly?: boolean | undefined;
|
1060 | }
|
1061 |
|
1062 | interface IStaticCanvasOptions {
|
1063 | |
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 | backgroundColor?: string | Pattern | undefined;
|
1069 | |
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 | backgroundImage?: Image | string | undefined;
|
1081 | |
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 | overlayColor?: string | Pattern | undefined;
|
1088 | |
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 | overlayImage?: Image | undefined;
|
1100 | |
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 | includeDefaultValues?: boolean | undefined;
|
1106 | |
1107 |
|
1108 |
|
1109 |
|
1110 | stateful?: boolean | undefined;
|
1111 | |
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 | renderOnAddRemove?: boolean | undefined;
|
1121 | |
1122 |
|
1123 |
|
1124 |
|
1125 | controlsAboveOverlay?: boolean | undefined;
|
1126 | |
1127 |
|
1128 |
|
1129 |
|
1130 | allowTouchScrolling?: boolean | undefined;
|
1131 | |
1132 |
|
1133 |
|
1134 | imageSmoothingEnabled?: boolean | undefined;
|
1135 | |
1136 |
|
1137 |
|
1138 | viewportTransform?: number[] | undefined;
|
1139 | |
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 | backgroundVpt?: boolean | undefined;
|
1145 | |
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 | overlayVpt?: boolean | undefined;
|
1151 | |
1152 |
|
1153 |
|
1154 |
|
1155 | enableRetinaScaling?: boolean | undefined;
|
1156 | |
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 | vptCoords?: {
|
1166 | tl: { x: number; y: number };
|
1167 | tr: { x: number; y: number };
|
1168 | bl: { x: number; y: number };
|
1169 | br: { x: number; y: number };
|
1170 | } | undefined;
|
1171 | |
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 | skipOffscreen?: boolean | undefined;
|
1181 | |
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 | clipPath?: Object | undefined;
|
1189 | |
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 | svgViewportTransformation?: boolean | undefined;
|
1195 | }
|
1196 |
|
1197 | export interface FreeDrawingBrush {
|
1198 | |
1199 |
|
1200 |
|
1201 | color: string;
|
1202 |
|
1203 | |
1204 |
|
1205 |
|
1206 | width: number;
|
1207 | }
|
1208 |
|
1209 | export interface StaticCanvas
|
1210 | extends IObservable<StaticCanvas>,
|
1211 | IStaticCanvasOptions,
|
1212 | ICollection<StaticCanvas>,
|
1213 | ICanvasAnimation<StaticCanvas> {}
|
1214 | export class StaticCanvas {
|
1215 | |
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 | constructor(element: HTMLCanvasElement | string | null, options?: ICanvasOptions);
|
1222 |
|
1223 | _activeObject?: Object | Group | undefined;
|
1224 |
|
1225 | freeDrawingBrush: FreeDrawingBrush;
|
1226 |
|
1227 | /**
|
1228 | * Calculates canvas element offset relative to the document
|
1229 | * This method is also attached as "resize" event handler of window
|
1230 | * @return {fabric.Canvas} instance
|
1231 | * @chainable
|
1232 | */
|
1233 | calcOffset(): Canvas;
|
1234 |
|
1235 | |
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 | setOverlayImage(image: Image | string, callback: Function, options?: IImageOptions): Canvas;
|
1244 |
|
1245 | |
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | setBackgroundImage(image: Image | string, callback: Function, options?: IImageOptions): Canvas;
|
1254 |
|
1255 | |
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 | setOverlayColor(overlayColor: string | Pattern, callback: Function): Canvas;
|
1263 |
|
1264 | |
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 | setBackgroundColor(backgroundColor: string | Pattern | Gradient, callback: Function): Canvas;
|
1272 |
|
1273 | |
1274 |
|
1275 |
|
1276 |
|
1277 | getWidth(): number;
|
1278 |
|
1279 | |
1280 |
|
1281 |
|
1282 |
|
1283 | getHeight(): number;
|
1284 |
|
1285 | |
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 | setWidth(value: number | string, options?: ICanvasDimensionsOptions): Canvas;
|
1293 |
|
1294 | |
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 | setHeight(value: number | string, options?: ICanvasDimensionsOptions): Canvas;
|
1302 |
|
1303 | |
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 | setDimensions(dimensions: ICanvasDimensions, options?: ICanvasDimensionsOptions): Canvas;
|
1311 |
|
1312 | |
1313 |
|
1314 |
|
1315 | getZoom(): number;
|
1316 |
|
1317 | |
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 | setViewportTransform(vpt: number[]): Canvas;
|
1324 |
|
1325 | |
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 | zoomToPoint(point: IPoint, value: number): Canvas;
|
1333 |
|
1334 | |
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 | setZoom(value: number): Canvas;
|
1341 |
|
1342 | |
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 | absolutePan(point: IPoint): Canvas;
|
1349 |
|
1350 | |
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 | relativePan(point: IPoint): Canvas;
|
1357 |
|
1358 | |
1359 |
|
1360 |
|
1361 |
|
1362 | getElement(): HTMLCanvasElement;
|
1363 |
|
1364 | |
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 | clearContext(ctx: CanvasRenderingContext2D): Canvas;
|
1370 |
|
1371 | |
1372 |
|
1373 |
|
1374 |
|
1375 | getContext(): CanvasRenderingContext2D;
|
1376 |
|
1377 | |
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 | clear(): Canvas;
|
1383 |
|
1384 | |
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 | renderAll(): Canvas;
|
1390 |
|
1391 | |
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 | renderAndReset(): Canvas;
|
1402 |
|
1403 | |
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 | requestRenderAll(): Canvas;
|
1411 |
|
1412 | |
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 | calcViewportBoundaries(): { tl: Point; br: Point; tr: Point; bl: Point };
|
1420 |
|
1421 | |
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 | renderCanvas(ctx: CanvasRenderingContext2D, objects: Object[]): Canvas;
|
1429 |
|
1430 | |
1431 |
|
1432 |
|
1433 |
|
1434 | drawClipPathOnCanvas(ctx: CanvasRenderingContext2D): void;
|
1435 |
|
1436 | |
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 | getCenter(): { top: number; left: number };
|
1442 |
|
1443 | |
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 | centerObjectH(object: Object): Canvas;
|
1449 |
|
1450 | |
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 | centerObjectV(object: Object): Canvas;
|
1457 |
|
1458 | |
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 | centerObject(object: Object): Canvas;
|
1465 |
|
1466 | |
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 | viewportCenterObject(object: Object): Canvas;
|
1473 |
|
1474 | |
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 | viewportCenterObjectH(object: Object): Canvas;
|
1481 |
|
1482 | |
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 | viewportCenterObjectV(object: Object): Canvas;
|
1489 |
|
1490 | |
1491 |
|
1492 |
|
1493 |
|
1494 | getVpCenter(): Point;
|
1495 |
|
1496 | |
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 | toDatalessJSON(propertiesToInclude?: string[]): string;
|
1502 |
|
1503 | |
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 | toJSON(propertiesToInclude?: string[]): string;
|
1509 |
|
1510 | |
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 | toObject(propertiesToInclude?: string[]): any;
|
1516 |
|
1517 | |
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 | toDatalessObject(propertiesToInclude?: string[]): any;
|
1523 |
|
1524 | |
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 | toSVG(options?: IToSVGOptions, reviver?: Function): string;
|
1531 |
|
1532 | |
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 | sendToBack(object: Object): Canvas;
|
1540 |
|
1541 | |
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 | bringToFront(object: Object): Canvas;
|
1549 |
|
1550 | |
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 | sendBackwards(object: Object, intersecting?: boolean): Canvas;
|
1562 |
|
1563 | |
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 | bringForward(object: Object, intersecting?: boolean): Canvas;
|
1575 |
|
1576 | |
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 | moveTo(object: Object, index: number): Canvas;
|
1584 |
|
1585 | |
1586 |
|
1587 |
|
1588 |
|
1589 | dispose(): Canvas;
|
1590 |
|
1591 | |
1592 |
|
1593 |
|
1594 |
|
1595 | toString(): string;
|
1596 |
|
1597 | |
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 | static EMPTY_JSON: string;
|
1603 |
|
1604 | |
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 | static supports(methodName: 'getImageData' | 'toDataURL' | 'toDataURLWithQuality' | 'setLineDash'): boolean;
|
1614 |
|
1615 | |
1616 |
|
1617 |
|
1618 |
|
1619 | toDataURL(options?: IDataURLOptions): string;
|
1620 |
|
1621 | |
1622 |
|
1623 |
|
1624 |
|
1625 | static toJSON(propertiesToInclude?: string[]): string;
|
1626 |
|
1627 | |
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 | clone(callback?: any, properties?: string[]): void;
|
1633 |
|
1634 | |
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 | cloneWithoutData(callback?: any): void;
|
1641 |
|
1642 | |
1643 |
|
1644 |
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 | loadFromJSON(json: any, callback: Function, reviver?: Function): Canvas;
|
1653 |
|
1654 | |
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 | createSVGFontFacesMarkup(objects: any[]): string;
|
1663 | |
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 | createSVGRefElementsMarkup(): string;
|
1669 | |
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 | straightenObject(object: Object): Canvas;
|
1677 | }
|
1678 |
|
1679 | interface ICanvasOptions extends IStaticCanvasOptions {
|
1680 | |
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 | uniformScaling?: boolean | undefined;
|
1688 |
|
1689 | |
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 | uniScaleKey?: string | undefined;
|
1698 |
|
1699 | |
1700 |
|
1701 |
|
1702 |
|
1703 | centeredScaling?: boolean | undefined;
|
1704 |
|
1705 | |
1706 |
|
1707 |
|
1708 |
|
1709 | centeredRotation?: boolean | undefined;
|
1710 |
|
1711 | |
1712 |
|
1713 |
|
1714 | fill?: string | Pattern | Gradient | undefined;
|
1715 |
|
1716 | |
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 | centeredKey?: string | undefined;
|
1726 |
|
1727 | |
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 | altActionKey?: string | undefined;
|
1737 |
|
1738 | |
1739 |
|
1740 |
|
1741 | interactive?: boolean | undefined;
|
1742 |
|
1743 | |
1744 |
|
1745 |
|
1746 | selection?: boolean | undefined;
|
1747 |
|
1748 | |
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 | selectionKey?: string | string[] | undefined;
|
1759 |
|
1760 | |
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 | altSelectionKey?: string | null | undefined;
|
1773 |
|
1774 | |
1775 |
|
1776 |
|
1777 | selectionColor?: string | undefined;
|
1778 |
|
1779 | |
1780 |
|
1781 |
|
1782 |
|
1783 | selectionDashArray?: number[] | undefined;
|
1784 |
|
1785 | |
1786 |
|
1787 |
|
1788 | selectionBorderColor?: string | undefined;
|
1789 |
|
1790 | |
1791 |
|
1792 |
|
1793 | selectionLineWidth?: number | undefined;
|
1794 |
|
1795 | |
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 | selectionFullyContained?: boolean | undefined;
|
1801 |
|
1802 | |
1803 |
|
1804 |
|
1805 | hoverCursor?: string | undefined;
|
1806 |
|
1807 | |
1808 |
|
1809 |
|
1810 | moveCursor?: string | undefined;
|
1811 |
|
1812 | |
1813 |
|
1814 |
|
1815 | defaultCursor?: string | undefined;
|
1816 |
|
1817 | |
1818 |
|
1819 |
|
1820 | freeDrawingCursor?: string | undefined;
|
1821 |
|
1822 | |
1823 |
|
1824 |
|
1825 | rotationCursor?: string | undefined;
|
1826 |
|
1827 | |
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 | notAllowedCursor?: string | undefined;
|
1834 |
|
1835 | |
1836 |
|
1837 |
|
1838 | containerClass?: string | undefined;
|
1839 |
|
1840 | |
1841 |
|
1842 |
|
1843 | perPixelTargetFind?: boolean | undefined;
|
1844 |
|
1845 | |
1846 |
|
1847 |
|
1848 | targetFindTolerance?: number | undefined;
|
1849 |
|
1850 | |
1851 |
|
1852 |
|
1853 | skipTargetFind?: boolean | undefined;
|
1854 |
|
1855 | |
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 | isDrawingMode?: boolean | undefined;
|
1861 |
|
1862 | |
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 | preserveObjectStacking?: boolean | undefined;
|
1868 |
|
1869 | |
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 | snapAngle?: number | undefined;
|
1875 |
|
1876 | |
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 | snapThreshold?: null | number | undefined;
|
1884 |
|
1885 | |
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 | stopContextMenu?: boolean | undefined;
|
1892 |
|
1893 | |
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 | fireRightClick?: boolean | undefined;
|
1900 |
|
1901 | |
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 | fireMiddleClick?: boolean | undefined;
|
1908 |
|
1909 | |
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 | targets?: Object[] | undefined;
|
1916 |
|
1917 | |
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 | width?: number | undefined;
|
1923 |
|
1924 | |
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 | height?: number | undefined;
|
1930 | }
|
1931 | export interface Canvas extends StaticCanvas {}
|
1932 | export interface Canvas extends ICanvasOptions {}
|
1933 | export class Canvas {
|
1934 | |
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 | constructor(element: HTMLCanvasElement | string | null, options?: ICanvasOptions);
|
1940 |
|
1941 | /**
|
1942 | * When true, target detection is skipped when hovering over canvas. This can be used to improve performance.
|
1943 | * @type Boolean
|
1944 | * @default
|
1945 | */
|
1946 | skipTargetFind: boolean;
|
1947 | _activeObject: Object;
|
1948 | _objects: Object[];
|
1949 | targets: Object[];
|
1950 | /**
|
1951 | * Indicates which key enable alternative selection
|
1952 | * in case of target overlapping with active object
|
1953 | * values: 'altKey', 'shiftKey', 'ctrlKey'.
|
1954 | * For a series of reason that come from the general expectations on how
|
1955 | * things should work, this feature works only for preserveObjectStacking true.
|
1956 | * If `null` or 'none' or any other string that is not a modifier key
|
1957 | * feature is disabled.
|
1958 | * @since 1.6.5
|
1959 | * @type null|String
|
1960 | * @default
|
1961 | */
|
1962 | altSelectionKey?: string | undefined;
|
1963 |
|
1964 | /**
|
1965 | * Renders both the top canvas and the secondary container canvas.
|
1966 | * @return {fabric.Canvas} instance
|
1967 | * @chainable
|
1968 | */
|
1969 | renderAll(): Canvas;
|
1970 | |
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 | renderTop(): Canvas;
|
1977 | |
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 | containsPoint(e: Event, target: Object, point?: { x: number; y: number }): boolean;
|
1985 | |
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 | isTargetTransparent(target: Object, x: number, y: number): boolean;
|
1993 | |
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 | setCursor(value: string): void;
|
1999 | |
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 | findTarget(e: Event, skipGroup: boolean): Object | undefined;
|
2009 | |
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 | restorePointerVpt(pointer: IPoint): any;
|
2015 | |
2016 |
|
2017 |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 | getPointer(e: Event, ignoreZoom?: boolean): { x: number; y: number };
|
2034 | |
2035 |
|
2036 |
|
2037 |
|
2038 | getSelectionContext(): CanvasRenderingContext2D;
|
2039 | |
2040 |
|
2041 |
|
2042 |
|
2043 | getSelectionElement(): HTMLCanvasElement;
|
2044 | |
2045 |
|
2046 |
|
2047 |
|
2048 | getActiveObject(): Object;
|
2049 | |
2050 |
|
2051 |
|
2052 |
|
2053 | getActiveObjects(): Object[];
|
2054 | |
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 | setActiveObject(object: Object, e?: Event): Canvas;
|
2062 | |
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 | discardActiveObject(e?: Event): Canvas;
|
2072 | |
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 | dispose(): Canvas;
|
2078 | |
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 | clear(): Canvas;
|
2084 | |
2085 |
|
2086 |
|
2087 |
|
2088 | drawControls(ctx: CanvasRenderingContext2D): void;
|
2089 | |
2090 |
|
2091 |
|
2092 |
|
2093 | _setObjectScale(
|
2094 | localMouse: Point,
|
2095 | transform: any,
|
2096 | lockScalingX: boolean,
|
2097 | lockScalingY: boolean,
|
2098 | by: 'x' | 'y' | 'equally' | undefined,
|
2099 | lockScalingFlip: boolean,
|
2100 | _dim: Point,
|
2101 | ): boolean;
|
2102 | |
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 | _scaleObject(x: number, y: number, by?: 'x' | 'y' | 'equally'): boolean;
|
2112 | |
2113 |
|
2114 |
|
2115 |
|
2116 | _onObjectRemoved(obj: Object): void;
|
2117 | |
2118 |
|
2119 |
|
2120 |
|
2121 | _onObjectAdded(obj: Object): void;
|
2122 | |
2123 |
|
2124 |
|
2125 |
|
2126 | _resetCurrentTransform(): void;
|
2127 | |
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 | _fireSelectionEvents(oldObjects: Object[], e?: Event): void;
|
2133 | |
2134 |
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 | _setActiveObject(object: fabric.Object, e?: Event): boolean;
|
2140 | |
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 | getPointer(e: Event, ignoreZoom: boolean): { x: number; y: number };
|
2159 | |
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 | _searchPossibleTargets(objects: Object[], pointer: { x: number; y: number }): Object;
|
2167 |
|
2168 | static EMPTY_JSON: string;
|
2169 | |
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 | static supports(methodName: 'getImageData' | 'toDataURL' | 'toDataURLWithQuality' | 'setLineDash'): boolean;
|
2175 | |
2176 |
|
2177 |
|
2178 |
|
2179 | static toJSON(propertiesToInclude?: string[]): string;
|
2180 | |
2181 |
|
2182 |
|
2183 | removeListeners(): void;
|
2184 | }
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 | interface ICircleOptions extends IObjectOptions {
|
2191 | |
2192 |
|
2193 |
|
2194 | radius?: number | undefined;
|
2195 | |
2196 |
|
2197 |
|
2198 | startAngle?: number | undefined;
|
2199 | |
2200 |
|
2201 |
|
2202 | endAngle?: number | undefined;
|
2203 | }
|
2204 | export interface Circle extends Object, ICircleOptions {}
|
2205 | export class Circle {
|
2206 | constructor(options?: ICircleOptions);
|
2207 | /**
|
2208 | * Returns horizontal radius of an object (according to how an object is scaled)
|
2209 | */
|
2210 | getRadiusX(): number;
|
2211 | /**
|
2212 | * Returns vertical radius of an object (according to how an object is scaled)
|
2213 | */
|
2214 | getRadiusY(): number;
|
2215 | /**
|
2216 | * Sets radius of an object (and updates width accordingly)
|
2217 | */
|
2218 | setRadius(value: number): number;
|
2219 | /**
|
2220 | * Returns svg representation of an instance
|
2221 | * @return {Array} an array of strings with the specific svg representation
|
2222 | * of the instance
|
2223 | */
|
2224 | _toSVG(): string;
|
2225 | |
2226 |
|
2227 |
|
2228 | static ATTRIBUTE_NAMES: string[];
|
2229 | |
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 | static fromElement(element: SVGElement, options: ICircleOptions): Circle;
|
2235 | |
2236 |
|
2237 |
|
2238 |
|
2239 | static fromObject(object: any): Circle;
|
2240 | }
|
2241 |
|
2242 | interface IEllipseOptions extends IObjectOptions {
|
2243 | |
2244 |
|
2245 |
|
2246 | rx?: number | undefined;
|
2247 | |
2248 |
|
2249 |
|
2250 | ry?: number | undefined;
|
2251 | }
|
2252 | export interface Ellipse extends Object, IEllipseOptions {}
|
2253 | export class Ellipse {
|
2254 | constructor(options?: IEllipseOptions);
|
2255 | /**
|
2256 | * Returns horizontal radius of an object (according to how an object is scaled)
|
2257 | */
|
2258 | getRx(): number;
|
2259 | /**
|
2260 | * Returns Vertical radius of an object (according to how an object is scaled)
|
2261 | */
|
2262 | getRy(): number;
|
2263 | /**
|
2264 | * Returns svg representation of an instance
|
2265 | * @return {Array} an array of strings with the specific svg representation
|
2266 | * of the instance
|
2267 | */
|
2268 | _toSVG(): string;
|
2269 | |
2270 |
|
2271 |
|
2272 | static ATTRIBUTE_NAMES: string[];
|
2273 | |
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 | static fromElement(element: SVGElement, options?: IEllipseOptions): Ellipse;
|
2279 | |
2280 |
|
2281 |
|
2282 |
|
2283 | static fromObject(object: any): Ellipse;
|
2284 | }
|
2285 | interface IGroupOptions extends IObjectOptions {
|
2286 | |
2287 |
|
2288 |
|
2289 |
|
2290 | subTargetCheck?: boolean | undefined;
|
2291 | |
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 | useSetOnGroup?: boolean | undefined;
|
2299 | }
|
2300 | export interface Group extends Object, ICollection<Group>, IGroupOptions {}
|
2301 | export class Group {
|
2302 | |
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 | constructor(objects?: Object[], options?: IGroupOptions, isAlreadyGrouped?: boolean);
|
2308 | /**
|
2309 | * Adds an object to a group; Then recalculates group's dimension, position.
|
2310 | * @param [Object] object
|
2311 | * @return thisArg
|
2312 | * @chainable
|
2313 | */
|
2314 | addWithUpdate(object?: Object): Group;
|
2315 | /**
|
2316 | * Removes an object from a group; Then recalculates group's dimension, position.
|
2317 | * @return thisArg
|
2318 | * @chainable
|
2319 | */
|
2320 | removeWithUpdate(object: Object): Group;
|
2321 | /**
|
2322 | * Renders instance on a given context
|
2323 | * @param ctx context to render instance on
|
2324 | */
|
2325 | render(ctx: CanvasRenderingContext2D): void;
|
2326 | /**
|
2327 | * Decide if the object should cache or not. Create its own cache level
|
2328 | * objectCaching is a global flag, wins over everything
|
2329 | * needsItsOwnCache should be used when the object drawing method requires
|
2330 | * a cache step. None of the fabric classes requires it.
|
2331 | * Generally you do not cache objects in groups because the group outside is cached.
|
2332 | * @return {Boolean}
|
2333 | */
|
2334 | shouldCache(): boolean;
|
2335 | |
2336 |
|
2337 |
|
2338 |
|
2339 | willDrawShadow(): boolean;
|
2340 | |
2341 |
|
2342 |
|
2343 |
|
2344 | isOnACache(): boolean;
|
2345 | |
2346 |
|
2347 |
|
2348 |
|
2349 | drawObject(ctx: CanvasRenderingContext2D): void;
|
2350 | |
2351 |
|
2352 |
|
2353 | isCacheDirty(skipCanvas?: boolean): boolean;
|
2354 | |
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 | realizeTransform(object: Object): Object;
|
2363 | |
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 | destroy(): Group;
|
2369 | |
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 | toActiveSelection(): ActiveSelection;
|
2376 | |
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 | ungroupOnCanvas(): Group;
|
2382 | |
2383 |
|
2384 |
|
2385 |
|
2386 |
|
2387 | setObjectsCoords(): Group;
|
2388 | |
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 | toSVG(reviver?: Function): string;
|
2394 | |
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 | toClipPathSVG(reviver?: Function): string;
|
2400 | |
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 | addWithUpdate(object: Object): Group;
|
2407 | |
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 | _restoreObjectsState(): Group;
|
2414 | |
2415 |
|
2416 |
|
2417 | _calcBounds(onlyWidthHeight?: boolean): void;
|
2418 | |
2419 |
|
2420 |
|
2421 |
|
2422 | _updateObjectsCoords(center?: Point): void;
|
2423 | |
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 | _restoreObjectsState(): Group;
|
2430 | |
2431 |
|
2432 |
|
2433 | _onObjectRemoved(object: Object): void;
|
2434 | |
2435 |
|
2436 |
|
2437 |
|
2438 |
|
2439 | static fromObject(object: any, callback: (group: Group) => any): void;
|
2440 | }
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 | export interface ActiveSelection extends Group, ICollection<Group> {}
|
2446 | export class ActiveSelection {
|
2447 | |
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 | constructor(objects?: Object[], options?: IObjectOptions);
|
2453 | /**
|
2454 | * Constructor
|
2455 | * @param {Object} objects ActiveSelection objects
|
2456 | * @param {Object} [options] Options object
|
2457 | * @return {Object} thisArg
|
2458 | */
|
2459 | initialize(objects: ActiveSelection, options?: IObjectOptions): Object;
|
2460 | |
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 | toGroup(): Group;
|
2466 | |
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 | static fromObject(object: any, callback: Function): void;
|
2473 | }
|
2474 |
|
2475 | interface IImageOptions extends IObjectOptions {
|
2476 | |
2477 |
|
2478 |
|
2479 | crossOrigin?: string | undefined;
|
2480 | |
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 | srcFromAttribute?: boolean | undefined;
|
2487 | |
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 | minimumScaleTrigger?: number | undefined;
|
2494 | |
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 | cacheKey?: string | undefined;
|
2500 | |
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 | cropX?: number | undefined;
|
2506 | |
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 | cropY?: number | undefined;
|
2512 | |
2513 |
|
2514 |
|
2515 | filters?: IBaseFilter[] | undefined;
|
2516 | }
|
2517 | interface Image extends Object, IImageOptions {}
|
2518 | export class Image {
|
2519 | |
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 | constructor(element?: string | HTMLImageElement | HTMLVideoElement, options?: IImageOptions);
|
2525 | /**
|
2526 | * Returns image or video element which this instance is based on
|
2527 | * @return Image or Video element
|
2528 | */
|
2529 | getElement(): HTMLImageElement | HTMLVideoElement;
|
2530 | /**
|
2531 | * Sets image or video element for this instance to a specified one.
|
2532 | * If filters defined they are applied to new image.
|
2533 | * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area.
|
2534 | * @param element image element
|
2535 | * @param [options] Options object
|
2536 | */
|
2537 | setElement(element: HTMLImageElement | HTMLVideoElement, options?: IImageOptions): Image;
|
2538 | /**
|
2539 | * Delete a single texture if in webgl mode
|
2540 | */
|
2541 | removeTexture(key: any): void;
|
2542 | /**
|
2543 | * Delete textures, reference to elements and eventually JSDOM cleanup
|
2544 | */
|
2545 | dispose(): void;
|
2546 | /**
|
2547 | * Returns original size of an image
|
2548 | * @return Object with "width" and "height" properties
|
2549 | */
|
2550 | getOriginalSize(): { width: number; height: number };
|
2551 | |
2552 |
|
2553 |
|
2554 |
|
2555 | hasCrop(): boolean;
|
2556 | |
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 | _toSVG(): string;
|
2562 | |
2563 |
|
2564 |
|
2565 |
|
2566 | getSrc(): string;
|
2567 | |
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 | setSrc(src: string, callback?: Function, options?: IImageOptions): Image;
|
2576 | applyResizeFilters(): void;
|
2577 | |
2578 |
|
2579 |
|
2580 |
|
2581 |
|
2582 |
|
2583 | applyFilters(filters?: IBaseFilter[]): Image;
|
2584 | |
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 | parsePreserveAspectRatioAttribute(): any;
|
2591 | |
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 | static fromURL(url: string, callback?: (image: Image) => void, imgOptions?: IImageOptions): Image;
|
2598 | |
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 | static fromElement(element: SVGElement, callback: Function, options?: IImageOptions): Image;
|
2605 | |
2606 |
|
2607 |
|
2608 | static CSS_CANVAS: string;
|
2609 | static filters: IAllFilters;
|
2610 | static ATTRIBUTE_NAMES: string[];
|
2611 | }
|
2612 |
|
2613 | interface ILineOptions extends IObjectOptions {
|
2614 | |
2615 |
|
2616 |
|
2617 | x1?: number | undefined;
|
2618 | |
2619 |
|
2620 |
|
2621 | x2?: number | undefined;
|
2622 | |
2623 |
|
2624 |
|
2625 | y1?: number | undefined;
|
2626 | |
2627 |
|
2628 |
|
2629 | y2?: number | undefined;
|
2630 | }
|
2631 | export interface Line extends Object, ILineOptions {}
|
2632 | export class Line {
|
2633 | |
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 | constructor(points?: number[], objObjects?: ILineOptions);
|
2639 | /**
|
2640 | * Returns svg representation of an instance
|
2641 | * @return {Array} an array of strings with the specific svg representation
|
2642 | * of the instance
|
2643 | */
|
2644 | _toSVG(): string;
|
2645 | |
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 | static fromElement(element: SVGElement, callback?: Function, options?: ILineOptions): Line;
|
2654 | |
2655 |
|
2656 |
|
2657 |
|
2658 | static fromObject(object: any): Line;
|
2659 | static ATTRIBUTE_NAMES: string[];
|
2660 | |
2661 |
|
2662 |
|
2663 | makeEdgeToOriginGetter(
|
2664 | propertyNames: { origin: number; axis1: any; axis2: any; dimension: any },
|
2665 | originValues: { nearest: any; center: any; farthest: any },
|
2666 | ): Function;
|
2667 | |
2668 |
|
2669 |
|
2670 |
|
2671 | calcLinePoints(): { x1: number; x2: number; y1: number; y2: number };
|
2672 | }
|
2673 |
|
2674 | interface IObjectOptions {
|
2675 | |
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 | type?: string | undefined;
|
2681 |
|
2682 | |
2683 |
|
2684 |
|
2685 | originX?: string | undefined;
|
2686 |
|
2687 | |
2688 |
|
2689 |
|
2690 | originY?: string | undefined;
|
2691 |
|
2692 | |
2693 |
|
2694 |
|
2695 | top?: number | undefined;
|
2696 |
|
2697 | |
2698 |
|
2699 |
|
2700 | left?: number | undefined;
|
2701 |
|
2702 | |
2703 |
|
2704 |
|
2705 | width?: number | undefined;
|
2706 |
|
2707 | |
2708 |
|
2709 |
|
2710 | height?: number | undefined;
|
2711 |
|
2712 | |
2713 |
|
2714 |
|
2715 | scaleX?: number | undefined;
|
2716 |
|
2717 | |
2718 |
|
2719 |
|
2720 | scaleY?: number | undefined;
|
2721 |
|
2722 | |
2723 |
|
2724 |
|
2725 | flipX?: boolean | undefined;
|
2726 |
|
2727 | |
2728 |
|
2729 |
|
2730 | flipY?: boolean | undefined;
|
2731 |
|
2732 | |
2733 |
|
2734 |
|
2735 | opacity?: number | undefined;
|
2736 |
|
2737 | |
2738 |
|
2739 |
|
2740 | angle?: number | undefined;
|
2741 |
|
2742 | |
2743 |
|
2744 |
|
2745 | skewX?: number | undefined;
|
2746 |
|
2747 | |
2748 |
|
2749 |
|
2750 | skewY?: number | undefined;
|
2751 |
|
2752 | |
2753 |
|
2754 |
|
2755 | cornerSize?: number | undefined;
|
2756 |
|
2757 | |
2758 |
|
2759 |
|
2760 | transparentCorners?: boolean | undefined;
|
2761 |
|
2762 | |
2763 |
|
2764 |
|
2765 | hoverCursor?: string | undefined;
|
2766 |
|
2767 | |
2768 |
|
2769 |
|
2770 | moveCursor?: string | undefined;
|
2771 |
|
2772 | |
2773 |
|
2774 |
|
2775 | padding?: number | undefined;
|
2776 |
|
2777 | |
2778 |
|
2779 |
|
2780 | borderColor?: string | undefined;
|
2781 |
|
2782 | |
2783 |
|
2784 |
|
2785 | borderDashArray?: number[] | undefined;
|
2786 |
|
2787 | |
2788 |
|
2789 |
|
2790 | cornerColor?: string | undefined;
|
2791 |
|
2792 | |
2793 |
|
2794 |
|
2795 | cornerStrokeColor?: string | undefined;
|
2796 |
|
2797 | |
2798 |
|
2799 |
|
2800 | cornerStyle?: 'rect' | 'circle' | undefined;
|
2801 |
|
2802 | |
2803 |
|
2804 |
|
2805 | cornerDashArray?: number[] | undefined;
|
2806 |
|
2807 | |
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 | centeredScaling?: boolean | undefined;
|
2813 |
|
2814 | |
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 | centeredRotation?: boolean | undefined;
|
2820 |
|
2821 | |
2822 |
|
2823 |
|
2824 | fill?: string | Pattern | Gradient | undefined;
|
2825 |
|
2826 | |
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 | fillRule?: string | undefined;
|
2832 |
|
2833 | |
2834 |
|
2835 |
|
2836 | globalCompositeOperation?: string | undefined;
|
2837 |
|
2838 | |
2839 |
|
2840 |
|
2841 | backgroundColor?: string | undefined;
|
2842 |
|
2843 | |
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 | selectionBackgroundColor?: string | undefined;
|
2849 |
|
2850 | |
2851 |
|
2852 |
|
2853 | stroke?: string | undefined;
|
2854 |
|
2855 | |
2856 |
|
2857 |
|
2858 | strokeWidth?: number | undefined;
|
2859 |
|
2860 | |
2861 |
|
2862 |
|
2863 | strokeDashArray?: number[] | undefined;
|
2864 |
|
2865 | |
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 | strokeDashOffset?: number | undefined;
|
2871 |
|
2872 | |
2873 |
|
2874 |
|
2875 | strokeLineCap?: string | undefined;
|
2876 |
|
2877 | |
2878 |
|
2879 |
|
2880 | strokeLineJoin?: string | undefined;
|
2881 |
|
2882 | |
2883 |
|
2884 |
|
2885 | strokeMiterLimit?: number | undefined;
|
2886 |
|
2887 | |
2888 |
|
2889 |
|
2890 | shadow?: Shadow | string | undefined;
|
2891 |
|
2892 | |
2893 |
|
2894 |
|
2895 | borderOpacityWhenMoving?: number | undefined;
|
2896 |
|
2897 | |
2898 |
|
2899 |
|
2900 | borderScaleFactor?: number | undefined;
|
2901 |
|
2902 | |
2903 |
|
2904 |
|
2905 | minScaleLimit?: number | undefined;
|
2906 |
|
2907 | |
2908 |
|
2909 |
|
2910 |
|
2911 | selectable?: boolean | undefined;
|
2912 |
|
2913 | |
2914 |
|
2915 |
|
2916 | evented?: boolean | undefined;
|
2917 |
|
2918 | |
2919 |
|
2920 |
|
2921 | visible?: boolean | undefined;
|
2922 |
|
2923 | |
2924 |
|
2925 |
|
2926 | hasControls?: boolean | undefined;
|
2927 |
|
2928 | |
2929 |
|
2930 |
|
2931 | hasBorders?: boolean | undefined;
|
2932 |
|
2933 | |
2934 |
|
2935 |
|
2936 | hasRotatingPoint?: boolean | undefined;
|
2937 |
|
2938 | |
2939 |
|
2940 |
|
2941 | rotatingPointOffset?: number | undefined;
|
2942 |
|
2943 | |
2944 |
|
2945 |
|
2946 | perPixelTargetFind?: boolean | undefined;
|
2947 |
|
2948 | |
2949 |
|
2950 |
|
2951 | includeDefaultValues?: boolean | undefined;
|
2952 |
|
2953 | |
2954 |
|
2955 |
|
2956 | lockMovementX?: boolean | undefined;
|
2957 |
|
2958 | |
2959 |
|
2960 |
|
2961 | lockMovementY?: boolean | undefined;
|
2962 |
|
2963 | |
2964 |
|
2965 |
|
2966 | lockRotation?: boolean | undefined;
|
2967 |
|
2968 | |
2969 |
|
2970 |
|
2971 | lockScalingX?: boolean | undefined;
|
2972 |
|
2973 | |
2974 |
|
2975 |
|
2976 | lockScalingY?: boolean | undefined;
|
2977 |
|
2978 | |
2979 |
|
2980 |
|
2981 | lockUniScaling?: boolean | undefined;
|
2982 |
|
2983 | |
2984 |
|
2985 |
|
2986 |
|
2987 | lockSkewingX?: boolean | undefined;
|
2988 |
|
2989 | |
2990 |
|
2991 |
|
2992 |
|
2993 | lockSkewingY?: boolean | undefined;
|
2994 |
|
2995 | |
2996 |
|
2997 |
|
2998 | lockScalingFlip?: boolean | undefined;
|
2999 |
|
3000 | |
3001 |
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 | excludeFromExport?: boolean | undefined;
|
3007 |
|
3008 | |
3009 |
|
3010 |
|
3011 | objectCaching?: boolean | undefined;
|
3012 |
|
3013 | |
3014 |
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 | statefullCache?: boolean | undefined;
|
3024 |
|
3025 | |
3026 |
|
3027 |
|
3028 |
|
3029 |
|
3030 |
|
3031 |
|
3032 |
|
3033 | noScaleCache?: boolean | undefined;
|
3034 |
|
3035 | |
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 | strokeUniform?: boolean | undefined;
|
3045 |
|
3046 | |
3047 |
|
3048 |
|
3049 | dirty?: boolean | undefined;
|
3050 |
|
3051 | |
3052 |
|
3053 |
|
3054 |
|
3055 | paintFirst?: string | undefined;
|
3056 |
|
3057 | |
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 | stateProperties?: string[] | undefined;
|
3064 |
|
3065 | |
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 | cacheProperties?: string[] | undefined;
|
3073 |
|
3074 | |
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 | clipPath?: Object | undefined;
|
3081 |
|
3082 | |
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 | inverted?: boolean | undefined;
|
3090 |
|
3091 | |
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 | absolutePositioned?: boolean | undefined;
|
3102 |
|
3103 | |
3104 |
|
3105 |
|
3106 | name?: string | undefined;
|
3107 |
|
3108 | |
3109 |
|
3110 |
|
3111 | data?: any;
|
3112 | |
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 | oCoords?: { tl: Point; mt: Point; tr: Point; ml: Point; mr: Point; bl: Point; mb: Point; br: Point; mtr: Point } | undefined;
|
3125 | |
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 | aCoords?: { bl: Point; br: Point; tl: Point; tr: Point } | undefined;
|
3138 | |
3139 |
|
3140 |
|
3141 | matrixCache?: any;
|
3142 | |
3143 |
|
3144 |
|
3145 | ownMatrixCache?: any;
|
3146 |
|
3147 | |
3148 |
|
3149 |
|
3150 | snapAngle?: number | undefined;
|
3151 | |
3152 |
|
3153 |
|
3154 | snapThreshold?: null | number | undefined;
|
3155 | |
3156 |
|
3157 |
|
3158 | group?: Group | undefined;
|
3159 | |
3160 |
|
3161 |
|
3162 | canvas?: Canvas | undefined;
|
3163 | }
|
3164 | export interface Object extends IObservable<Object>, IObjectOptions, IObjectAnimation<Object> {}
|
3165 | export class Object {
|
3166 | _controlsVisibility: {
|
3167 | bl?: boolean | undefined;
|
3168 | br?: boolean | undefined;
|
3169 | mb?: boolean | undefined;
|
3170 | ml?: boolean | undefined;
|
3171 | mr?: boolean | undefined;
|
3172 | mt?: boolean | undefined;
|
3173 | tl?: boolean | undefined;
|
3174 | tr?: boolean | undefined;
|
3175 | mtr?: boolean | undefined;
|
3176 | };
|
3177 |
|
3178 | controls: { [key: string]: Control };
|
3179 |
|
3180 | constructor(options?: IObjectOptions);
|
3181 | initialize(options?: IObjectOptions): Object;
|
3182 |
|
3183 | /* Sets object's properties from options
|
3184 | * @param {Object} [options] Options object
|
3185 | */
|
3186 | setOptions(options: IObjectOptions): void;
|
3187 |
|
3188 | |
3189 |
|
3190 |
|
3191 |
|
3192 | transform(ctx: CanvasRenderingContext2D): void;
|
3193 |
|
3194 | |
3195 |
|
3196 |
|
3197 |
|
3198 | toObject(propertiesToInclude?: string[]): any;
|
3199 |
|
3200 | |
3201 |
|
3202 |
|
3203 |
|
3204 | toDatalessObject(propertiesToInclude?: string[]): any;
|
3205 |
|
3206 | |
3207 |
|
3208 |
|
3209 | toString(): string;
|
3210 |
|
3211 | |
3212 |
|
3213 |
|
3214 |
|
3215 | getObjectScaling(): { scaleX: number; scaleY: number };
|
3216 |
|
3217 | |
3218 |
|
3219 |
|
3220 |
|
3221 | getTotalObjectScaling(): { scaleX: number; scaleY: number };
|
3222 |
|
3223 | |
3224 |
|
3225 |
|
3226 |
|
3227 | getObjectOpacity(): number;
|
3228 |
|
3229 | |
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 | setOnGroup(): void;
|
3236 |
|
3237 | |
3238 |
|
3239 |
|
3240 | getViewportTransform(): any[];
|
3241 |
|
3242 | |
3243 |
|
3244 |
|
3245 |
|
3246 | render(ctx: CanvasRenderingContext2D): void;
|
3247 |
|
3248 | |
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 |
|
3255 |
|
3256 | needsItsOwnCache(): boolean;
|
3257 |
|
3258 | |
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 | shouldCache(): boolean;
|
3267 |
|
3268 | |
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 | willDrawShadow(): boolean;
|
3274 |
|
3275 | |
3276 |
|
3277 |
|
3278 |
|
3279 | drawClipPathOnCache(ctx: CanvasRenderingContext2D): void;
|
3280 |
|
3281 | |
3282 |
|
3283 |
|
3284 |
|
3285 | drawObject(ctx: CanvasRenderingContext2D): void;
|
3286 |
|
3287 | |
3288 |
|
3289 |
|
3290 |
|
3291 | drawCacheOnCanvas(ctx: CanvasRenderingContext2D): void;
|
3292 |
|
3293 | |
3294 |
|
3295 |
|
3296 |
|
3297 |
|
3298 | isCacheDirty(skipCanvas?: boolean): boolean;
|
3299 |
|
3300 | |
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 | clone(callback: Function, propertiesToInclude?: string[]): void;
|
3306 |
|
3307 | |
3308 |
|
3309 |
|
3310 |
|
3311 | cloneAsImage(callback: Function, options?: IDataURLOptions): Object;
|
3312 |
|
3313 | |
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 | toCanvasElement(options?: IDataURLOptions): HTMLCanvasElement;
|
3327 |
|
3328 | |
3329 |
|
3330 |
|
3331 |
|
3332 | toDataURL(options: IDataURLOptions): string;
|
3333 |
|
3334 | |
3335 |
|
3336 |
|
3337 |
|
3338 | isType(type: string): boolean;
|
3339 |
|
3340 | |
3341 |
|
3342 |
|
3343 | complexity(): number;
|
3344 |
|
3345 | |
3346 |
|
3347 |
|
3348 |
|
3349 | toJSON(propertiesToInclude?: string[]): any;
|
3350 |
|
3351 | |
3352 |
|
3353 |
|
3354 |
|
3355 | rotate(angle: number): Object;
|
3356 |
|
3357 | |
3358 |
|
3359 |
|
3360 |
|
3361 | centerH(): Object;
|
3362 |
|
3363 | |
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 | viewportCenterH(): Object;
|
3370 |
|
3371 | |
3372 |
|
3373 |
|
3374 |
|
3375 | centerV(): Object;
|
3376 |
|
3377 | |
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 |
|
3383 | viewportCenterV(): Object;
|
3384 |
|
3385 | |
3386 |
|
3387 |
|
3388 |
|
3389 | center(): Object;
|
3390 |
|
3391 | |
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 | viewportCenter(): Object;
|
3398 |
|
3399 | |
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 | getLocalPointer(e: Event | undefined, pointer?: { x: number; y: number }): { x: number; y: number };
|
3405 |
|
3406 | |
3407 |
|
3408 |
|
3409 |
|
3410 | get<K extends keyof this>(property: K): this[K];
|
3411 |
|
3412 | |
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 | set<K extends keyof this>(key: K, value: this[K] | ((value: this[K]) => this[K])): Object;
|
3420 |
|
3421 | /**
|
3422 | * Sets property to a given value.
|
3423 | * When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls.
|
3424 | * If you need to update those, call `setCoords()`.
|
3425 | * @param options Property object, iterate over the object properties
|
3426 | */
|
3427 | set(options: Partial<this>): Object;
|
3428 |
|
3429 | /**
|
3430 | * Toggles specified property from `true` to `false` or from `false` to `true`
|
3431 | * @param property Property to toggle
|
3432 | */
|
3433 | toggle(property: keyof this): Object;
|
3434 |
|
3435 | /**
|
3436 | * Sets sourcePath of an object
|
3437 | * @param value Value to set sourcePath to
|
3438 | */
|
3439 | setSourcePath(value: string): Object;
|
3440 |
|
3441 | /**
|
3442 | * Sets "angle" of an instance
|
3443 | * @param angle Angle value
|
3444 | */
|
3445 | setAngle(angle: number): Object;
|
3446 |
|
3447 | /**
|
3448 | * Sets object's properties from options
|
3449 | * @param [options] Options object
|
3450 | */
|
3451 | setOptions(options?: any): void;
|
3452 | /**
|
3453 | * Sets sourcePath of an object
|
3454 | * @param value Value to set sourcePath to
|
3455 | */
|
3456 | setSourcePath(value: string): Object;
|
3457 | // functions from object svg export mixin
|
3458 | // -----------------------------------------------------------------------------------------------------------------------------------
|
3459 | /**
|
3460 | * Returns styles-string for svg-export
|
3461 | * @param {Boolean} skipShadow a boolean to skip shadow filter output
|
3462 | * @return {String}
|
3463 | */
|
3464 | getSvgStyles(skipShadow?: boolean): string;
|
3465 | /**
|
3466 | * Returns transform-string for svg-export
|
3467 | * @param {Boolean} use the full transform or the single object one.
|
3468 | * @return {String}
|
3469 | */
|
3470 | getSvgTransform(full?: boolean, additionalTransform?: string): string;
|
3471 | /**
|
3472 | * Returns transform-string for svg-export from the transform matrix of single elements
|
3473 | */
|
3474 | getSvgTransformMatrix(): string;
|
3475 |
|
3476 | // functions from stateful mixin
|
3477 | // -----------------------------------------------------------------------------------------------------------------------------------
|
3478 | /**
|
3479 | * Returns true if object state (one of its state properties) was changed
|
3480 | * @param {String} [propertySet] optional name for the set of property we want to save
|
3481 | * @return {Boolean} true if instance' state has changed since `{@link fabric.Object#saveState}` was called
|
3482 | */
|
3483 | hasStateChanged(propertySet: string): boolean;
|
3484 | /**
|
3485 | * Saves state of an object
|
3486 | * @param [options] Object with additional `stateProperties` array to include when saving state
|
3487 | * @return thisArg
|
3488 | */
|
3489 | saveState(options?: { stateProperties?: any[] | undefined; propertySet?: string | undefined }): Object;
|
3490 | /**
|
3491 | * Setups state of an object
|
3492 | * @param {Object} [options] Object with additional `stateProperties` array to include when saving state
|
3493 | * @return {fabric.Object} thisArg
|
3494 | */
|
3495 | setupState(options?: any): Object;
|
3496 | // functions from object straightening mixin
|
3497 | // -----------------------------------------------------------------------------------------------------------------------------------
|
3498 | /**
|
3499 | * Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer)
|
3500 | */
|
3501 | straighten(): Object;
|
3502 | /**
|
3503 | * Same as straighten but with animation
|
3504 | */
|
3505 | fxStraighten(callbacks: Callbacks): Object;
|
3506 |
|
3507 | // functions from object stacking mixin
|
3508 | // -----------------------------------------------------------------------------------------------------------------------------------
|
3509 | /**
|
3510 | * Moves an object up in stack of drawn objects
|
3511 | * @param [intersecting] If `true`, send object in front of next upper intersecting object
|
3512 | */
|
3513 | bringForward(intersecting?: boolean): Object;
|
3514 | /**
|
3515 | * Moves an object to the top of the stack of drawn objects
|
3516 | */
|
3517 | bringToFront(): Object;
|
3518 | /**
|
3519 | * Moves an object down in stack of drawn objects
|
3520 | * @param [intersecting] If `true`, send object behind next lower intersecting object
|
3521 | */
|
3522 | sendBackwards(intersecting?: boolean): Object;
|
3523 | /**
|
3524 | * Moves an object to the bottom of the stack of drawn objects
|
3525 | */
|
3526 | sendToBack(): Object;
|
3527 | /**
|
3528 | * Moves an object to specified level in stack of drawn objects
|
3529 | * @param index New position of object
|
3530 | */
|
3531 | moveTo(index: number): Object;
|
3532 |
|
3533 | // functions from object origin mixin
|
3534 | // -----------------------------------------------------------------------------------------------------------------------------------
|
3535 | /**
|
3536 | * Translates the coordinates from origin to center coordinates (based on the object's dimensions)
|
3537 | * @param point The point which corresponds to the originX and originY params
|
3538 | * @param originX Horizontal origin: 'left', 'center' or 'right'
|
3539 | * @param originY Vertical origin: 'top', 'center' or 'bottom'
|
3540 | */
|
3541 | translateToCenterPoint(point: Point, originX: string, originY: string): Point;
|
3542 |
|
3543 | /**
|
3544 | * Translates the coordinates from center to origin coordinates (based on the object's dimensions)
|
3545 | * @param center The point which corresponds to center of the object
|
3546 | * @param originX Horizontal origin: 'left', 'center' or 'right'
|
3547 | * @param originY Vertical origin: 'top', 'center' or 'bottom'
|
3548 | */
|
3549 | translateToOriginPoint(center: Point, originX: string, originY: string): Point;
|
3550 | /**
|
3551 | * Returns the real center coordinates of the object
|
3552 | */
|
3553 | getCenterPoint(): Point;
|
3554 |
|
3555 | /**
|
3556 | * Returns the coordinates of the object as if it has a different origin
|
3557 | * @param {String} originX Horizontal origin: 'left', 'center' or 'right'
|
3558 | * @param {String} originY Vertical origin: 'top', 'center' or 'bottom'
|
3559 | * @return {fabric.Point}
|
3560 | */
|
3561 | getPointByOrigin(originX: string, originY: string): Point;
|
3562 |
|
3563 | /**
|
3564 | * Returns the point in local coordinates
|
3565 | * @param point The point relative to the global coordinate system
|
3566 | * @param originX Horizontal origin: 'left', 'center' or 'right'
|
3567 | * @param originY Vertical origin: 'top', 'center' or 'bottom'
|
3568 | */
|
3569 | toLocalPoint(point: Point, originX: string, originY: string): Point;
|
3570 |
|
3571 | /**
|
3572 | * Sets the position of the object taking into consideration the object's origin
|
3573 | * @param pos The new position of the object
|
3574 | * @param originX Horizontal origin: 'left', 'center' or 'right'
|
3575 | * @param originY Vertical origin: 'top', 'center' or 'bottom'
|
3576 | */
|
3577 | setPositionByOrigin(pos: Point, originX: string, originY: string): void;
|
3578 |
|
3579 | /**
|
3580 | * @param to One of 'left', 'center', 'right'
|
3581 | */
|
3582 | adjustPosition(to: string): void;
|
3583 |
|
3584 | // functions from interactivity mixin
|
3585 | // -----------------------------------------------------------------------------------------------------------------------------------
|
3586 | /**
|
3587 | * Draws borders of an object's bounding box.
|
3588 | * Requires public properties: width, height
|
3589 | * Requires public options: padding, borderColor
|
3590 | * @param {CanvasRenderingContext2D} ctx Context to draw on
|
3591 | * @param {Object} styleOverride object to override the object style
|
3592 | * @return {fabric.Object} thisArg
|
3593 | * @chainable
|
3594 | */
|
3595 | drawBorders(ctx: CanvasRenderingContext2D, styleOverride?: any): Object;
|
3596 |
|
3597 | /**
|
3598 | * Draws borders of an object's bounding box when it is inside a group.
|
3599 | * Requires public properties: width, height
|
3600 | * Requires public options: padding, borderColor
|
3601 | * @param {CanvasRenderingContext2D} ctx Context to draw on
|
3602 | * @param {object} options object representing current object parameters
|
3603 | * @param {Object} styleOverride object to override the object style
|
3604 | * @return {fabric.Object} thisArg
|
3605 | * @chainable
|
3606 | */
|
3607 | drawBordersInGroup(ctx: CanvasRenderingContext2D, options?: any, styleOverride?: any): Object;
|
3608 |
|
3609 | /**
|
3610 | * Draws corners of an object's bounding box.
|
3611 | * Requires public properties: width, height
|
3612 | * Requires public options: cornerSize, padding
|
3613 | * @param {CanvasRenderingContext2D} ctx Context to draw on
|
3614 | * @param {Object} styleOverride object to override the object style
|
3615 | * @return {fabric.Object} thisArg
|
3616 | * @chainable
|
3617 | */
|
3618 | drawControls(ctx: CanvasRenderingContext2D, styleOverride?: any): Object;
|
3619 |
|
3620 | /**
|
3621 | * Draws a colored layer behind the object, inside its selection borders.
|
3622 | * Requires public options: padding, selectionBackgroundColor
|
3623 | * this function is called when the context is transformed
|
3624 | * has checks to be skipped when the object is on a staticCanvas
|
3625 | * @param {CanvasRenderingContext2D} ctx Context to draw on
|
3626 | * @return {fabric.Object} thisArg
|
3627 | * @chainable
|
3628 | */
|
3629 | drawSelectionBackground(ctx: CanvasRenderingContext2D): Object;
|
3630 |
|
3631 | /**
|
3632 | * Draws corners of an object's bounding box.
|
3633 | * Requires public properties: width, height
|
3634 | * Requires public options: cornerSize, padding
|
3635 | * @param ctx Context to draw on
|
3636 | */
|
3637 | drawCorners(context: CanvasRenderingContext2D): Object;
|
3638 |
|
3639 | /**
|
3640 | * Returns true if the specified control is visible, false otherwise.
|
3641 | * @param controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'.
|
3642 | */
|
3643 | isControlVisible(controlName: string): boolean;
|
3644 | /**
|
3645 | * Sets the visibility of the specified control.
|
3646 | * @param controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'.
|
3647 | * @param visible true to set the specified control visible, false otherwise
|
3648 | */
|
3649 | setControlVisible(controlName: string, visible: boolean): Object;
|
3650 |
|
3651 | /**
|
3652 | * Sets the visibility state of object controls.
|
3653 | * @param [options] Options object
|
3654 | */
|
3655 | setControlsVisibility(options?: {
|
3656 | bl?: boolean | undefined;
|
3657 | br?: boolean | undefined;
|
3658 | mb?: boolean | undefined;
|
3659 | ml?: boolean | undefined;
|
3660 | mr?: boolean | undefined;
|
3661 | mt?: boolean | undefined;
|
3662 | tl?: boolean | undefined;
|
3663 | tr?: boolean | undefined;
|
3664 | mtr?: boolean | undefined;
|
3665 | }): this;
|
3666 |
|
3667 | // functions from geometry mixin
|
3668 | // -------------------------------------------------------------------------------------------------------------------------------
|
3669 | /**
|
3670 | * Sets corner position coordinates based on current angle, width and height.
|
3671 | * oCoords are used to find the corners
|
3672 | * aCoords are used to quickly find an object on the canvas
|
3673 | * lineCoords are used to quickly find object during pointer events.
|
3674 | * See {@link https://github.com/kangax/fabric.js/wiki/When-to-call-setCoords|When-to-call-setCoords}
|
3675 | * @param {Boolean} [skipCorners] skip calculation of oCoords.
|
3676 | * @return {fabric.Object} thisArg
|
3677 | * @chainable
|
3678 | */
|
3679 | setCoords(skipCorners?: boolean): Object;
|
3680 | /**
|
3681 | * Returns coordinates of object's bounding rectangle (left, top, width, height)
|
3682 | * the box is intented as aligned to axis of canvas.
|
3683 | * @param {Boolean} [absolute] use coordinates without viewportTransform
|
3684 | * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords / .aCoords
|
3685 | * @return {Object} Object with left, top, width, height properties
|
3686 | */
|
3687 | getBoundingRect(
|
3688 | absolute?: boolean,
|
3689 | calculate?: boolean,
|
3690 | ): { left: number; top: number; width: number; height: number };
|
3691 | /**
|
3692 | * Checks if object is fully contained within area of another object
|
3693 | * @param {Object} other Object to test
|
3694 | * @param {Boolean} [absolute] use coordinates without viewportTransform
|
3695 | * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords
|
3696 | * @return {Boolean} true if object is fully contained within area of another object
|
3697 | */
|
3698 | isContainedWithinObject(other: Object, absolute?: boolean, calculate?: boolean): boolean;
|
3699 | /**
|
3700 | * Checks if object is fully contained within area formed by 2 points
|
3701 | * @param pointTL top-left point of area
|
3702 | * @param pointBR bottom-right point of area
|
3703 | */
|
3704 | isContainedWithinRect(pointTL: any, pointBR: any, absolute?: boolean, calculate?: boolean): boolean;
|
3705 | /**
|
3706 | * Checks if point is inside the object
|
3707 | * @param {fabric.Point} point Point to check against
|
3708 | * @param {Object} [lines] object returned from @method _getImageLines
|
3709 | * @param {Boolean} [absolute] use coordinates without viewportTransform
|
3710 | * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords
|
3711 | * @return {Boolean} true if point is inside the object
|
3712 | */
|
3713 | containsPoint(point: Point, lines?: any, absolute?: boolean, calculate?: boolean): boolean;
|
3714 | /**
|
3715 | * Scales an object (equally by x and y)
|
3716 | * @param value Scale factor
|
3717 | * @return thisArg
|
3718 | */
|
3719 | scale(value: number): Object;
|
3720 | /**
|
3721 | * Scales an object to a given height, with respect to bounding box (scaling by x/y equally)
|
3722 | * @param value New height value
|
3723 | */
|
3724 | scaleToHeight(value: number, absolute?: boolean): Object;
|
3725 | /**
|
3726 | * Scales an object to a given width, with respect to bounding box (scaling by x/y equally)
|
3727 | * @param value New width value
|
3728 | */
|
3729 | scaleToWidth(value: number, absolute?: boolean): Object;
|
3730 | /**
|
3731 | * Checks if object intersects with another object
|
3732 | * @param {Object} other Object to test
|
3733 | * @param {Boolean} [absolute] use coordinates without viewportTransform
|
3734 | * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords
|
3735 | * @return {Boolean} true if object intersects with another object
|
3736 | */
|
3737 | intersectsWithObject(other: Object, absolute?: boolean, calculate?: boolean): boolean;
|
3738 | /**
|
3739 | * Checks if object intersects with an area formed by 2 points
|
3740 | * @param {Object} pointTL top-left point of area
|
3741 | * @param {Object} pointBR bottom-right point of area
|
3742 | * @param {Boolean} [absolute] use coordinates without viewportTransform
|
3743 | * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords
|
3744 | * @return {Boolean} true if object intersects with an area formed by 2 points
|
3745 | */
|
3746 | intersectsWithRect(pointTL: any, pointBR: any, absolute?: boolean, calculate?: boolean): boolean;
|
3747 |
|
3748 | /**
|
3749 | * Animates object's properties
|
3750 | * object.animate('left', ..., {duration: ...});
|
3751 | * @param property Property to animate
|
3752 | * @param value Value to animate property
|
3753 | * @param options The animation options
|
3754 | */
|
3755 | animate(property: string, value: number | string, options?: IAnimationOptions): Object;
|
3756 | /**
|
3757 | * Animates object's properties
|
3758 | * object.animate({ left: ..., top: ... }, { duration: ... });
|
3759 | * @param properties Properties to animate with values to animate to
|
3760 | * @param options The animation options
|
3761 | */
|
3762 | animate(properties: { [key: string]: number | string }, options?: IAnimationOptions): Object;
|
3763 | /**
|
3764 | * Calculate and returns the .coords of an object.
|
3765 | * @return {Object} Object with tl, tr, br, bl ....
|
3766 | * @chainable
|
3767 | */
|
3768 | calcCoords(absolute?: boolean): any;
|
3769 | /**
|
3770 | * calculate trasform Matrix that represent current transformation from
|
3771 | * object properties.
|
3772 | * @param {Boolean} [skipGroup] return transformMatrix for object and not go upward with parents
|
3773 | * @return {Array} matrix Transform Matrix for the object
|
3774 | */
|
3775 | calcTransformMatrix(skipGroup?: boolean): any[];
|
3776 | /**
|
3777 | * calculate transform matrix that represents the current transformations from the
|
3778 | * object's properties, this matrix does not include the group transformation
|
3779 | * @return {Array} transform matrix for the object
|
3780 | */
|
3781 | calcOwnMatrix(): any[];
|
3782 | /**
|
3783 | * return correct set of coordinates for intersection
|
3784 | */
|
3785 | getCoords(absolute?: boolean, calculate?: boolean): [fabric.Point, fabric.Point, fabric.Point, fabric.Point];
|
3786 | /**
|
3787 | * Returns height of an object bounding box counting transformations
|
3788 | * before 2.0 it was named getHeight();
|
3789 | * @return {Number} height value
|
3790 | */
|
3791 | getScaledHeight(): number;
|
3792 | /**
|
3793 | * Returns width of an object bounding box counting transformations
|
3794 | * before 2.0 it was named getWidth();
|
3795 | * @return {Number} width value
|
3796 | */
|
3797 | getScaledWidth(): number;
|
3798 | /**
|
3799 | * Returns id attribute for svg output
|
3800 | * @return {String}
|
3801 | */
|
3802 | getSvgCommons(): string;
|
3803 | /**
|
3804 | * Returns filter for svg shadow
|
3805 | * @return {String}
|
3806 | */
|
3807 | getSvgFilter(): string;
|
3808 | /**
|
3809 | * Returns styles-string for svg-export
|
3810 | * @param {Object} style the object from which to retrieve style properties
|
3811 | * @param {Boolean} useWhiteSpace a boolean to include an additional attribute in the style.
|
3812 | * @return {String}
|
3813 | */
|
3814 | getSvgSpanStyles(style: any, useWhiteSpace?: boolean): string;
|
3815 | /**
|
3816 | * Returns text-decoration property for svg-export
|
3817 | * @param {Object} style the object from which to retrieve style properties
|
3818 | * @return {String}
|
3819 | */
|
3820 | getSvgTextDecoration(style: any): string;
|
3821 | /**
|
3822 | * Checks if object is contained within the canvas with current viewportTransform
|
3823 | * the check is done stopping at first point that appears on screen
|
3824 | * @param {Boolean} [calculate] use coordinates of current position instead of .aCoords
|
3825 | * @return {Boolean} true if object is fully or partially contained within canvas
|
3826 | */
|
3827 | isOnScreen(calculate?: boolean): boolean;
|
3828 | /**
|
3829 | * Checks if object is partially contained within the canvas with current viewportTransform
|
3830 | * @param {Boolean} [calculate] use coordinates of current position instead of .oCoords
|
3831 | * @return {Boolean} true if object is partially contained within canvas
|
3832 | */
|
3833 | isPartiallyOnScreen(calculate?: boolean): boolean;
|
3834 | /**
|
3835 | * This callback function is called every time _discardActiveObject or _setActiveObject
|
3836 | * try to to deselect this object. If the function returns true, the process is cancelled
|
3837 | * @return {Boolean} true to cancel selection
|
3838 | */
|
3839 | onDeselect(options: { e?: Event | undefined; object?: Object | undefined }): boolean;
|
3840 | /**
|
3841 | * This callback function is called every time _discardActiveObject or _setActiveObject
|
3842 | * try to to deselect this object. If the function returns true, the process is cancelled
|
3843 | * @param {Object} [options] options sent from the upper functions
|
3844 | * @param {Event} [options.e] event if the process is generated by an event
|
3845 | */
|
3846 | onDeselect(options: { e?: Event | undefined; object?: fabric.Object | undefined }): boolean;
|
3847 | /**
|
3848 | * This callback function is called every time _discardActiveObject or _setActiveObject
|
3849 | * try to to select this object. If the function returns true, the process is cancelled
|
3850 | */
|
3851 | onSelect(options: { e?: Event | undefined }): boolean;
|
3852 | /**
|
3853 | * Returns svg clipPath representation of an instance
|
3854 | * @param {Function} [reviver] Method for further parsing of svg representation.
|
3855 | * @return {String} svg representation of an instance
|
3856 | */
|
3857 | toClipPathSVG(reviver?: Function): string;
|
3858 | /**
|
3859 | * Returns svg representation of an instance
|
3860 | * @param {Function} [reviver] Method for further parsing of svg representation.
|
3861 | * @return {String} svg representation of an instance
|
3862 | */
|
3863 | toSVG(reviver?: Function): string;
|
3864 | /**
|
3865 | * Translates the coordinates from a set of origin to another (based on the object's dimensions)
|
3866 | * @param {fabric.Point} point The point which corresponds to the originX and originY params
|
3867 | * @param {String} fromOriginX Horizontal origin: 'left', 'center' or 'right'
|
3868 | * @param {String} fromOriginY Vertical origin: 'top', 'center' or 'bottom'
|
3869 | * @param {String} toOriginX Horizontal origin: 'left', 'center' or 'right'
|
3870 | * @param {String} toOriginY Vertical origin: 'top', 'center' or 'bottom'
|
3871 | * @return {fabric.Point}
|
3872 | */
|
3873 | translateToGivenOrigin(
|
3874 | pointL: Point,
|
3875 | fromOriginX: string,
|
3876 | fromOriginY: string,
|
3877 | toOriginX: string,
|
3878 | toOriginY: string,
|
3879 | ): Point;
|
3880 | /*
|
3881 | * Calculate object dimensions from its properties
|
3882 | * @private
|
3883 | * @return {Object} .x width dimension
|
3884 | * @return {Object} .y height dimension
|
3885 | */
|
3886 | _getNonTransformedDimensions(): { x: number; y: number };
|
3887 | /**
|
3888 | * Returns the top, left coordinates
|
3889 | * @private
|
3890 | * @return {fabric.Point}
|
3891 | */
|
3892 | _getLeftTopCoords(): Point;
|
3893 | /*
|
3894 | * Calculate object bounding box dimensions from its properties scale, skew.
|
3895 | * @private
|
3896 | * @return {Object} .x width dimension
|
3897 | * @return {Object} .y height dimension
|
3898 | */
|
3899 | _getTransformedDimensions(skewX?: number, skewY?: number): { x: number; y: number };
|
3900 |
|
3901 | /**
|
3902 | * @private
|
3903 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
3904 | */
|
3905 | _renderFill(ctx: CanvasRenderingContext2D): void;
|
3906 | /**
|
3907 | * @param ctx
|
3908 | * @private
|
3909 | */
|
3910 | _renderStroke(ctx: CanvasRenderingContext2D): void;
|
3911 | /**
|
3912 | * @private
|
3913 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
3914 | */
|
3915 | _removeShadow(ctx: CanvasRenderingContext2D): void;
|
3916 | /**
|
3917 | * @private
|
3918 | * Sets line dash
|
3919 | * @param {CanvasRenderingContext2D} ctx Context to set the dash line on
|
3920 | * @param {Array} dashArray array representing dashes
|
3921 | * @param {Function} alternative function to call if browser does not support lineDash
|
3922 | */
|
3923 | _setLineDash(
|
3924 | ctx: CanvasRenderingContext2D,
|
3925 | dashArray: number[],
|
3926 | alternative?: (ctx: CanvasRenderingContext2D) => void,
|
3927 | ): void;
|
3928 | /**
|
3929 | * @private
|
3930 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
3931 | * @param {Object} filler fabric.Pattern or fabric.Gradient
|
3932 | * @return {Object} offset.offsetX offset for text rendering
|
3933 | * @return {Object} offset.offsetY offset for text rendering
|
3934 | */
|
3935 | _applyPatternGradientTransform(ctx: CanvasRenderingContext2D, filler: string | Pattern | Gradient): void;
|
3936 | /**
|
3937 | * @private
|
3938 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
3939 | */
|
3940 | _render(ctx: CanvasRenderingContext2D): void;
|
3941 | /**
|
3942 | * @private
|
3943 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
3944 | */
|
3945 | _renderPaintInOrder(ctx: CanvasRenderingContext2D): void;
|
3946 | /**
|
3947 | * Returns the instance of the control visibility set for this object.
|
3948 | * @private
|
3949 | * @returns {Object}
|
3950 | */
|
3951 | _getControlsVisibility(): {
|
3952 | tl: boolean;
|
3953 | tr: boolean;
|
3954 | br: boolean;
|
3955 | bl: boolean;
|
3956 | ml: boolean;
|
3957 | mt: boolean;
|
3958 | mr: boolean;
|
3959 | mb: boolean;
|
3960 | mtr: boolean;
|
3961 | };
|
3962 | /**
|
3963 | * Determines which corner has been clicked
|
3964 | * @private
|
3965 | * @param {Object} pointer The pointer indicating the mouse position
|
3966 | * @return {String|Boolean} corner code (tl, tr, bl, br, etc.), or false if nothing is found
|
3967 | */
|
3968 | _findTargetCorner(pointer: {
|
3969 | x: number;
|
3970 | y: number;
|
3971 | }): boolean | 'bl' | 'br' | 'mb' | 'ml' | 'mr' | 'mt' | 'tl' | 'tr' | 'mtr';
|
3972 | /**
|
3973 | * @private
|
3974 | * @param {String} key
|
3975 | * @param {*} value
|
3976 | */
|
3977 | _set(key: string, value: any): Object;
|
3978 | /**
|
3979 | * Creates fabric Object instance
|
3980 | * @param {string} Class name
|
3981 | * @param {fabric.Object} Original object
|
3982 | * @param {Function} Callback when complete
|
3983 | * @param {Object} Extra parameters for fabric.Object
|
3984 | * @private
|
3985 | * @return {fabric.Object}
|
3986 | */
|
3987 | static _fromObject(className: string, object: Object, callback?: Function, extraParam?: any): Object;
|
3988 | /**
|
3989 | * Defines the number of fraction digits to use when serializing object values.
|
3990 | */
|
3991 | static NUM_FRACTION_DIGITS?: number | undefined;
|
3992 | }
|
3993 |
|
3994 | interface IPathOptions extends IObjectOptions {
|
3995 | /**
|
3996 | * Array of path points
|
3997 | */
|
3998 | path?: Point[] | undefined;
|
3999 | }
|
4000 | export interface Path extends Object, IPathOptions {}
|
4001 | export class Path {
|
4002 | /**
|
4003 | * Constructor
|
4004 | * @param path Path data (sequence of coordinates and corresponding "command" tokens)
|
4005 | * @param [options] Options object
|
4006 | */
|
4007 | constructor(path?: string | Point[], options?: IPathOptions);
|
4008 |
|
4009 | pathOffset: Point;
|
4010 |
|
4011 | /**
|
4012 | * Returns svg clipPath representation of an instance
|
4013 | * @param {Function} [reviver] Method for further parsing of svg representation.
|
4014 | * @return {String} svg representation of an instance
|
4015 | */
|
4016 | toClipPathSVG(reviver?: Function): string;
|
4017 | /**
|
4018 | * Returns svg representation of an instance
|
4019 | * @param [reviver] Method for further parsing of svg representation.
|
4020 | * @return svg representation of an instance
|
4021 | */
|
4022 | toSVG(reviver?: Function): string;
|
4023 | /**
|
4024 | * Creates an instance of fabric.Path from an SVG <path> element
|
4025 | * @param element to parse
|
4026 | * @param callback Callback to invoke when an fabric.Path instance is created
|
4027 | * @param [options] Options object
|
4028 | */
|
4029 | static fromElement(element: SVGElement, callback: Function, options?: IPathOptions): Path;
|
4030 | /**
|
4031 | * Creates an instance of fabric.Path from an object
|
4032 | * @param callback Callback to invoke when an fabric.Path instance is created
|
4033 | */
|
4034 | static fromObject(object: any, callback: Function): Path;
|
4035 | /**
|
4036 | * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`)
|
4037 | */
|
4038 | static ATTRIBUTE_NAMES: string[];
|
4039 | }
|
4040 | export interface Polygon extends IPolylineOptions {}
|
4041 | export class Polygon extends Polyline {
|
4042 | /**
|
4043 | * Constructor
|
4044 | * @param points Array of points
|
4045 | * @param [options] Options object
|
4046 | */
|
4047 | constructor(points: Array<{ x: number; y: number }>, options?: IPolylineOptions);
|
4048 | /**
|
4049 | * Returns Polygon instance from an SVG element
|
4050 | * @param element Element to parse
|
4051 | * @param [options] Options object
|
4052 | */
|
4053 | static fromElement(element: SVGElement, options?: IPolylineOptions): Polygon;
|
4054 | /**
|
4055 | * Returns fabric.Polygon instance from an object representation
|
4056 | * @param object Object to create an instance from
|
4057 | */
|
4058 | static fromObject(object: any): Polygon;
|
4059 | }
|
4060 |
|
4061 | interface IPolylineOptions extends IObjectOptions {
|
4062 | /**
|
4063 | * Points array
|
4064 | */
|
4065 | points?: Point[] | undefined;
|
4066 | }
|
4067 | export interface Polyline extends IPolylineOptions {}
|
4068 | export class Polyline extends Object {
|
4069 | /**
|
4070 | * Constructor
|
4071 | * @param points Array of points (where each point is an object with x and y)
|
4072 | * @param [options] Options object
|
4073 | * @param [skipOffset] Whether points offsetting should be skipped
|
4074 | */
|
4075 | constructor(points: Array<{ x: number; y: number }>, options?: IPolylineOptions);
|
4076 |
|
4077 | pathOffset: Point;
|
4078 |
|
4079 | /**
|
4080 | * Calculate the polygon min and max point from points array,
|
4081 | * returning an object with left, top, width, height to measure the polygon size
|
4082 | * @private
|
4083 | * @return {Object} object.left X coordinate of the polygon leftmost point
|
4084 | * @return {Object} object.top Y coordinate of the polygon topmost point
|
4085 | * @return {Object} object.width distance between X coordinates of the polygon leftmost and rightmost point
|
4086 | * @return {Object} object.height distance between Y coordinates of the polygon topmost and bottommost point
|
4087 | */
|
4088 | _calcDimensions(): { left: number; top: number; width: number; height: number };
|
4089 | /**
|
4090 | * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`)
|
4091 | */
|
4092 | static ATTRIBUTE_NAMES: string[];
|
4093 | /**
|
4094 | * Returns Polyline instance from an SVG element
|
4095 | * @param element Element to parse
|
4096 | * @param [options] Options object
|
4097 | */
|
4098 | static fromElement(element: SVGElement, options?: IPolylineOptions): Polyline;
|
4099 | /**
|
4100 | * Returns fabric.Polyline instance from an object representation
|
4101 | * @param object Object to create an instance from
|
4102 | */
|
4103 | static fromObject(object: any): Polyline;
|
4104 | }
|
4105 |
|
4106 | interface IRectOptions extends IObjectOptions {
|
4107 | /**
|
4108 | * Horizontal border radius
|
4109 | */
|
4110 | rx?: number | undefined;
|
4111 |
|
4112 | /**
|
4113 | * Vertical border radius
|
4114 | */
|
4115 | ry?: number | undefined;
|
4116 | }
|
4117 |
|
4118 | export interface Rect extends IRectOptions {}
|
4119 | export class Rect extends Object {
|
4120 | /**
|
4121 | * Constructor
|
4122 | * @param [options] Options object
|
4123 | */
|
4124 | constructor(options?: IRectOptions);
|
4125 | /**
|
4126 | * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`)
|
4127 | */
|
4128 | static ATTRIBUTE_NAMES: string[];
|
4129 | /**
|
4130 | * Returns Rect instance from an SVG element
|
4131 | * @param element Element to parse
|
4132 | * @param [options] Options object
|
4133 | */
|
4134 | static fromElement(element: SVGElement, options?: IRectOptions): Rect;
|
4135 | /**
|
4136 | * Returns Rect instance from an object representation
|
4137 | * @param object Object to create an instance from
|
4138 | */
|
4139 | static fromObject(object: any): Rect;
|
4140 | }
|
4141 |
|
4142 | interface TextOptions extends IObjectOptions {
|
4143 | type?: string | undefined;
|
4144 | /**
|
4145 | * Font size (in pixels)
|
4146 | * @type Number
|
4147 | */
|
4148 | fontSize?: number | undefined;
|
4149 | /**
|
4150 | * Font weight (e.g. bold, normal, 400, 600, 800)
|
4151 | * @type {(Number|String)}
|
4152 | */
|
4153 | fontWeight?: string | number | undefined;
|
4154 | /**
|
4155 | * Font family
|
4156 | * @type String
|
4157 | */
|
4158 | fontFamily?: string | undefined;
|
4159 | /**
|
4160 | * Text decoration underline.
|
4161 | * @type Boolean
|
4162 | */
|
4163 | underline?: boolean | undefined;
|
4164 | /**
|
4165 | * Text decoration overline.
|
4166 | * @type Boolean
|
4167 | */
|
4168 | overline?: boolean | undefined;
|
4169 | /**
|
4170 | * Text decoration linethrough.
|
4171 | * @type Boolean
|
4172 | */
|
4173 | linethrough?: boolean | undefined;
|
4174 | /**
|
4175 | * Text alignment. Possible values: "left", "center", "right", "justify",
|
4176 | * "justify-left", "justify-center" or "justify-right".
|
4177 | * @type String
|
4178 | */
|
4179 | textAlign?: string | undefined;
|
4180 | /**
|
4181 | * Font style . Possible values: "", "normal", "italic" or "oblique".
|
4182 | * @type String
|
4183 | */
|
4184 | fontStyle?: '' | 'normal' | 'italic' | 'oblique' | undefined;
|
4185 | /**
|
4186 | * Line height
|
4187 | * @type Number
|
4188 | */
|
4189 | lineHeight?: number | undefined;
|
4190 | /**
|
4191 | * Superscript schema object (minimum overlap)
|
4192 | * @type {Object}
|
4193 | */
|
4194 | superscript?: { size: number; baseline: number } | undefined;
|
4195 | /**
|
4196 | * Subscript schema object (minimum overlap)
|
4197 | * @type {Object}
|
4198 | */
|
4199 | subscript?: { size: number; baseline: number } | undefined;
|
4200 | /**
|
4201 | * Background color of text lines
|
4202 | * @type String
|
4203 | */
|
4204 | textBackgroundColor?: string | undefined;
|
4205 | /**
|
4206 | * When defined, an object is rendered via stroke and this property specifies its color.
|
4207 | * <b>Backwards incompatibility note:</b> This property was named "strokeStyle" until v1.1.6
|
4208 | */
|
4209 | stroke?: string | undefined;
|
4210 | /**
|
4211 | * Shadow object representing shadow of this shape.
|
4212 | * <b>Backwards incompatibility note:</b> This property was named "textShadow" (String) until v1.2.11
|
4213 | * @type fabric.Shadow
|
4214 | */
|
4215 | shadow?: Shadow | string | undefined;
|
4216 | /**
|
4217 | * additional space between characters
|
4218 | * expressed in thousands of em unit
|
4219 | * @type Number
|
4220 | */
|
4221 | charSpacing?: number | undefined;
|
4222 | /**
|
4223 | * Object containing character styles - top-level properties -> line numbers,
|
4224 | * 2nd-level properties - charater numbers
|
4225 | * @type Object
|
4226 | */
|
4227 | styles?: any;
|
4228 | /**
|
4229 | * Baseline shift, stlyes only, keep at 0 for the main text object
|
4230 | * @type {Number}
|
4231 | */
|
4232 | deltaY?: number | undefined;
|
4233 | /**
|
4234 | * Text input direction. supporting RTL languages.
|
4235 | */
|
4236 | direction?: 'ltr' | 'rtl' | undefined;
|
4237 | text?: string | undefined;
|
4238 | /**
|
4239 | * List of properties to consider when checking if cache needs refresh
|
4240 | * @type Array
|
4241 | */
|
4242 | cacheProperties?: string[] | undefined;
|
4243 | /**
|
4244 | * List of properties to consider when checking if
|
4245 | * state of an object is changed ({@link fabric.Object#hasStateChanged})
|
4246 | * as well as for history (undo/redo) purposes
|
4247 | * @type Array
|
4248 | */
|
4249 | stateProperties?: string[] | undefined;
|
4250 | }
|
4251 | export interface Text extends TextOptions {}
|
4252 | export class Text extends Object {
|
4253 | _text: string[];
|
4254 | cursorOffsetCache: { top: number; left: number };
|
4255 | /**
|
4256 | * Properties which when set cause object to change dimensions
|
4257 | * @type Object
|
4258 | * @private
|
4259 | */
|
4260 | _dimensionAffectingProps: string[];
|
4261 | /**
|
4262 | * List of lines in text object
|
4263 | * @type Array<string>
|
4264 | */
|
4265 | textLines: string[];
|
4266 | /**
|
4267 | * List of grapheme lines in text object
|
4268 | * @private
|
4269 | * @type Array<string>
|
4270 | */
|
4271 | _textLines: string[][];
|
4272 | /**
|
4273 | * List of unwrapped grapheme lines in text object
|
4274 | * @private
|
4275 | * @type Array<string>
|
4276 | */
|
4277 | _unwrappedTextLines: string[][];
|
4278 | /**
|
4279 | * Use this regular expression to filter for whitespaces that is not a new line.
|
4280 | * Mostly used when text is 'justify' aligned.
|
4281 | * @private
|
4282 | * @type RegExp
|
4283 | */
|
4284 | _reSpacesAndTabs: RegExp;
|
4285 | /**
|
4286 | * Use this regular expression to filter for whitespace that is not a new line.
|
4287 | * Mostly used when text is 'justify' aligned.
|
4288 | * @private
|
4289 | * @type RegExp
|
4290 | */
|
4291 | _reSpaceAndTab: RegExp;
|
4292 | /**
|
4293 | * List of line widths
|
4294 | * @private
|
4295 | * @type Array<Number>
|
4296 | */
|
4297 | __lineWidths: number[];
|
4298 | /**
|
4299 | * List of line heights
|
4300 | * @private
|
4301 | * @type Array<Number>
|
4302 | */
|
4303 | __lineHeights: number[];
|
4304 | /**
|
4305 | * Contains characters bounding boxes for each line and char
|
4306 | * @private
|
4307 | * @type Array of char grapheme bounding boxes
|
4308 | */
|
4309 | __charBounds?: Array<
|
4310 | Array<{ width: number; left: number; height?: number | undefined; kernedWidth?: number | undefined; deltaY?: number | undefined }>
|
4311 | > | undefined;
|
4312 | /**
|
4313 | * Text Line proportion to font Size (in pixels)
|
4314 | * @private
|
4315 | * @type Number
|
4316 | */
|
4317 | _fontSizeMult: number;
|
4318 | /**
|
4319 | * @private
|
4320 | * @type Number
|
4321 | */
|
4322 | _fontSizeFraction: number;
|
4323 | /**
|
4324 | * @private
|
4325 | * @type boolean
|
4326 | */
|
4327 | __skipDimension: boolean;
|
4328 | /**
|
4329 | * use this size when measuring text. To avoid IE11 rounding errors
|
4330 | * @type {Number}
|
4331 | * @default
|
4332 | * @readonly
|
4333 | * @private
|
4334 | */
|
4335 | CACHE_FONT_SIZE: number;
|
4336 |
|
4337 | /**
|
4338 | * Constructor
|
4339 | * @param text Text string
|
4340 | * @param [options] Options object
|
4341 | */
|
4342 | constructor(text: string, options?: TextOptions);
|
4343 |
|
4344 | /**
|
4345 | * Return a context for measurement of text string.
|
4346 | * if created it gets stored for reuse
|
4347 | * @return {fabric.Text} thisArg
|
4348 | */
|
4349 | getMeasuringContext(): CanvasRenderingContext2D;
|
4350 |
|
4351 | /**
|
4352 | * Initialize or update text dimensions.
|
4353 | * Updates this.width and this.height with the proper values.
|
4354 | * Does not return dimensions.
|
4355 | */
|
4356 | initDimensions(): void;
|
4357 |
|
4358 | /**
|
4359 | * Enlarge space boxes and shift the others
|
4360 | */
|
4361 | enlargeSpaces(): void;
|
4362 |
|
4363 | /**
|
4364 | * Detect if the text line is ended with an hard break
|
4365 | * text and itext do not have wrapping, return false
|
4366 | * @return {Boolean}
|
4367 | */
|
4368 | isEndOfWrapping(lineIndex: number): boolean;
|
4369 |
|
4370 | /**
|
4371 | * Returns string representation of an instance
|
4372 | */
|
4373 | toString(): string;
|
4374 |
|
4375 | /**
|
4376 | * Computes height of character at given position
|
4377 | * @param {Number} line the line number
|
4378 | * @param {Number} char the character number
|
4379 | * @return {Number} fontSize of the character
|
4380 | */
|
4381 | getHeightOfChar(line: number, char: number): number;
|
4382 |
|
4383 | /**
|
4384 | * measure a text line measuring all characters.
|
4385 | * @param {Number} lineIndex line number
|
4386 | * @return {Object} object.width total width of characters
|
4387 | * @return {Object} object.numOfSpaces length of chars that match this._reSpacesAndTabs
|
4388 | */
|
4389 | measureLine(lineIndex: number): { width: number; numOfSpaces: number };
|
4390 |
|
4391 | /**
|
4392 | * Calculate height of line at 'lineIndex'
|
4393 | * @param {Number} lineIndex index of line to calculate
|
4394 | * @return {Number}
|
4395 | */
|
4396 | getHeightOfLine(lineIndex: number): number;
|
4397 |
|
4398 | /**
|
4399 | * Calculate text box height
|
4400 | */
|
4401 | calcTextHeight(): number;
|
4402 |
|
4403 | /**
|
4404 | * Turns the character into a 'superior figure' (i.e. 'superscript')
|
4405 | * @param {Number} start selection start
|
4406 | * @param {Number} end selection end
|
4407 | * @returns {fabric.Text} thisArg
|
4408 | * @chainable
|
4409 | */
|
4410 | setSuperscript(start: number, end: number): Text;
|
4411 |
|
4412 | /**
|
4413 | * Turns the character into an 'inferior figure' (i.e. 'subscript')
|
4414 | * @param {Number} start selection start
|
4415 | * @param {Number} end selection end
|
4416 | * @returns {fabric.Text} thisArg
|
4417 | * @chainable
|
4418 | */
|
4419 | setSubscript(start: number, end: number): Text;
|
4420 |
|
4421 | /**
|
4422 | * Retrieves the value of property at given character position
|
4423 | * @param {Number} lineIndex the line number
|
4424 | * @param {Number} charIndex the charater number
|
4425 | * @param {String} property the property name
|
4426 | * @returns the value of 'property'
|
4427 | */
|
4428 | getValueOfPropertyAt(lineIndex: number, charIndex: number, property: string): any;
|
4429 |
|
4430 | static DEFAULT_SVG_FONT_SIZE: number;
|
4431 |
|
4432 | /**
|
4433 | * Returns fabric.Text instance from an SVG element (<b>not yet implemented</b>)
|
4434 | * @static
|
4435 | * @memberOf fabric.Text
|
4436 | * @param {SVGElement} element Element to parse
|
4437 | * @param {Function} callback callback function invoked after parsing
|
4438 | * @param {Object} [options] Options object
|
4439 | */
|
4440 | static fromElement(element: SVGElement, callback?: Function, options?: TextOptions): Text;
|
4441 |
|
4442 | /**
|
4443 | * Returns fabric.Text instance from an object representation
|
4444 | * @static
|
4445 | * @memberOf fabric.Text
|
4446 | * @param {Object} object Object to create an instance from
|
4447 | * @param {Function} [callback] Callback to invoke when an fabric.Text instance is created
|
4448 | */
|
4449 | static fromObject(object: any, callback?: Function): Text;
|
4450 |
|
4451 | /**
|
4452 | * Check if characters in a text have a value for a property
|
4453 | * whose value matches the textbox's value for that property. If so,
|
4454 | * the character-level property is deleted. If the character
|
4455 | * has no other properties, then it is also deleted. Finally,
|
4456 | * if the line containing that character has no other characters
|
4457 | * then it also is deleted.
|
4458 | *
|
4459 | * @param {string} property The property to compare between characters and text.
|
4460 | */
|
4461 | cleanStyle(property: string): void;
|
4462 |
|
4463 | /**
|
4464 | * Returns 2d representation (lineIndex and charIndex) of cursor (or selection start)
|
4465 | * @param {Number} [selectionStart] Optional index. When not given, current selectionStart is used.
|
4466 | * @param {Boolean} [skipWrapping] consider the location for unwrapped lines. usefull to manage styles.
|
4467 | */
|
4468 | get2DCursorLocation(selectionStart?: number, skipWrapping?: boolean): { lineIndex: number; charIndex: number };
|
4469 |
|
4470 | /**
|
4471 | * return a new object that contains all the style property for a character
|
4472 | * the object returned is newly created
|
4473 | * @param {Number} lineIndex of the line where the character is
|
4474 | * @param {Number} charIndex position of the character on the line
|
4475 | * @return {Object} style object
|
4476 | */
|
4477 | getCompleteStyleDeclaration(lineIndex: number, charIndex: number): any;
|
4478 |
|
4479 | /**
|
4480 | * Gets style of a current selection/cursor (at the start position)
|
4481 | * if startIndex or endIndex are not provided, slectionStart or selectionEnd will be used.
|
4482 | * @param {Number} [startIndex] Start index to get styles at
|
4483 | * @param {Number} [endIndex] End index to get styles at, if not specified selectionEnd or startIndex + 1
|
4484 | * @param {Boolean} [complete] get full style or not
|
4485 | * @return {Array} styles an array with one, zero or more Style objects
|
4486 | */
|
4487 | getSelectionStyles(startIndex?: number, endIndex?: number, complete?: boolean): any[];
|
4488 |
|
4489 | /**
|
4490 | * Returns styles-string for svg-export
|
4491 | * @param {Boolean} skipShadow a boolean to skip shadow filter output
|
4492 | * @return {String}
|
4493 | */
|
4494 | getSvgStyles(skipShadow?: boolean): string;
|
4495 |
|
4496 | /**
|
4497 | * Returns true if object has no styling or no styling in a line
|
4498 | * @param {Number} lineIndex , lineIndex is on wrapped lines.
|
4499 | * @return {Boolean}
|
4500 | */
|
4501 | isEmptyStyles(lineIndex: number): boolean;
|
4502 |
|
4503 | /**
|
4504 | * Remove a style property or properties from all individual character styles
|
4505 | * in a text object. Deletes the character style object if it contains no other style
|
4506 | * props. Deletes a line style object if it contains no other character styles.
|
4507 | *
|
4508 | * @param {String} props The property to remove from character styles.
|
4509 | */
|
4510 | removeStyle(property: string): void;
|
4511 |
|
4512 | /**
|
4513 | * Sets style of a current selection, if no selection exist, do not set anything.
|
4514 | * @param {Object} [styles] Styles object
|
4515 | * @param {Number} [startIndex] Start index to get styles at
|
4516 | * @param {Number} [endIndex] End index to get styles at, if not specified selectionEnd or startIndex + 1
|
4517 | * @return {fabric.IText} thisArg
|
4518 | * @chainable
|
4519 | */
|
4520 | setSelectionStyles(styles: any, startIndex?: number, endIndex?: number): Text;
|
4521 |
|
4522 | /**
|
4523 | * Returns true if object has a style property or has it ina specified line
|
4524 | * @param {Number} lineIndex
|
4525 | * @return {Boolean}
|
4526 | */
|
4527 | styleHas(property: string, lineIndex?: number): boolean;
|
4528 |
|
4529 | /**
|
4530 | * Measure a single line given its index. Used to calculate the initial
|
4531 | * text bounding box. The values are calculated and stored in __lineWidths cache.
|
4532 | * @private
|
4533 | * @param {Number} lineIndex line number
|
4534 | * @return {Number} Line width
|
4535 | */
|
4536 | getLineWidth(lineIndex: number): number;
|
4537 |
|
4538 | /**
|
4539 | * @private
|
4540 | * @param {Number} lineIndex index text line
|
4541 | * @return {Number} Line left offset
|
4542 | */
|
4543 | _getLineLeftOffset(lineIndex: number): number;
|
4544 |
|
4545 | /**
|
4546 | * apply all the character style to canvas for rendering
|
4547 | * @private
|
4548 | * @param {String} _char
|
4549 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
4550 | * @param {Number} lineIndex
|
4551 | * @param {Number} charIndex
|
4552 | * @param {Object} [decl]
|
4553 | */
|
4554 | _applyCharStyles(
|
4555 | method: string,
|
4556 | ctx: CanvasRenderingContext2D,
|
4557 | lineIndex: number,
|
4558 | charIndex: number,
|
4559 | styleDeclaration: any,
|
4560 | ): void;
|
4561 |
|
4562 | /**
|
4563 | * get the reference, not a clone, of the style object for a given character
|
4564 | * @param {Number} lineIndex
|
4565 | * @param {Number} charIndex
|
4566 | * @return {Object} style object
|
4567 | */
|
4568 | _getStyleDeclaration(lineIndex: number, charIndex: number): any;
|
4569 |
|
4570 | /**
|
4571 | * Generate an object that translates the style object so that it is
|
4572 | * broken up by visual lines (new lines and automatic wrapping).
|
4573 | * The original text styles object is broken up by actual lines (new lines only),
|
4574 | * which is only sufficient for Text / IText
|
4575 | * @private
|
4576 | */
|
4577 | _generateStyleMap(textInfo: {
|
4578 | _unwrappedLines: string[];
|
4579 | lines: string[];
|
4580 | graphemeText: string[];
|
4581 | graphemeLines: string[];
|
4582 | }): { [s: number]: { line: number; offset: number } };
|
4583 |
|
4584 | /**
|
4585 | * @private
|
4586 | * Gets the width of character spacing
|
4587 | */
|
4588 | _getWidthOfCharSpacing(): number;
|
4589 |
|
4590 | /**
|
4591 | * measure and return the width of a single character.
|
4592 | * possibly overridden to accommodate different measure logic or
|
4593 | * to hook some external lib for character measurement
|
4594 | * @private
|
4595 | * @param {String} char to be measured
|
4596 | * @param {Object} charStyle style of char to be measured
|
4597 | * @param {String} [previousChar] previous char
|
4598 | * @param {Object} [prevCharStyle] style of previous char
|
4599 | * @return {Object} object contained char width anf kerned width
|
4600 | */
|
4601 | _measureChar(
|
4602 | _char: string,
|
4603 | charStyle: any,
|
4604 | previousChar: string,
|
4605 | prevCharStyle: any,
|
4606 | ): { width: number; kernedWidth: number };
|
4607 |
|
4608 | /**
|
4609 | * @private
|
4610 | * @param {String} method
|
4611 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
4612 | * @param {String} line Content of the line
|
4613 | * @param {Number} left
|
4614 | * @param {Number} top
|
4615 | * @param {Number} lineIndex
|
4616 | * @param {Number} charOffset
|
4617 | */
|
4618 | _renderChars(
|
4619 | method: string,
|
4620 | ctx: CanvasRenderingContext2D,
|
4621 | line: string,
|
4622 | left: number,
|
4623 | top: number,
|
4624 | lineIndex: number,
|
4625 | ): void;
|
4626 |
|
4627 | /**
|
4628 | * @private
|
4629 | * @param {String} method
|
4630 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
4631 | * @param {Number} lineIndex
|
4632 | * @param {Number} charIndex
|
4633 | * @param {String} _char
|
4634 | * @param {Number} left Left coordinate
|
4635 | * @param {Number} top Top coordinate
|
4636 | * @param {Number} lineHeight Height of the line
|
4637 | */
|
4638 | _renderChar(
|
4639 | method: string,
|
4640 | ctx: CanvasRenderingContext2D,
|
4641 | lineIndex: number,
|
4642 | charIndex: number,
|
4643 | _char: string,
|
4644 | left: number,
|
4645 | top: number,
|
4646 | ): void;
|
4647 |
|
4648 | /**
|
4649 | * @private
|
4650 | * @param {String} method Method name ("fillText" or "strokeText")
|
4651 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
4652 | * @param {Array} line Text to render
|
4653 | * @param {Number} left Left position of text
|
4654 | * @param {Number} top Top position of text
|
4655 | * @param {Number} lineIndex Index of a line in a text
|
4656 | */
|
4657 | _renderTextLine(
|
4658 | method: string,
|
4659 | ctx: CanvasRenderingContext2D,
|
4660 | line: string[],
|
4661 | left: number,
|
4662 | top: number,
|
4663 | lineIndex: number,
|
4664 | ): void;
|
4665 |
|
4666 | /**
|
4667 | * @private
|
4668 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
4669 | */
|
4670 | _renderText(ctx: CanvasRenderingContext2D): void;
|
4671 |
|
4672 | /**
|
4673 | * @private
|
4674 | */
|
4675 | _clearCache(): void;
|
4676 |
|
4677 | /**
|
4678 | * Divides text into lines of text and lines of graphemes.
|
4679 | * @private
|
4680 | * @returns {Object} Lines and text in the text
|
4681 | */
|
4682 | _splitText(): { _unwrappedLines: string[]; lines: string[]; graphemeText: string[]; graphemeLines: string[] };
|
4683 |
|
4684 | /**
|
4685 | * @private
|
4686 | * @param {Object} prevStyle
|
4687 | * @param {Object} thisStyle
|
4688 | */
|
4689 | _hasStyleChanged(prevStyle: any, thisStyle: any): boolean;
|
4690 |
|
4691 | /**
|
4692 | * Set the font parameter of the context with the object properties or with charStyle
|
4693 | * @private
|
4694 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
4695 | * @param {Object} [charStyle] object with font style properties
|
4696 | * @param {String} [charStyle.fontFamily] Font Family
|
4697 | * @param {Number} [charStyle.fontSize] Font size in pixels. ( without px suffix )
|
4698 | * @param {String} [charStyle.fontWeight] Font weight
|
4699 | * @param {String} [charStyle.fontStyle] Font style (italic|normal)
|
4700 | */
|
4701 | _setTextStyles(
|
4702 | ctx: CanvasRenderingContext2D,
|
4703 | charStyle?: { fontFamily: string; fontSize: number; fontWieght: string; fontStyle: string },
|
4704 | forMeasuring?: boolean,
|
4705 | ): void;
|
4706 |
|
4707 | /**
|
4708 | * @private
|
4709 | * @param {String} method Method name ("fillText" or "strokeText")
|
4710 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
4711 | * @param {String} line Text to render
|
4712 | * @param {Number} left Left position of text
|
4713 | * @param {Number} top Top position of text
|
4714 | * @param {Number} lineIndex Index of a line in a text
|
4715 | */
|
4716 | _renderTextLine(
|
4717 | method: string,
|
4718 | ctx: CanvasRenderingContext2D,
|
4719 | line: string,
|
4720 | left: number,
|
4721 | top: number,
|
4722 | lineIndex: number,
|
4723 | ): void;
|
4724 |
|
4725 | /**
|
4726 | * @private
|
4727 | */
|
4728 | _shouldClearDimensionCache(): boolean;
|
4729 | }
|
4730 | interface ITextOptions extends TextOptions {
|
4731 | /**
|
4732 | * Index where text selection starts (or where cursor is when there is no selection)
|
4733 | * @type Number
|
4734 | */
|
4735 | selectionStart?: number | undefined;
|
4736 | /**
|
4737 | * Index where text selection ends
|
4738 | * @type Number
|
4739 | */
|
4740 | selectionEnd?: number | undefined;
|
4741 | /**
|
4742 | * Color of text selection
|
4743 | * @type String
|
4744 | */
|
4745 | selectionColor?: string | undefined;
|
4746 | /**
|
4747 | * Indicates whether text is selected
|
4748 | * @type Boolean
|
4749 | */
|
4750 | selected?: boolean | undefined;
|
4751 | /**
|
4752 | * Indicates whether text is in editing mode
|
4753 | * @type Boolean
|
4754 | */
|
4755 | isEditing?: boolean | undefined;
|
4756 | /**
|
4757 | * Indicates whether a text can be edited
|
4758 | * @type Boolean
|
4759 | */
|
4760 | editable?: boolean | undefined;
|
4761 | /**
|
4762 | * Border color of text object while it's in editing mode
|
4763 | * @type String
|
4764 | */
|
4765 | editingBorderColor?: string | undefined;
|
4766 | /**
|
4767 | * Width of cursor (in px)
|
4768 | * @type Number
|
4769 | */
|
4770 | cursorWidth?: number | undefined;
|
4771 | /**
|
4772 | * Color of default cursor (when not overwritten by character style)
|
4773 | * @type String
|
4774 | */
|
4775 | cursorColor?: string | undefined;
|
4776 | /**
|
4777 | * Delay between cursor blink (in ms)
|
4778 | * @type Number
|
4779 | */
|
4780 | cursorDelay?: number | undefined;
|
4781 | /**
|
4782 | * Duration of cursor fadein (in ms)
|
4783 | * @type Number
|
4784 | */
|
4785 | cursorDuration?: number | undefined;
|
4786 | /**
|
4787 | * Indicates whether internal text char widths can be cached
|
4788 | * @type Boolean
|
4789 | */
|
4790 | caching?: boolean | undefined;
|
4791 | /**
|
4792 | * Helps determining when the text is in composition, so that the cursor
|
4793 | * rendering is altered.
|
4794 | */
|
4795 | inCompositionMode?: boolean | undefined;
|
4796 | path?: string | undefined;
|
4797 | useNative?: boolean | undefined;
|
4798 | /**
|
4799 | * For functionalities on keyDown + ctrl || cmd
|
4800 | */
|
4801 | ctrlKeysMapDown?: any;
|
4802 | /**
|
4803 | * For functionalities on keyUp + ctrl || cmd
|
4804 | */
|
4805 | ctrlKeysMapUp?: any;
|
4806 | /**
|
4807 | * For functionalities on keyDown
|
4808 | * Map a special key to a function of the instance/prototype
|
4809 | * If you need different behaviour for ESC or TAB or arrows, you have to change
|
4810 | * this map setting the name of a function that you build on the fabric.Itext or
|
4811 | * your prototype.
|
4812 | * the map change will affect all Instances unless you need for only some text Instances
|
4813 | * in that case you have to clone this object and assign your Instance.
|
4814 | * this.keysMap = fabric.util.object.clone(this.keysMap);
|
4815 | * The function must be in fabric.Itext.prototype.myFunction And will receive event as args[0]
|
4816 | */
|
4817 | keysMap?: any;
|
4818 | /**
|
4819 | * Exposes underlying hidden text area
|
4820 | */
|
4821 | hiddenTextarea?: HTMLTextAreaElement | undefined;
|
4822 | }
|
4823 | export interface IText extends ITextOptions {}
|
4824 | export class IText extends Text {
|
4825 | fromPaste: boolean;
|
4826 | /**
|
4827 | * @private
|
4828 | */
|
4829 | _currentCursorOpacity: number;
|
4830 | /**
|
4831 | * @private
|
4832 | */
|
4833 | _reSpace: RegExp;
|
4834 | /**
|
4835 | * Constructor
|
4836 | * @param text Text string
|
4837 | * @param [options] Options object
|
4838 | */
|
4839 | constructor(text: string, options?: ITextOptions);
|
4840 | /**
|
4841 | * Sets selection start (left boundary of a selection)
|
4842 | * @param {Number} index Index to set selection start to
|
4843 | */
|
4844 | setSelectionStart(index: number): void;
|
4845 | /**
|
4846 | * Sets selection end (right boundary of a selection)
|
4847 | * @param {Number} index Index to set selection end to
|
4848 | */
|
4849 | setSelectionEnd(index: number): void;
|
4850 | /**
|
4851 | * Prepare and clean the contextTop
|
4852 | */
|
4853 | clearContextTop(skipRestore?: boolean): void;
|
4854 | /**
|
4855 | * Renders cursor or selection (depending on what exists)
|
4856 | */
|
4857 | renderCursorOrSelection(): void;
|
4858 | /**
|
4859 | * Renders cursor
|
4860 | * @param {Object} boundaries
|
4861 | * @param {CanvasRenderingContext2D} ctx transformed context to draw on
|
4862 | */
|
4863 | renderCursor(boundaries: any, ctx: CanvasRenderingContext2D): void;
|
4864 | /**
|
4865 | * Renders text selection
|
4866 | * @param {Object} boundaries Object with left/top/leftOffset/topOffset
|
4867 | * @param {CanvasRenderingContext2D} ctx transformed context to draw on
|
4868 | */
|
4869 | renderSelection(boundaries: any, ctx: CanvasRenderingContext2D): void;
|
4870 | /**
|
4871 | * High level function to know the height of the cursor.
|
4872 | * the currentChar is the one that precedes the cursor
|
4873 | * Returns fontSize of char at the current cursor
|
4874 | * @return {Number} Character font size
|
4875 | */
|
4876 | getCurrentCharFontSize(): number;
|
4877 | /**
|
4878 | * High level function to know the color of the cursor.
|
4879 | * the currentChar is the one that precedes the cursor
|
4880 | * Returns color (fill) of char at the current cursor
|
4881 | * @return {String} Character color (fill)
|
4882 | */
|
4883 | getCurrentCharColor(): string;
|
4884 | /**
|
4885 | * Returns fabric.IText instance from an object representation
|
4886 | * @static
|
4887 | * @memberOf fabric.IText
|
4888 | * @param {Object} object Object to create an instance from
|
4889 | * @param {function} [callback] invoked with new instance as argument
|
4890 | */
|
4891 | static fromObject(object: any, callback?: Function): IText;
|
4892 | /**
|
4893 | * Initializes all the interactive behavior of IText
|
4894 | */
|
4895 | initBehavior(): void;
|
4896 | /**
|
4897 | * Initializes "added" event handler
|
4898 | */
|
4899 | initAddedHandler(): void;
|
4900 | /**
|
4901 | * Initializes delayed cursor
|
4902 | */
|
4903 | initDelayedCursor(): void;
|
4904 | /**
|
4905 | * Aborts cursor animation and clears all timeouts
|
4906 | */
|
4907 | abortCursorAnimation(): void;
|
4908 | /**
|
4909 | * Selects entire text
|
4910 | * @return {fabric.IText} thisArg
|
4911 | * @chainable
|
4912 | */
|
4913 | selectAll(): IText;
|
4914 | /**
|
4915 | * Returns selected text
|
4916 | * @return {String}
|
4917 | */
|
4918 | getSelectedText(): string;
|
4919 | /**
|
4920 | * Find new selection index representing start of current word according to current selection index
|
4921 | * @param {Number} startFrom Surrent selection index
|
4922 | * @return {Number} New selection index
|
4923 | */
|
4924 | findWordBoundaryLeft(startFrom: number): number;
|
4925 | /**
|
4926 | * Find new selection index representing end of current word according to current selection index
|
4927 | * @param {Number} startFrom Current selection index
|
4928 | * @return {Number} New selection index
|
4929 | */
|
4930 | findWordBoundaryRight(startFrom: number): number;
|
4931 | /**
|
4932 | * Find new selection index representing start of current line according to current selection index
|
4933 | * @param {Number} startFrom Current selection index
|
4934 | * @return {Number} New selection index
|
4935 | */
|
4936 | findLineBoundaryLeft(startFrom: number): number;
|
4937 | /**
|
4938 | * Find new selection index representing end of current line according to current selection index
|
4939 | * @param {Number} startFrom Current selection index
|
4940 | * @return {Number} New selection index
|
4941 | */
|
4942 | findLineBoundaryRight(startFrom: number): number;
|
4943 | /**
|
4944 | * Finds index corresponding to beginning or end of a word
|
4945 | * @param {Number} selectionStart Index of a character
|
4946 | * @param {Number} direction 1 or -1
|
4947 | * @return {Number} Index of the beginning or end of a word
|
4948 | */
|
4949 | searchWordBoundary(selectionStart: number, direction: number): number;
|
4950 | /**
|
4951 | * Selects a word based on the index
|
4952 | * @param {Number} selectionStart Index of a character
|
4953 | */
|
4954 | selectWord(selectionStart: number): void;
|
4955 | /**
|
4956 | * Selects a line based on the index
|
4957 | * @param {Number} selectionStart Index of a character
|
4958 | * @return {fabric.IText} thisArg
|
4959 | * @chainable
|
4960 | */
|
4961 | selectLine(selectionStart: number): IText;
|
4962 | /**
|
4963 | * Enters editing state
|
4964 | * @return {fabric.IText} thisArg
|
4965 | * @chainable
|
4966 | */
|
4967 | enterEditing(e?: MouseEvent): IText;
|
4968 | /**
|
4969 | * Initializes "mousemove" event handler
|
4970 | */
|
4971 | initMouseMoveHandler(): void;
|
4972 | /**
|
4973 | * Exits from editing state
|
4974 | * @return {fabric.IText} thisArg
|
4975 | * @chainable
|
4976 | */
|
4977 | exitEditing(): IText;
|
4978 | /**
|
4979 | * remove and reflow a style block from start to end.
|
4980 | * @param {Number} start linear start position for removal (included in removal)
|
4981 | * @param {Number} end linear end position for removal ( excluded from removal )
|
4982 | */
|
4983 | removeStyleFromTo(start: number, end: number): void;
|
4984 | /**
|
4985 | * Shifts line styles up or down
|
4986 | * @param {Number} lineIndex Index of a line
|
4987 | * @param {Number} offset Can any number?
|
4988 | */
|
4989 | shiftLineStyles(lineIndex: number, offset: number): void;
|
4990 | /**
|
4991 | * Inserts new style object
|
4992 | * @param {Number} lineIndex Index of a line
|
4993 | * @param {Number} charIndex Index of a char
|
4994 | * @param {Number} qty number of lines to add
|
4995 | * @param {Array} copiedStyle Array of objects styles
|
4996 | */
|
4997 | insertNewlineStyleObject(lineIndex: number, charIndex: number, qty: number, copiedStyle: any[]): void;
|
4998 | /**
|
4999 | * Inserts style object for a given line/char index
|
5000 | * @param {Number} lineIndex Index of a line
|
5001 | * @param {Number} charIndex Index of a char
|
5002 | * @param {Number} quantity number Style object to insert, if given
|
5003 | * @param {Array} copiedStyle array of style objecs
|
5004 | */
|
5005 | insertCharStyleObject(lineIndex: number, charIndex: number, quantity: number, copiedStyle: any[]): void;
|
5006 | /**
|
5007 | * Inserts style object(s)
|
5008 | * @param {Array} insertedText Characters at the location where style is inserted
|
5009 | * @param {Number} start cursor index for inserting style
|
5010 | * @param {Array} [copiedStyle] array of style objects to insert.
|
5011 | */
|
5012 | insertNewStyleBlock(insertedText: any[], start: number, copiedStyle?: any[]): void;
|
5013 | /**
|
5014 | * Set the selectionStart and selectionEnd according to the ne postion of cursor
|
5015 | * mimic the key - mouse navigation when shift is pressed.
|
5016 | */
|
5017 | setSelectionStartEndWithShift(start: number, end: number, newSelection: number): void;
|
5018 | /**
|
5019 | * Copies selected text
|
5020 | */
|
5021 | copy(): void;
|
5022 | /**
|
5023 | * convert from fabric to textarea values
|
5024 | */
|
5025 | fromGraphemeToStringSelection(
|
5026 | start: number,
|
5027 | end: number,
|
5028 | _text: string,
|
5029 | ): { selectionStart: number; selectionEnd: number };
|
5030 | /**
|
5031 | * convert from textarea to grapheme indexes
|
5032 | */
|
5033 | fromStringToGraphemeSelection(
|
5034 | start: number,
|
5035 | end: number,
|
5036 | text: string,
|
5037 | ): { selectionStart: number; selectionEnd: number };
|
5038 | /**
|
5039 | * Gets start offset of a selection
|
5040 | * @param {Event} e Event object
|
5041 | * @param {Boolean} isRight
|
5042 | * @return {Number}
|
5043 | */
|
5044 | getDownCursorOffset(e: Event, isRight?: boolean): number;
|
5045 | /**
|
5046 | * Returns index of a character corresponding to where an object was clicked
|
5047 | * @param {Event} e Event object
|
5048 | * @return {Number} Index of a character
|
5049 | */
|
5050 | getSelectionStartFromPointer(e: Event): number;
|
5051 | /**
|
5052 | * @param {Event} e Event object
|
5053 | * @param {Boolean} isRight
|
5054 | * @return {Number}
|
5055 | */
|
5056 | getUpCursorOffset(e: Event, isRight?: boolean): number;
|
5057 | /**
|
5058 | * Initializes double and triple click event handlers
|
5059 | */
|
5060 | initClicks(): void;
|
5061 | /**
|
5062 | * Initializes event handlers related to cursor or selection
|
5063 | */
|
5064 | initCursorSelectionHandlers(): void;
|
5065 | /**
|
5066 | * Initializes "dbclick" event handler
|
5067 | */
|
5068 | initDoubleClickSimulation(): void;
|
5069 | /**
|
5070 | * Initializes hidden textarea (needed to bring up keyboard in iOS)
|
5071 | */
|
5072 | initHiddenTextarea(): void;
|
5073 | /**
|
5074 | * Initializes "mousedown" event handler
|
5075 | */
|
5076 | initMousedownHandler(): void;
|
5077 | /**
|
5078 | * Initializes "mouseup" event handler
|
5079 | */
|
5080 | initMouseupHandler(): void;
|
5081 | /**
|
5082 | * insert characters at start position, before start position.
|
5083 | * start equal 1 it means the text get inserted between actual grapheme 0 and 1
|
5084 | * if style array is provided, it must be as the same length of text in graphemes
|
5085 | * if end is provided and is bigger than start, old text is replaced.
|
5086 | * start/end ar per grapheme position in _text array.
|
5087 | *
|
5088 | * @param {String} text text to insert
|
5089 | * @param {Array} style array of style objects
|
5090 | * @param {Number} start
|
5091 | * @param {Number} end default to start + 1
|
5092 | */
|
5093 | insertChars(text: string, style: any[], start: number, end: number): void;
|
5094 | /**
|
5095 | * Moves cursor down
|
5096 | * @param {Event} e Event object
|
5097 | */
|
5098 | moveCursorDown(e: Event): void;
|
5099 | /**
|
5100 | * Moves cursor left
|
5101 | * @param {Event} e Event object
|
5102 | */
|
5103 | moveCursorLeft(e: Event): void;
|
5104 | /**
|
5105 | * Moves cursor left without keeping selection
|
5106 | * @param {Event} e
|
5107 | */
|
5108 | moveCursorLeftWithoutShift(e: Event): void;
|
5109 | /**
|
5110 | * Moves cursor left while keeping selection
|
5111 | * @param {Event} e
|
5112 | */
|
5113 | moveCursorLeftWithShift(e: Event): void;
|
5114 | /**
|
5115 | * Moves cursor right
|
5116 | * @param {Event} e Event object
|
5117 | */
|
5118 | moveCursorRight(e: Event): void;
|
5119 | /**
|
5120 | * Moves cursor right without keeping selection
|
5121 | * @param {Event} e Event object
|
5122 | */
|
5123 | moveCursorRightWithoutShift(e: Event): void;
|
5124 | /**
|
5125 | * Moves cursor right while keeping selection
|
5126 | * @param {Event} e
|
5127 | */
|
5128 | moveCursorRightWithShift(e: Event): void;
|
5129 | /**
|
5130 | * Moves cursor up
|
5131 | * @param {Event} e Event object
|
5132 | */
|
5133 | moveCursorUp(e: Event): void;
|
5134 | /**
|
5135 | * Moves cursor up without shift
|
5136 | * @param {Number} offset
|
5137 | */
|
5138 | moveCursorWithoutShift(offset: number): void;
|
5139 | /**
|
5140 | * Moves cursor with shift
|
5141 | * @param {Number} offset
|
5142 | */
|
5143 | moveCursorWithShift(offset: number): void;
|
5144 | /**
|
5145 | * Composition end
|
5146 | */
|
5147 | onCompositionEnd(): void;
|
5148 | /**
|
5149 | * Composition start
|
5150 | */
|
5151 | onCompositionStart(): void;
|
5152 | /**
|
5153 | * Handles onInput event
|
5154 | * @param {Event} e Event object
|
5155 | */
|
5156 | onInput(e: Event): void;
|
5157 | /**
|
5158 | * Handles keyup event
|
5159 | * @param {Event} e Event object
|
5160 | */
|
5161 | onKeyDown(e: Event): void;
|
5162 | /**
|
5163 | * Handles keyup event
|
5164 | * We handle KeyUp because ie11 and edge have difficulties copy/pasting
|
5165 | * if a copy/cut event fired, keyup is dismissed
|
5166 | * @param {Event} e Event object
|
5167 | */
|
5168 | onKeyUp(e: Event): void;
|
5169 | /**
|
5170 | * Pastes text
|
5171 | */
|
5172 | paste(): void;
|
5173 | /**
|
5174 | * Removes characters from start/end
|
5175 | * start/end ar per grapheme position in _text array.
|
5176 | *
|
5177 | * @param {Number} start
|
5178 | * @param {Number} end default to start + 1
|
5179 | */
|
5180 | removeChars(start: number, end: number): void;
|
5181 | /**
|
5182 | * Changes cursor location in a text depending on passed pointer (x/y) object
|
5183 | * @param {Event} e Event object
|
5184 | */
|
5185 | setCursorByClick(e: Event): void;
|
5186 | /**
|
5187 | * @private
|
5188 | */
|
5189 | _getNewSelectionStartFromOffset(
|
5190 | mouseOffset: { x: number; y: number },
|
5191 | prevWidth: number,
|
5192 | width: number,
|
5193 | index: number,
|
5194 | jlen: number,
|
5195 | ): number;
|
5196 | /**
|
5197 | * @private
|
5198 | * @param {CanvasRenderingContext2D} ctx Context to render on
|
5199 | */
|
5200 | _render(ctx: CanvasRenderingContext2D): void;
|
5201 | /**
|
5202 | * @private
|
5203 | */
|
5204 | _updateTextarea(): void;
|
5205 | /**
|
5206 | * @private
|
5207 | */
|
5208 | updateFromTextArea(): void;
|
5209 | /**
|
5210 | * Default event handler for the basic functionalities needed on _mouseDown
|
5211 | * can be overridden to do something different.
|
5212 | * Scope of this implementation is: find the click position, set selectionStart
|
5213 | * find selectionEnd, initialize the drawing of either cursor or selection area
|
5214 | * @private
|
5215 | * @param {Object} Options (seems to have an event `e` parameter
|
5216 | */
|
5217 | _mouseDownHandler(options: any): void;
|
5218 | |
5219 |
|
5220 |
|
5221 |
|
5222 | _calcTextareaPosition(): { left: string; top: string; fontSize: string; charHeight: number };
|
5223 | }
|
5224 | interface ITextboxOptions extends ITextOptions {
|
5225 | |
5226 |
|
5227 |
|
5228 |
|
5229 | minWidth?: number | undefined;
|
5230 | |
5231 |
|
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 | dynamicMinWidth?: number | undefined;
|
5237 | |
5238 |
|
5239 |
|
5240 | lockScalingFlip?: boolean | undefined;
|
5241 | |
5242 |
|
5243 |
|
5244 |
|
5245 | noScaleCache?: boolean | undefined;
|
5246 | |
5247 |
|
5248 |
|
5249 |
|
5250 |
|
5251 |
|
5252 | splitByGrapheme?: boolean | undefined;
|
5253 | |
5254 |
|
5255 |
|
5256 |
|
5257 | isWrapping?: boolean | undefined;
|
5258 | }
|
5259 | export interface Textbox extends ITextboxOptions {}
|
5260 | export class Textbox extends IText {
|
5261 | |
5262 |
|
5263 |
|
5264 |
|
5265 |
|
5266 | constructor(text: string, options?: ITextboxOptions);
|
5267 | |
5268 |
|
5269 |
|
5270 |
|
5271 |
|
5272 | styleHas(property: string, lineIndex: number): boolean;
|
5273 | |
5274 |
|
5275 |
|
5276 |
|
5277 |
|
5278 | isEmptyStyles(lineIndex: number): boolean;
|
5279 | |
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 |
|
5285 | isEndOfWrapping(lineIndex: number): boolean;
|
5286 | |
5287 |
|
5288 |
|
5289 |
|
5290 | getMinWidth(): number;
|
5291 | |
5292 |
|
5293 |
|
5294 |
|
5295 |
|
5296 | _wordJoiners: RegExp;
|
5297 | |
5298 |
|
5299 |
|
5300 |
|
5301 |
|
5302 |
|
5303 |
|
5304 |
|
5305 |
|
5306 | _measureWord(word: string[], lineIndex: number, charOffset: number): number;
|
5307 | |
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 |
|
5313 |
|
5314 |
|
5315 |
|
5316 | _wrapText(lines: string[], desiredWidth: number): string[][];
|
5317 | |
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 | _styleMap?: { [s: number]: { line: number; offset: number } } | undefined;
|
5327 | |
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 |
|
5333 |
|
5334 | static fromObject(object: any, callback?: Function): Textbox;
|
5335 | }
|
5336 | interface ITriangleOptions extends IObjectOptions {}
|
5337 | export class Triangle extends Object {
|
5338 | |
5339 |
|
5340 |
|
5341 |
|
5342 | constructor(options?: ITriangleOptions);
|
5343 | |
5344 |
|
5345 |
|
5346 |
|
5347 |
|
5348 | toSVG(reviver?: Function): string;
|
5349 | |
5350 |
|
5351 |
|
5352 |
|
5353 | static fromObject(object: any): Triangle;
|
5354 | }
|
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 | interface IAllFilters {
|
5360 | BaseFilter: {
|
5361 | |
5362 |
|
5363 |
|
5364 |
|
5365 | new (options?: any): IBaseFilter;
|
5366 | };
|
5367 | BlendColor: {
|
5368 | |
5369 |
|
5370 |
|
5371 |
|
5372 | new (options?: { color?: string | undefined; mode?: string | undefined; alpha?: number | undefined }): IBlendColorFilter;
|
5373 | |
5374 |
|
5375 |
|
5376 |
|
5377 | fromObject(object: any): IBlendColorFilter;
|
5378 | };
|
5379 | BlendImage: {
|
5380 | |
5381 |
|
5382 |
|
5383 |
|
5384 | new (options?: { image?: Image | undefined; mode?: string | undefined; alpha?: number | undefined }): IBlendImageFilter;
|
5385 | |
5386 |
|
5387 |
|
5388 |
|
5389 | fromObject(object: any): IBlendImageFilter;
|
5390 | };
|
5391 | Brightness: {
|
5392 | new (options?: {
|
5393 | |
5394 |
|
5395 |
|
5396 |
|
5397 | brightness: number;
|
5398 | }): IBrightnessFilter;
|
5399 | |
5400 |
|
5401 |
|
5402 |
|
5403 | fromObject(object: any): IBrightnessFilter;
|
5404 | };
|
5405 | ColorMatrix: {
|
5406 | new (options?: {
|
5407 |
|
5408 | matrix?: number[] | undefined;
|
5409 | }): IColorMatrix;
|
5410 | |
5411 |
|
5412 |
|
5413 |
|
5414 | fromObject(object: any): IColorMatrix;
|
5415 | };
|
5416 | Contrast: {
|
5417 | |
5418 |
|
5419 |
|
5420 |
|
5421 | new (options?: { contrast?: number | undefined }): IContrastFilter;
|
5422 | |
5423 |
|
5424 |
|
5425 |
|
5426 | fromObject(object: any): IContrastFilter;
|
5427 | };
|
5428 | Convolute: {
|
5429 | new (options?: {
|
5430 | opaque?: boolean | undefined;
|
5431 |
|
5432 | matrix?: number[] | undefined;
|
5433 | }): IConvoluteFilter;
|
5434 | |
5435 |
|
5436 |
|
5437 |
|
5438 | fromObject(object: any): IConvoluteFilter;
|
5439 | };
|
5440 | GradientTransparency: {
|
5441 | new (options?: {
|
5442 |
|
5443 | threshold?: number | undefined;
|
5444 | }): IGradientTransparencyFilter;
|
5445 | |
5446 |
|
5447 |
|
5448 |
|
5449 | fromObject(object: any): IGradientTransparencyFilter;
|
5450 | };
|
5451 | Grayscale: {
|
5452 | new (options?: any): IGrayscaleFilter;
|
5453 | |
5454 |
|
5455 |
|
5456 |
|
5457 | fromObject(object: any): IGrayscaleFilter;
|
5458 | };
|
5459 | Invert: {
|
5460 | |
5461 |
|
5462 |
|
5463 |
|
5464 | new (options?: any): IInvertFilter;
|
5465 | |
5466 |
|
5467 |
|
5468 |
|
5469 | fromObject(object: any): IInvertFilter;
|
5470 | };
|
5471 | Mask: {
|
5472 | new (options?: {
|
5473 |
|
5474 | mask?: Image | undefined;
|
5475 | |
5476 |
|
5477 |
|
5478 |
|
5479 | channel: number;
|
5480 | }): IMaskFilter;
|
5481 | |
5482 |
|
5483 |
|
5484 |
|
5485 | fromObject(object: any): IMaskFilter;
|
5486 | };
|
5487 | Multiply: {
|
5488 | new (options?: {
|
5489 | |
5490 |
|
5491 |
|
5492 |
|
5493 | color: string;
|
5494 | }): IMultiplyFilter;
|
5495 | |
5496 |
|
5497 |
|
5498 |
|
5499 | fromObject(object: any): IMultiplyFilter;
|
5500 | };
|
5501 | Noise: {
|
5502 | new (options?: {
|
5503 |
|
5504 | noise: number;
|
5505 | }): INoiseFilter;
|
5506 | |
5507 |
|
5508 |
|
5509 |
|
5510 | fromObject(object: any): INoiseFilter;
|
5511 | };
|
5512 | Pixelate: {
|
5513 | new (options?: {
|
5514 | |
5515 |
|
5516 |
|
5517 |
|
5518 | blocksize?: number | undefined;
|
5519 | }): IPixelateFilter;
|
5520 | |
5521 |
|
5522 |
|
5523 |
|
5524 | fromObject(object: any): IPixelateFilter;
|
5525 | };
|
5526 | RemoveWhite: {
|
5527 | new (options?: {
|
5528 |
|
5529 | threshold?: number | undefined;
|
5530 |
|
5531 | distance?: number | undefined;
|
5532 | }): IRemoveWhiteFilter;
|
5533 | |
5534 |
|
5535 |
|
5536 |
|
5537 | fromObject(object: any): IRemoveWhiteFilter;
|
5538 | };
|
5539 | Resize: {
|
5540 | new (options?: any): IResizeFilter;
|
5541 | |
5542 |
|
5543 |
|
5544 |
|
5545 | fromObject(object: any): IResizeFilter;
|
5546 | };
|
5547 | Saturation: {
|
5548 | |
5549 |
|
5550 |
|
5551 |
|
5552 | new (options?: { saturation?: number | undefined }): ISaturationFilter;
|
5553 | |
5554 |
|
5555 |
|
5556 |
|
5557 | fromObject(object: any): ISaturationFilter;
|
5558 | };
|
5559 | Sepia2: {
|
5560 | new (options?: any): ISepia2Filter;
|
5561 | |
5562 |
|
5563 |
|
5564 |
|
5565 | fromObject(object: any): ISepia2Filter;
|
5566 | };
|
5567 | Sepia: {
|
5568 | new (options?: any): ISepiaFilter;
|
5569 | |
5570 |
|
5571 |
|
5572 |
|
5573 | fromObject(object: any): ISepiaFilter;
|
5574 | };
|
5575 | Tint: {
|
5576 | new (options?: {
|
5577 | |
5578 |
|
5579 |
|
5580 |
|
5581 | color?: string | undefined;
|
5582 |
|
5583 | opacity?: number | undefined;
|
5584 | }): ITintFilter;
|
5585 | |
5586 |
|
5587 |
|
5588 |
|
5589 | fromObject(object: any): ITintFilter;
|
5590 | };
|
5591 | }
|
5592 | interface IBaseFilter {
|
5593 | |
5594 |
|
5595 |
|
5596 |
|
5597 | setOptions(options?: any): void;
|
5598 | |
5599 |
|
5600 |
|
5601 | toObject(): any;
|
5602 | |
5603 |
|
5604 |
|
5605 | toJSON(): string;
|
5606 | |
5607 |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 | applyTo2d(options: any): void;
|
5613 | }
|
5614 | interface IBlendColorFilter extends IBaseFilter {
|
5615 | color?: string | undefined;
|
5616 | mode?: string | undefined;
|
5617 | alpha?: number | undefined;
|
5618 | |
5619 |
|
5620 |
|
5621 |
|
5622 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5623 | }
|
5624 | interface IBlendImageFilter extends IBaseFilter {
|
5625 | |
5626 |
|
5627 |
|
5628 |
|
5629 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5630 | }
|
5631 | interface IBrightnessFilter extends IBaseFilter {
|
5632 | |
5633 |
|
5634 |
|
5635 |
|
5636 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5637 | }
|
5638 | interface IColorMatrix extends IBaseFilter {
|
5639 | matrix?: number[] | undefined;
|
5640 | |
5641 |
|
5642 |
|
5643 |
|
5644 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5645 | }
|
5646 | interface IContrastFilter extends IBaseFilter {
|
5647 | |
5648 |
|
5649 |
|
5650 |
|
5651 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5652 | }
|
5653 | interface IConvoluteFilter extends IBaseFilter {
|
5654 | |
5655 |
|
5656 |
|
5657 |
|
5658 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5659 | }
|
5660 | interface IGradientTransparencyFilter extends IBaseFilter {
|
5661 | |
5662 |
|
5663 |
|
5664 |
|
5665 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5666 | }
|
5667 | interface IGrayscaleFilter extends IBaseFilter {
|
5668 | |
5669 |
|
5670 |
|
5671 |
|
5672 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5673 | }
|
5674 | interface IInvertFilter extends IBaseFilter {
|
5675 | |
5676 |
|
5677 |
|
5678 |
|
5679 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5680 | }
|
5681 | interface IMaskFilter extends IBaseFilter {
|
5682 | |
5683 |
|
5684 |
|
5685 |
|
5686 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5687 | }
|
5688 | interface IMultiplyFilter extends IBaseFilter {
|
5689 | |
5690 |
|
5691 |
|
5692 |
|
5693 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5694 | }
|
5695 | interface INoiseFilter extends IBaseFilter {
|
5696 | |
5697 |
|
5698 |
|
5699 |
|
5700 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5701 | }
|
5702 | interface IPixelateFilter extends IBaseFilter {
|
5703 | |
5704 |
|
5705 |
|
5706 |
|
5707 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5708 | }
|
5709 | interface IRemoveWhiteFilter extends IBaseFilter {
|
5710 | |
5711 |
|
5712 |
|
5713 |
|
5714 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5715 | }
|
5716 | interface IResizeFilter extends IBaseFilter {
|
5717 | |
5718 |
|
5719 |
|
5720 | resizeType: string;
|
5721 |
|
5722 | |
5723 |
|
5724 |
|
5725 | scaleX: number;
|
5726 |
|
5727 | |
5728 |
|
5729 |
|
5730 | scaleY: number;
|
5731 |
|
5732 | |
5733 |
|
5734 |
|
5735 | lanczosLobes: number;
|
5736 | |
5737 |
|
5738 |
|
5739 |
|
5740 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5741 | }
|
5742 | interface ISaturationFilter extends IBaseFilter {
|
5743 | |
5744 |
|
5745 |
|
5746 |
|
5747 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5748 | }
|
5749 | interface ISepiaFilter extends IBaseFilter {
|
5750 | |
5751 |
|
5752 |
|
5753 |
|
5754 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5755 | }
|
5756 | interface ISepia2Filter extends IBaseFilter {
|
5757 | |
5758 |
|
5759 |
|
5760 |
|
5761 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5762 | }
|
5763 | interface ITintFilter extends IBaseFilter {
|
5764 | |
5765 |
|
5766 |
|
5767 |
|
5768 | applyTo(canvasEl: HTMLCanvasElement): void;
|
5769 | }
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 | export class BaseBrush {
|
5775 | |
5776 |
|
5777 |
|
5778 | color: string;
|
5779 |
|
5780 | |
5781 |
|
5782 |
|
5783 | width: number;
|
5784 |
|
5785 | |
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 | shadow: Shadow | string;
|
5791 | |
5792 |
|
5793 |
|
5794 | strokeLineCap: string;
|
5795 |
|
5796 | |
5797 |
|
5798 |
|
5799 | strokeLineJoin: string;
|
5800 |
|
5801 | |
5802 |
|
5803 |
|
5804 | strokeDashArray: any[];
|
5805 | }
|
5806 |
|
5807 | export class CircleBrush extends BaseBrush {
|
5808 | |
5809 |
|
5810 |
|
5811 | width: number;
|
5812 | |
5813 |
|
5814 |
|
5815 | drawDot(pointer: any): void;
|
5816 |
|
5817 | |
5818 |
|
5819 |
|
5820 | addPoint(pointer: any): Point;
|
5821 | }
|
5822 |
|
5823 | export class SprayBrush extends BaseBrush {
|
5824 | |
5825 |
|
5826 |
|
5827 | width: number;
|
5828 | |
5829 |
|
5830 |
|
5831 | density: number;
|
5832 |
|
5833 | |
5834 |
|
5835 |
|
5836 | dotWidth: number;
|
5837 | |
5838 |
|
5839 |
|
5840 | dotWidthVariance: number;
|
5841 |
|
5842 | |
5843 |
|
5844 |
|
5845 | randomOpacity: boolean;
|
5846 | |
5847 |
|
5848 |
|
5849 | optimizeOverlapping: boolean;
|
5850 |
|
5851 | addSprayChunk(pointer: any): void;
|
5852 | }
|
5853 | export class PatternBrush extends PencilBrush {
|
5854 | getPatternSrc(): HTMLCanvasElement;
|
5855 |
|
5856 | getPatternSrcFunction(): string;
|
5857 |
|
5858 | |
5859 |
|
5860 |
|
5861 | getPattern(): any;
|
5862 | |
5863 |
|
5864 |
|
5865 | createPath(pathData: string): Path;
|
5866 | }
|
5867 | export class PencilBrush extends BaseBrush {
|
5868 | |
5869 |
|
5870 |
|
5871 |
|
5872 | constructor(canvas: Canvas);
|
5873 | |
5874 |
|
5875 |
|
5876 |
|
5877 |
|
5878 | initialize(canvas: Canvas): PencilBrush;
|
5879 |
|
5880 | |
5881 |
|
5882 |
|
5883 |
|
5884 | convertPointsToSVGPath(points: Array<{ x: number; y: number }>, minX?: number, minY?: number): string[];
|
5885 |
|
5886 | |
5887 |
|
5888 |
|
5889 |
|
5890 | createPath(pathData: string): Path;
|
5891 | }
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 | interface IUtilAnimationOptions {
|
5897 | |
5898 |
|
5899 |
|
5900 | startValue?: number | undefined;
|
5901 | |
5902 |
|
5903 |
|
5904 | endValue?: number | undefined;
|
5905 | |
5906 |
|
5907 |
|
5908 | byValue?: number | undefined;
|
5909 | |
5910 |
|
5911 |
|
5912 | duration?: number | undefined;
|
5913 | |
5914 |
|
5915 |
|
5916 | onChange?: ((value: number) => void) | undefined;
|
5917 | |
5918 |
|
5919 |
|
5920 | onComplete?: Function | undefined;
|
5921 | |
5922 |
|
5923 |
|
5924 | easing?: Function | undefined;
|
5925 | }
|
5926 | interface IUtilAnimation {
|
5927 | |
5928 |
|
5929 |
|
5930 |
|
5931 | animate(options?: IUtilAnimationOptions): void;
|
5932 | |
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 | requestAnimFrame(callback: Function): void;
|
5938 | }
|
5939 |
|
5940 | type IUtilAminEaseFunction = (t: number, b: number, c: number, d: number) => number;
|
5941 |
|
5942 | interface IUtilAnimEase {
|
5943 | easeInBack: IUtilAminEaseFunction;
|
5944 | easeInBounce: IUtilAminEaseFunction;
|
5945 | easeInCirc: IUtilAminEaseFunction;
|
5946 | easeInCubic: IUtilAminEaseFunction;
|
5947 | easeInElastic: IUtilAminEaseFunction;
|
5948 | easeInExpo: IUtilAminEaseFunction;
|
5949 | easeInOutBack: IUtilAminEaseFunction;
|
5950 | easeInOutBounce: IUtilAminEaseFunction;
|
5951 | easeInOutCirc: IUtilAminEaseFunction;
|
5952 | easeInOutCubic: IUtilAminEaseFunction;
|
5953 | easeInOutElastic: IUtilAminEaseFunction;
|
5954 | easeInOutExpo: IUtilAminEaseFunction;
|
5955 | easeInOutQuad: IUtilAminEaseFunction;
|
5956 | easeInOutQuart: IUtilAminEaseFunction;
|
5957 | easeInOutQuint: IUtilAminEaseFunction;
|
5958 | easeInOutSine: IUtilAminEaseFunction;
|
5959 | easeInQuad: IUtilAminEaseFunction;
|
5960 | easeInQuart: IUtilAminEaseFunction;
|
5961 | easeInQuint: IUtilAminEaseFunction;
|
5962 | easeInSine: IUtilAminEaseFunction;
|
5963 | easeOutBack: IUtilAminEaseFunction;
|
5964 | easeOutBounce: IUtilAminEaseFunction;
|
5965 | easeOutCirc: IUtilAminEaseFunction;
|
5966 | easeOutCubic: IUtilAminEaseFunction;
|
5967 | easeOutElastic: IUtilAminEaseFunction;
|
5968 | easeOutExpo: IUtilAminEaseFunction;
|
5969 | easeOutQuad: IUtilAminEaseFunction;
|
5970 | easeOutQuart: IUtilAminEaseFunction;
|
5971 | easeOutQuint: IUtilAminEaseFunction;
|
5972 | easeOutSine: IUtilAminEaseFunction;
|
5973 | }
|
5974 |
|
5975 | interface IUtilImage {
|
5976 | setImageSmoothing(ctx: CanvasRenderingContext2D, value: any): void;
|
5977 | }
|
5978 |
|
5979 | interface IUtilArc {
|
5980 | |
5981 |
|
5982 |
|
5983 | drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void;
|
5984 | |
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 | getBoundsOfArc(
|
5995 | fx: number,
|
5996 | fy: number,
|
5997 | rx: number,
|
5998 | ry: number,
|
5999 | rot: number,
|
6000 | large: number,
|
6001 | sweep: number,
|
6002 | tx: number,
|
6003 | ty: number,
|
6004 | ): Point[];
|
6005 | |
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 | getBoundsOfCurve(
|
6013 | x0: number,
|
6014 | y0: number,
|
6015 | x1: number,
|
6016 | y1: number,
|
6017 | x2: number,
|
6018 | y2: number,
|
6019 | x3: number,
|
6020 | y3: number,
|
6021 | ): Point[];
|
6022 | }
|
6023 |
|
6024 | interface IUtilDomEvent {
|
6025 | |
6026 |
|
6027 |
|
6028 |
|
6029 |
|
6030 | getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): Point;
|
6031 |
|
6032 | |
6033 |
|
6034 |
|
6035 | addListener(element: HTMLElement, eventName: string, handler: Function): void;
|
6036 |
|
6037 | |
6038 |
|
6039 |
|
6040 | removeListener(element: HTMLElement, eventName: string, handler: Function): void;
|
6041 | }
|
6042 |
|
6043 | interface IUtilDomMisc {
|
6044 | |
6045 |
|
6046 |
|
6047 | getById(id: string | HTMLElement): HTMLElement;
|
6048 | |
6049 |
|
6050 |
|
6051 | toArray(arrayLike: any): any[];
|
6052 | |
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 | makeElement(tagName: string, attributes?: any): HTMLElement;
|
6059 | |
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 | addClass(element: HTMLElement, classname: string): void;
|
6065 | |
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 | wrapElement(element: HTMLElement, wrapper: HTMLElement | string, attributes?: any): HTMLElement;
|
6072 | |
6073 |
|
6074 |
|
6075 |
|
6076 | getScrollLeftTop(element: HTMLElement): { left: number; top: number };
|
6077 | |
6078 |
|
6079 |
|
6080 |
|
6081 | getElementOffset(element: HTMLElement): { left: number; top: number };
|
6082 | |
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 | getElementStyle(elment: HTMLElement, attr: string): string;
|
6088 | |
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 | getScript(url: string, callback: Function): void;
|
6094 | |
6095 |
|
6096 |
|
6097 |
|
6098 | makeElementUnselectable(element: HTMLElement): HTMLElement;
|
6099 | |
6100 |
|
6101 |
|
6102 |
|
6103 | makeElementSelectable(element: HTMLElement): HTMLElement;
|
6104 | }
|
6105 |
|
6106 | interface IUtilDomRequest {
|
6107 | |
6108 |
|
6109 |
|
6110 |
|
6111 | request(
|
6112 | url: string,
|
6113 | options?: {
|
6114 |
|
6115 | method?: string | undefined;
|
6116 |
|
6117 | onComplete: Function;
|
6118 | },
|
6119 | ): XMLHttpRequest;
|
6120 | }
|
6121 |
|
6122 | interface IUtilDomStyle {
|
6123 | |
6124 |
|
6125 |
|
6126 | setStyle(element: HTMLElement, styles: any): HTMLElement;
|
6127 | }
|
6128 |
|
6129 | interface IUtilArray {
|
6130 | |
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 | invoke(array: any[], method: string): any[];
|
6136 | |
6137 |
|
6138 |
|
6139 |
|
6140 | min(array: any[], byProperty: string): any;
|
6141 | |
6142 |
|
6143 |
|
6144 |
|
6145 | max(array: any[], byProperty: string): any;
|
6146 | }
|
6147 |
|
6148 | interface IUtilClass {
|
6149 | |
6150 |
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 | createClass(parent: Function, properties?: any): any;
|
6156 | |
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 | createClass(properties?: any): any;
|
6162 | }
|
6163 |
|
6164 | interface IUtilObject {
|
6165 | |
6166 |
|
6167 |
|
6168 |
|
6169 |
|
6170 | extend(destination: any, source: any): any;
|
6171 |
|
6172 | |
6173 |
|
6174 |
|
6175 |
|
6176 | clone(object: any): any;
|
6177 | }
|
6178 |
|
6179 | interface IUtilString {
|
6180 | |
6181 |
|
6182 |
|
6183 |
|
6184 | camelize(string: string): string;
|
6185 |
|
6186 | |
6187 |
|
6188 |
|
6189 |
|
6190 |
|
6191 |
|
6192 |
|
6193 | capitalize(string: string, firstLetterOnly: boolean): string;
|
6194 |
|
6195 | |
6196 |
|
6197 |
|
6198 |
|
6199 | escapeXml(string: string): string;
|
6200 |
|
6201 | |
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 | graphemeSplit(string: string): string[];
|
6207 | }
|
6208 |
|
6209 | interface IUtilMisc {
|
6210 | |
6211 |
|
6212 |
|
6213 |
|
6214 | removeFromArray(array: any[], value: any): any[];
|
6215 |
|
6216 | |
6217 |
|
6218 |
|
6219 |
|
6220 |
|
6221 | getRandomInt(min: number, max: number): number;
|
6222 |
|
6223 | |
6224 |
|
6225 |
|
6226 |
|
6227 | degreesToRadians(degrees: number): number;
|
6228 |
|
6229 | |
6230 |
|
6231 |
|
6232 |
|
6233 | radiansToDegrees(radians: number): number;
|
6234 |
|
6235 | |
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 | rotatePoint(point: Point, origin: Point, radians: number): Point;
|
6242 |
|
6243 | |
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 | rotateVector(vector: { x: number; y: number }, radians: number): { x: number; y: number };
|
6249 |
|
6250 | |
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 | transformPoint(p: Point, t: any[], ignoreOffset?: boolean): Point;
|
6257 |
|
6258 | |
6259 |
|
6260 |
|
6261 |
|
6262 | invertTransform(t: any[]): any[];
|
6263 |
|
6264 | |
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 | toFixed(number: number, fractionDigits: number): number;
|
6270 |
|
6271 | |
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 | parseUnit(value: number | string, fontSize?: number): number | string;
|
6277 |
|
6278 | |
6279 |
|
6280 |
|
6281 | falseFunction(): boolean;
|
6282 |
|
6283 | |
6284 |
|
6285 |
|
6286 |
|
6287 |
|
6288 | getKlass(type: string, namespace: string): any;
|
6289 |
|
6290 | |
6291 |
|
6292 |
|
6293 |
|
6294 | resolveNamespace(namespace: string): any;
|
6295 |
|
6296 | |
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 | loadImage(url: string, callback: (image: HTMLImageElement) => void, context?: any, crossOrigin?: string): void;
|
6304 |
|
6305 | |
6306 |
|
6307 |
|
6308 |
|
6309 |
|
6310 |
|
6311 |
|
6312 | enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void;
|
6313 |
|
6314 | |
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 | groupSVGElements(elements: any[], options?: any, path?: string): Object | Group;
|
6320 |
|
6321 | |
6322 |
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 | clearFabricFontCache(fontFamily?: string): void;
|
6334 |
|
6335 | |
6336 |
|
6337 |
|
6338 |
|
6339 |
|
6340 |
|
6341 | populateWithProperties(source: any, destination: any, properties: any): void;
|
6342 |
|
6343 | |
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 |
|
6353 | drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void;
|
6354 |
|
6355 | |
6356 |
|
6357 |
|
6358 |
|
6359 |
|
6360 | createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement;
|
6361 |
|
6362 | |
6363 |
|
6364 |
|
6365 | createImage(): HTMLImageElement;
|
6366 |
|
6367 | |
6368 |
|
6369 |
|
6370 |
|
6371 | createAccessors(klass: any): any;
|
6372 |
|
6373 | |
6374 |
|
6375 |
|
6376 |
|
6377 | clipContext(receiver: Object, ctx: CanvasRenderingContext2D): void;
|
6378 |
|
6379 | |
6380 |
|
6381 |
|
6382 |
|
6383 |
|
6384 | multiplyTransformMatrices(a: number[], b: number[]): number[];
|
6385 |
|
6386 | |
6387 |
|
6388 |
|
6389 |
|
6390 | qrDecompose(
|
6391 | a: number[],
|
6392 | ): {
|
6393 | angle: number;
|
6394 | scaleX: number;
|
6395 | scaleY: number;
|
6396 | skewX: number;
|
6397 | skewY: number;
|
6398 | translateX: number;
|
6399 | translateY: number;
|
6400 | };
|
6401 |
|
6402 | |
6403 |
|
6404 |
|
6405 |
|
6406 |
|
6407 | saveObjectTransform(
|
6408 | target: Object,
|
6409 | ): {
|
6410 | scaleX: number;
|
6411 | scaleY: number;
|
6412 | skewX: number;
|
6413 | skewY: number;
|
6414 | angle: number;
|
6415 | left: number;
|
6416 | flipX: boolean;
|
6417 | flipY: boolean;
|
6418 | top: number;
|
6419 | };
|
6420 |
|
6421 | |
6422 |
|
6423 |
|
6424 |
|
6425 |
|
6426 |
|
6427 |
|
6428 |
|
6429 |
|
6430 |
|
6431 |
|
6432 |
|
6433 |
|
6434 |
|
6435 |
|
6436 |
|
6437 |
|
6438 |
|
6439 | composeMatrix(options: {
|
6440 | angle: number;
|
6441 | scaleX: number;
|
6442 | scaleY: number;
|
6443 | flipX: boolean;
|
6444 | flipY: boolean;
|
6445 | skewX: number;
|
6446 | skewY: number;
|
6447 | translateX: number;
|
6448 | translateY: number;
|
6449 | }): number[];
|
6450 |
|
6451 | |
6452 |
|
6453 |
|
6454 |
|
6455 | getFunctionBody(fn: Function): string;
|
6456 |
|
6457 | |
6458 |
|
6459 |
|
6460 |
|
6461 |
|
6462 |
|
6463 |
|
6464 |
|
6465 | isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean;
|
6466 |
|
6467 | |
6468 |
|
6469 |
|
6470 |
|
6471 |
|
6472 |
|
6473 | resetObjectTransform(target: Object): void;
|
6474 | }
|
6475 |
|
6476 | export const util: IUtil;
|
6477 | interface IUtil
|
6478 | extends IUtilImage,
|
6479 | IUtilAnimation,
|
6480 | IUtilArc,
|
6481 | IObservable<IUtil>,
|
6482 | IUtilDomEvent,
|
6483 | IUtilDomMisc,
|
6484 | IUtilDomRequest,
|
6485 | IUtilDomStyle,
|
6486 | IUtilClass,
|
6487 | IUtilMisc {
|
6488 | ease: IUtilAnimEase;
|
6489 | array: IUtilArray;
|
6490 | object: IUtilObject;
|
6491 | string: IUtilString;
|
6492 | }
|
6493 |
|
6494 | export interface Resources {
|
6495 | [key: string]: HTMLCanvasElement;
|
6496 | }
|
6497 | export interface FilterBackend {
|
6498 | resources: Resources;
|
6499 |
|
6500 | applyFilters(
|
6501 | filters: IBaseFilter[],
|
6502 | sourceElement: HTMLImageElement | HTMLCanvasElement,
|
6503 | sourceWidth: number,
|
6504 | sourceHeight: number,
|
6505 | targetCanvas: HTMLCanvasElement,
|
6506 | cacheKey?: string,
|
6507 | ): any;
|
6508 |
|
6509 | evictCachesForKey(cacheKey: string): void;
|
6510 |
|
6511 | dispose(): void;
|
6512 |
|
6513 | clearWebGLCaches(): void;
|
6514 | }
|
6515 | export let filterBackend: FilterBackend | undefined;
|
6516 | export interface Canvas2dFilterBackend extends FilterBackend {}
|
6517 | export class Canvas2dFilterBackend {
|
6518 | constructor();
|
6519 | }
|
6520 |
|
6521 | export interface GPUInfo {
|
6522 | renderer: string;
|
6523 | vendor: string;
|
6524 | }
|
6525 |
|
6526 | export interface WebglFilterBackendOptions {
|
6527 | tileSize: number;
|
6528 | }
|
6529 | export interface WebglFilterBackend extends FilterBackend, WebglFilterBackendOptions {
|
6530 | setupGLContext(width: number, height: number): void;
|
6531 |
|
6532 | chooseFastestCopyGLTo2DMethod(width: number, height: number): void;
|
6533 |
|
6534 | createWebGLCanvas(width: number, height: number): void;
|
6535 |
|
6536 | applyFiltersDebug(
|
6537 | filters: IBaseFilter[],
|
6538 | sourceElement: HTMLImageElement | HTMLCanvasElement,
|
6539 | sourceWidth: number,
|
6540 | sourceHeight: number,
|
6541 | targetCanvas: HTMLCanvasElement,
|
6542 | cacheKey?: string,
|
6543 | ): any;
|
6544 |
|
6545 | glErrorToString(context: any, errorCode: any): string;
|
6546 |
|
6547 | createTexture(
|
6548 | gl: WebGLRenderingContext,
|
6549 | width: number,
|
6550 | height: number,
|
6551 | textureImageSource?: HTMLImageElement | HTMLCanvasElement,
|
6552 | ): WebGLTexture;
|
6553 |
|
6554 | getCachedTexture(uniqueId: string, textureImageSource: HTMLImageElement | HTMLCanvasElement): WebGLTexture;
|
6555 |
|
6556 | copyGLTo2D(gl: WebGLRenderingContext, pipelineState: any): void;
|
6557 |
|
6558 | captureGPUInfo(): GPUInfo;
|
6559 | }
|
6560 |
|
6561 | export class WebglFilterBackend {
|
6562 | constructor(options?: WebglFilterBackendOptions);
|
6563 | }
|
6564 |
|
6565 | export class Control {
|
6566 | constructor(options?: Partial<Control>);
|
6567 |
|
6568 | |
6569 |
|
6570 |
|
6571 |
|
6572 |
|
6573 |
|
6574 |
|
6575 |
|
6576 | visible: boolean;
|
6577 |
|
6578 | |
6579 |
|
6580 |
|
6581 |
|
6582 |
|
6583 |
|
6584 |
|
6585 |
|
6586 |
|
6587 |
|
6588 | actionName: string;
|
6589 |
|
6590 | |
6591 |
|
6592 |
|
6593 |
|
6594 |
|
6595 |
|
6596 | angle: number;
|
6597 |
|
6598 | |
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 | x: number;
|
6605 |
|
6606 | |
6607 |
|
6608 |
|
6609 |
|
6610 |
|
6611 |
|
6612 | y: number;
|
6613 |
|
6614 | |
6615 |
|
6616 |
|
6617 |
|
6618 |
|
6619 |
|
6620 |
|
6621 |
|
6622 |
|
6623 |
|
6624 |
|
6625 | offsetX: number;
|
6626 |
|
6627 | |
6628 |
|
6629 |
|
6630 |
|
6631 |
|
6632 | offsetY: number;
|
6633 |
|
6634 | |
6635 |
|
6636 |
|
6637 |
|
6638 |
|
6639 | sizeX?: number | undefined;
|
6640 |
|
6641 | |
6642 |
|
6643 |
|
6644 |
|
6645 | sizeY?: number | undefined;
|
6646 |
|
6647 | |
6648 |
|
6649 |
|
6650 |
|
6651 |
|
6652 |
|
6653 | touchSizeX?: number | undefined;
|
6654 |
|
6655 | |
6656 |
|
6657 |
|
6658 |
|
6659 |
|
6660 |
|
6661 | touchSizeY?: number | undefined;
|
6662 |
|
6663 | |
6664 |
|
6665 |
|
6666 |
|
6667 |
|
6668 | cursorStyle: string;
|
6669 |
|
6670 | |
6671 |
|
6672 |
|
6673 |
|
6674 |
|
6675 | withConnection: boolean;
|
6676 |
|
6677 | |
6678 |
|
6679 |
|
6680 |
|
6681 | actionHandler(eventData: MouseEvent, transformData: Transform, x: number, y: number): boolean;
|
6682 |
|
6683 | |
6684 |
|
6685 |
|
6686 | mouseDownHandler(eventData: MouseEvent, transformData: Transform, x: number, y: number): boolean;
|
6687 |
|
6688 | |
6689 |
|
6690 |
|
6691 | mouseUpHandler(eventData: MouseEvent, transformData: Transform, x: number, y: number): boolean;
|
6692 |
|
6693 | |
6694 |
|
6695 |
|
6696 | getActionHandler(eventData: MouseEvent, fabricObject: Object, control: Control): ControlMouseEventHandler;
|
6697 |
|
6698 | |
6699 |
|
6700 |
|
6701 | getMouseDownHandler(eventData: MouseEvent, fabricObject: Object, control: Control): ControlMouseEventHandler;
|
6702 |
|
6703 | |
6704 |
|
6705 |
|
6706 | getMouseUpHandler(eventData: MouseEvent, fabricObject: Object, control: Control): ControlMouseEventHandler;
|
6707 |
|
6708 | |
6709 |
|
6710 |
|
6711 |
|
6712 |
|
6713 | cursorStyleHandler(eventData: MouseEvent, control: Control, fabricObject: Object): string;
|
6714 |
|
6715 | |
6716 |
|
6717 |
|
6718 | getActionName(eventData: MouseEvent, control: Control, fabricObject: Object): string;
|
6719 |
|
6720 | |
6721 |
|
6722 |
|
6723 | getVisibility(fabricObject: Object, controlKey: string): boolean;
|
6724 |
|
6725 | |
6726 |
|
6727 |
|
6728 | setVisibility(visibility: boolean): void;
|
6729 |
|
6730 | positionHandler(dim: { x: number, y: number }, finalMatrix: any, fabricObject: Object, currentControl: Control): Point;
|
6731 |
|
6732 | |
6733 |
|
6734 |
|
6735 | calcCornerCoords(objectAngle: number, objectCornerSize: number, centerX: number, centerY: number, isTouch: boolean): void;
|
6736 |
|
6737 | |
6738 |
|
6739 |
|
6740 |
|
6741 |
|
6742 |
|
6743 |
|
6744 | render(ctx: CanvasRenderingContext2D, left: number, top: number, styleOverride: any, fabricObject: Object): void;
|
6745 | }
|
6746 |
|
6747 | type ControlMouseEventHandler = (eventData: MouseEvent, transformData: Transform, x: number, y: number) => boolean;
|
6748 |
|
6749 | export interface Transform {
|
6750 | target: Object;
|
6751 | action: string;
|
6752 | actionHandler: ControlMouseEventHandler;
|
6753 | altKey: boolean;
|
6754 | corner: string;
|
6755 | ex: number;
|
6756 | ey: number;
|
6757 | lastX: number;
|
6758 | lastY: number;
|
6759 | offsetX: number;
|
6760 | offsetY: number;
|
6761 | originX: "left" | "right";
|
6762 | originY: "top" | "bottom";
|
6763 | original: any;
|
6764 | scaleX: number;
|
6765 | scaleY: number;
|
6766 | shiftKey: boolean;
|
6767 | skewX: number;
|
6768 | skewY: number;
|
6769 | theta: number;
|
6770 | width: number;
|
6771 | }
|
6772 |
|
\ | No newline at end of file |