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