@nasser-sw/fabric 7.0.1-beta3 → 7.0.1-beta5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/0 +0 -0
  2. package/dist/index.js +345 -162
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist/index.min.mjs +1 -1
  7. package/dist/index.min.mjs.map +1 -1
  8. package/dist/index.mjs +345 -162
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/index.node.cjs +345 -162
  11. package/dist/index.node.cjs.map +1 -1
  12. package/dist/index.node.mjs +345 -162
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/package.json.min.mjs +1 -1
  15. package/dist/package.json.mjs +1 -1
  16. package/dist/src/shapes/Line.d.ts +32 -86
  17. package/dist/src/shapes/Line.d.ts.map +1 -1
  18. package/dist/src/shapes/Line.min.mjs +1 -1
  19. package/dist/src/shapes/Line.min.mjs.map +1 -1
  20. package/dist/src/shapes/Line.mjs +345 -161
  21. package/dist/src/shapes/Line.mjs.map +1 -1
  22. package/dist-extensions/src/shapes/CustomLine.d.ts +10 -0
  23. package/dist-extensions/src/shapes/CustomLine.d.ts.map +1 -0
  24. package/dist-extensions/src/shapes/Line.d.ts +32 -86
  25. package/dist-extensions/src/shapes/Line.d.ts.map +1 -1
  26. package/fabric-test-editor.html +157 -8
  27. package/fabric-test2.html +513 -0
  28. package/fabric.ts +182 -182
  29. package/package.json +1 -1
  30. package/src/shapes/Line.ts +397 -164
  31. package/debug/konva/CHANGELOG.md +0 -1474
  32. package/debug/konva/LICENSE +0 -22
  33. package/debug/konva/README.md +0 -205
  34. package/debug/konva/gulpfile.mjs +0 -110
  35. package/debug/konva/package.json +0 -139
  36. package/debug/konva/release.sh +0 -65
  37. package/debug/konva/resources/doc-includes/ContainerParams.txt +0 -6
  38. package/debug/konva/resources/doc-includes/NodeParams.txt +0 -20
  39. package/debug/konva/resources/doc-includes/ShapeParams.txt +0 -53
  40. package/debug/konva/resources/jsdoc.conf.json +0 -28
  41. package/debug/konva/rollup.config.mjs +0 -32
  42. package/debug/konva/src/Animation.ts +0 -237
  43. package/debug/konva/src/BezierFunctions.ts +0 -826
  44. package/debug/konva/src/Canvas.ts +0 -193
  45. package/debug/konva/src/Container.ts +0 -649
  46. package/debug/konva/src/Context.ts +0 -1017
  47. package/debug/konva/src/Core.ts +0 -5
  48. package/debug/konva/src/DragAndDrop.ts +0 -173
  49. package/debug/konva/src/Factory.ts +0 -246
  50. package/debug/konva/src/FastLayer.ts +0 -29
  51. package/debug/konva/src/Global.ts +0 -210
  52. package/debug/konva/src/Group.ts +0 -31
  53. package/debug/konva/src/Layer.ts +0 -546
  54. package/debug/konva/src/Node.ts +0 -3477
  55. package/debug/konva/src/PointerEvents.ts +0 -67
  56. package/debug/konva/src/Shape.ts +0 -2081
  57. package/debug/konva/src/Stage.ts +0 -1000
  58. package/debug/konva/src/Tween.ts +0 -811
  59. package/debug/konva/src/Util.ts +0 -1123
  60. package/debug/konva/src/Validators.ts +0 -210
  61. package/debug/konva/src/_CoreInternals.ts +0 -85
  62. package/debug/konva/src/_FullInternals.ts +0 -171
  63. package/debug/konva/src/canvas-backend.ts +0 -36
  64. package/debug/konva/src/filters/Blur.ts +0 -388
  65. package/debug/konva/src/filters/Brighten.ts +0 -48
  66. package/debug/konva/src/filters/Brightness.ts +0 -30
  67. package/debug/konva/src/filters/Contrast.ts +0 -75
  68. package/debug/konva/src/filters/Emboss.ts +0 -207
  69. package/debug/konva/src/filters/Enhance.ts +0 -154
  70. package/debug/konva/src/filters/Grayscale.ts +0 -25
  71. package/debug/konva/src/filters/HSL.ts +0 -108
  72. package/debug/konva/src/filters/HSV.ts +0 -106
  73. package/debug/konva/src/filters/Invert.ts +0 -23
  74. package/debug/konva/src/filters/Kaleidoscope.ts +0 -274
  75. package/debug/konva/src/filters/Mask.ts +0 -220
  76. package/debug/konva/src/filters/Noise.ts +0 -44
  77. package/debug/konva/src/filters/Pixelate.ts +0 -107
  78. package/debug/konva/src/filters/Posterize.ts +0 -46
  79. package/debug/konva/src/filters/RGB.ts +0 -82
  80. package/debug/konva/src/filters/RGBA.ts +0 -103
  81. package/debug/konva/src/filters/Sepia.ts +0 -27
  82. package/debug/konva/src/filters/Solarize.ts +0 -29
  83. package/debug/konva/src/filters/Threshold.ts +0 -44
  84. package/debug/konva/src/index.ts +0 -3
  85. package/debug/konva/src/shapes/Arc.ts +0 -176
  86. package/debug/konva/src/shapes/Arrow.ts +0 -231
  87. package/debug/konva/src/shapes/Circle.ts +0 -76
  88. package/debug/konva/src/shapes/Ellipse.ts +0 -121
  89. package/debug/konva/src/shapes/Image.ts +0 -319
  90. package/debug/konva/src/shapes/Label.ts +0 -386
  91. package/debug/konva/src/shapes/Line.ts +0 -364
  92. package/debug/konva/src/shapes/Path.ts +0 -1013
  93. package/debug/konva/src/shapes/Rect.ts +0 -79
  94. package/debug/konva/src/shapes/RegularPolygon.ts +0 -167
  95. package/debug/konva/src/shapes/Ring.ts +0 -94
  96. package/debug/konva/src/shapes/Sprite.ts +0 -370
  97. package/debug/konva/src/shapes/Star.ts +0 -125
  98. package/debug/konva/src/shapes/Text.ts +0 -1065
  99. package/debug/konva/src/shapes/TextPath.ts +0 -583
  100. package/debug/konva/src/shapes/Transformer.ts +0 -1889
  101. package/debug/konva/src/shapes/Wedge.ts +0 -129
  102. package/debug/konva/src/skia-backend.ts +0 -35
  103. package/debug/konva/src/types.ts +0 -84
  104. package/debug/konva/tsconfig.json +0 -31
  105. package/debug/konva/tsconfig.test.json +0 -7
@@ -1,193 +0,0 @@
1
- import { Util } from './Util.ts';
2
- import type { Context } from './Context.ts';
3
- import { SceneContext, HitContext } from './Context.ts';
4
- import { Konva } from './Global.ts';
5
-
6
- // calculate pixel ratio
7
- let _pixelRatio;
8
- function getDevicePixelRatio() {
9
- if (_pixelRatio) {
10
- return _pixelRatio;
11
- }
12
- const canvas = Util.createCanvasElement();
13
- const context = canvas.getContext('2d') as any;
14
- _pixelRatio = (function () {
15
- const devicePixelRatio = Konva._global.devicePixelRatio || 1,
16
- backingStoreRatio =
17
- context.webkitBackingStorePixelRatio ||
18
- context.mozBackingStorePixelRatio ||
19
- context.msBackingStorePixelRatio ||
20
- context.oBackingStorePixelRatio ||
21
- context.backingStorePixelRatio ||
22
- 1;
23
- return devicePixelRatio / backingStoreRatio;
24
- })();
25
- Util.releaseCanvas(canvas);
26
- return _pixelRatio;
27
- }
28
-
29
- interface ICanvasConfig {
30
- width?: number;
31
- height?: number;
32
- pixelRatio?: number;
33
- willReadFrequently?: boolean;
34
- }
35
-
36
- /**
37
- * Canvas Renderer constructor. It is a wrapper around native canvas element.
38
- * Usually you don't need to use it manually.
39
- * @constructor
40
- * @abstract
41
- * @memberof Konva
42
- * @param {Object} config
43
- * @param {Number} config.width
44
- * @param {Number} config.height
45
- * @param {Number} config.pixelRatio
46
- */
47
- export class Canvas {
48
- pixelRatio = 1;
49
- _canvas: HTMLCanvasElement;
50
- context: Context;
51
- width = 0;
52
- height = 0;
53
-
54
- isCache = false;
55
-
56
- constructor(config: ICanvasConfig) {
57
- const conf = config || {};
58
-
59
- const pixelRatio =
60
- conf.pixelRatio || Konva.pixelRatio || getDevicePixelRatio();
61
-
62
- this.pixelRatio = pixelRatio;
63
-
64
- this._canvas = Util.createCanvasElement();
65
- // set inline styles
66
- this._canvas.style.padding = '0';
67
- this._canvas.style.margin = '0';
68
- this._canvas.style.border = '0';
69
- this._canvas.style.background = 'transparent';
70
- this._canvas.style.position = 'absolute';
71
- this._canvas.style.top = '0';
72
- this._canvas.style.left = '0';
73
- }
74
-
75
- /**
76
- * get canvas context
77
- * @method
78
- * @name Konva.Canvas#getContext
79
- * @returns {CanvasContext} context
80
- */
81
- getContext() {
82
- return this.context;
83
- }
84
- /**
85
- * get pixel ratio
86
- * @method
87
- * @name Konva.Canvas#getPixelRatio
88
- * @returns {Number} pixel ratio
89
- * @example
90
- * var pixelRatio = layer.getCanvas.getPixelRatio();
91
- */
92
- getPixelRatio() {
93
- return this.pixelRatio;
94
- }
95
- /**
96
- * set pixel ratio
97
- * KonvaJS automatically handles pixel ratio adustments in order to render crisp drawings
98
- * on all devices. Most desktops, low end tablets, and low end phones, have device pixel ratios
99
- * of 1. Some high end tablets and phones, like iPhones and iPads have a device pixel ratio
100
- * of 2. Some Macbook Pros, and iMacs also have a device pixel ratio of 2. Some high end Android devices have pixel
101
- * ratios of 2 or 3. Some browsers like Firefox allow you to configure the pixel ratio of the viewport. Unless otherwise
102
- * specificed, the pixel ratio will be defaulted to the actual device pixel ratio. You can override the device pixel
103
- * ratio for special situations, or, if you don't want the pixel ratio to be taken into account, you can set it to 1.
104
- * @method
105
- * @name Konva.Canvas#setPixelRatio
106
- * @param {Number} pixelRatio
107
- * @example
108
- * layer.getCanvas().setPixelRatio(3);
109
- */
110
- setPixelRatio(pixelRatio) {
111
- const previousRatio = this.pixelRatio;
112
- this.pixelRatio = pixelRatio;
113
- this.setSize(
114
- this.getWidth() / previousRatio,
115
- this.getHeight() / previousRatio
116
- );
117
- }
118
- setWidth(width) {
119
- // take into account pixel ratio
120
- this.width = this._canvas.width = width * this.pixelRatio;
121
- this._canvas.style.width = width + 'px';
122
-
123
- const pixelRatio = this.pixelRatio,
124
- _context = this.getContext()._context;
125
- _context.scale(pixelRatio, pixelRatio);
126
- }
127
- setHeight(height) {
128
- // take into account pixel ratio
129
- this.height = this._canvas.height = height * this.pixelRatio;
130
- this._canvas.style.height = height + 'px';
131
- const pixelRatio = this.pixelRatio,
132
- _context = this.getContext()._context;
133
- _context.scale(pixelRatio, pixelRatio);
134
- }
135
- getWidth() {
136
- return this.width;
137
- }
138
- getHeight() {
139
- return this.height;
140
- }
141
- setSize(width, height) {
142
- this.setWidth(width || 0);
143
- this.setHeight(height || 0);
144
- }
145
- /**
146
- * to data url
147
- * @method
148
- * @name Konva.Canvas#toDataURL
149
- * @param {String} mimeType
150
- * @param {Number} quality between 0 and 1 for jpg mime types
151
- * @returns {String} data url string
152
- */
153
- toDataURL(mimeType, quality) {
154
- try {
155
- // If this call fails (due to browser bug, like in Firefox 3.6),
156
- // then revert to previous no-parameter image/png behavior
157
- return this._canvas.toDataURL(mimeType, quality);
158
- } catch (e) {
159
- try {
160
- return this._canvas.toDataURL();
161
- } catch (err: any) {
162
- Util.error(
163
- 'Unable to get data URL. ' +
164
- err.message +
165
- ' For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.'
166
- );
167
- return '';
168
- }
169
- }
170
- }
171
- }
172
-
173
- export class SceneCanvas extends Canvas {
174
- constructor(
175
- config: ICanvasConfig = { width: 0, height: 0, willReadFrequently: false }
176
- ) {
177
- super(config);
178
- this.context = new SceneContext(this, {
179
- willReadFrequently: config.willReadFrequently,
180
- });
181
- this.setSize(config.width, config.height);
182
- }
183
- }
184
-
185
- export class HitCanvas extends Canvas {
186
- hitCanvas = true;
187
- constructor(config: ICanvasConfig = { width: 0, height: 0 }) {
188
- super(config);
189
-
190
- this.context = new HitContext(this);
191
- this.setSize(config.width, config.height);
192
- }
193
- }