js-draw 0.3.2 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/.github/pull_request_template.md +15 -0
  2. package/.github/workflows/firebase-hosting-merge.yml +7 -0
  3. package/.github/workflows/firebase-hosting-pull-request.yml +10 -0
  4. package/.github/workflows/github-pages.yml +2 -0
  5. package/CHANGELOG.md +16 -1
  6. package/README.md +1 -3
  7. package/dist/bundle.js +1 -1
  8. package/dist/src/Editor.d.ts +11 -0
  9. package/dist/src/Editor.js +107 -77
  10. package/dist/src/Pointer.d.ts +1 -1
  11. package/dist/src/Pointer.js +8 -3
  12. package/dist/src/Viewport.d.ts +1 -0
  13. package/dist/src/Viewport.js +14 -1
  14. package/dist/src/components/AbstractComponent.js +1 -0
  15. package/dist/src/components/ImageComponent.d.ts +2 -2
  16. package/dist/src/components/Stroke.js +15 -9
  17. package/dist/src/components/Text.d.ts +1 -1
  18. package/dist/src/components/Text.js +1 -1
  19. package/dist/src/components/builders/FreehandLineBuilder.d.ts +1 -0
  20. package/dist/src/components/builders/FreehandLineBuilder.js +34 -36
  21. package/dist/src/language/assertions.d.ts +1 -0
  22. package/dist/src/language/assertions.js +5 -0
  23. package/dist/src/math/Mat33.d.ts +38 -2
  24. package/dist/src/math/Mat33.js +30 -1
  25. package/dist/src/math/Path.d.ts +1 -1
  26. package/dist/src/math/Path.js +10 -8
  27. package/dist/src/math/Vec3.d.ts +12 -2
  28. package/dist/src/math/Vec3.js +16 -1
  29. package/dist/src/math/rounding.d.ts +1 -0
  30. package/dist/src/math/rounding.js +13 -6
  31. package/dist/src/rendering/renderers/AbstractRenderer.js +2 -1
  32. package/dist/src/testing/beforeEachFile.d.ts +1 -0
  33. package/dist/src/testing/beforeEachFile.js +3 -0
  34. package/dist/src/testing/createEditor.d.ts +1 -0
  35. package/dist/src/testing/createEditor.js +7 -1
  36. package/dist/src/testing/loadExpectExtensions.d.ts +0 -15
  37. package/dist/src/toolbar/HTMLToolbar.js +5 -4
  38. package/dist/src/toolbar/widgets/SelectionToolWidget.d.ts +1 -1
  39. package/dist/src/tools/PasteHandler.js +3 -1
  40. package/dist/src/tools/Pen.js +1 -1
  41. package/dist/src/tools/SelectionTool/Selection.d.ts +54 -0
  42. package/dist/src/tools/SelectionTool/Selection.js +337 -0
  43. package/dist/src/tools/SelectionTool/SelectionHandle.d.ts +35 -0
  44. package/dist/src/tools/SelectionTool/SelectionHandle.js +75 -0
  45. package/dist/src/tools/SelectionTool/SelectionTool.d.ts +31 -0
  46. package/dist/src/tools/SelectionTool/SelectionTool.js +284 -0
  47. package/dist/src/tools/SelectionTool/TransformMode.d.ts +34 -0
  48. package/dist/src/tools/SelectionTool/TransformMode.js +98 -0
  49. package/dist/src/tools/SelectionTool/types.d.ts +9 -0
  50. package/dist/src/tools/SelectionTool/types.js +11 -0
  51. package/dist/src/tools/ToolController.js +1 -1
  52. package/dist/src/tools/lib.d.ts +1 -1
  53. package/dist/src/tools/lib.js +1 -1
  54. package/dist/src/types.d.ts +1 -1
  55. package/jest.config.js +5 -0
  56. package/package.json +15 -14
  57. package/src/Editor.css +1 -0
  58. package/src/Editor.ts +147 -108
  59. package/src/Pointer.ts +8 -3
  60. package/src/Viewport.ts +17 -2
  61. package/src/components/AbstractComponent.ts +4 -6
  62. package/src/components/ImageComponent.ts +2 -6
  63. package/src/components/Stroke.test.ts +0 -3
  64. package/src/components/Stroke.ts +14 -7
  65. package/src/components/Text.test.ts +0 -3
  66. package/src/components/Text.ts +4 -8
  67. package/src/components/builders/FreehandLineBuilder.ts +37 -43
  68. package/src/language/assertions.ts +6 -0
  69. package/src/math/LineSegment2.test.ts +8 -10
  70. package/src/math/Mat33.test.ts +14 -2
  71. package/src/math/Mat33.ts +43 -2
  72. package/src/math/Path.toString.test.ts +12 -1
  73. package/src/math/Path.ts +11 -9
  74. package/src/math/Rect2.test.ts +0 -3
  75. package/src/math/Vec2.test.ts +0 -3
  76. package/src/math/Vec3.test.ts +0 -3
  77. package/src/math/Vec3.ts +23 -2
  78. package/src/math/rounding.test.ts +30 -5
  79. package/src/math/rounding.ts +16 -7
  80. package/src/rendering/renderers/AbstractRenderer.ts +3 -2
  81. package/src/testing/beforeEachFile.ts +3 -0
  82. package/src/testing/createEditor.ts +8 -1
  83. package/src/testing/global.d.ts +17 -0
  84. package/src/testing/loadExpectExtensions.ts +0 -15
  85. package/src/toolbar/HTMLToolbar.ts +5 -4
  86. package/src/toolbar/toolbar.css +3 -2
  87. package/src/toolbar/widgets/SelectionToolWidget.ts +1 -1
  88. package/src/tools/PasteHandler.ts +4 -1
  89. package/src/tools/Pen.test.ts +150 -0
  90. package/src/tools/Pen.ts +1 -1
  91. package/src/tools/SelectionTool/Selection.ts +455 -0
  92. package/src/tools/SelectionTool/SelectionHandle.ts +99 -0
  93. package/src/tools/SelectionTool/SelectionTool.css +22 -0
  94. package/src/tools/{SelectionTool.test.ts → SelectionTool/SelectionTool.test.ts} +21 -21
  95. package/src/tools/SelectionTool/SelectionTool.ts +344 -0
  96. package/src/tools/SelectionTool/TransformMode.ts +114 -0
  97. package/src/tools/SelectionTool/types.ts +11 -0
  98. package/src/tools/ToolController.ts +1 -1
  99. package/src/tools/lib.ts +1 -1
  100. package/src/types.ts +1 -1
  101. package/tsconfig.json +3 -1
  102. package/dist/src/tools/SelectionTool.d.ts +0 -65
  103. package/dist/src/tools/SelectionTool.js +0 -647
  104. package/src/tools/SelectionTool.ts +0 -797
@@ -183,6 +183,22 @@ export default class Mat33 {
183
183
  this.c1, this.c2, this.c3,
184
184
  ];
185
185
  }
186
+ /**
187
+ * @example
188
+ * ```
189
+ * new Mat33(
190
+ * 1, 2, 3,
191
+ * 4, 5, 6,
192
+ * 7, 8, 9,
193
+ * ).mapEntries(component => component - 1);
194
+ * // → ⎡ 0, 1, 2 ⎤
195
+ * // ⎢ 3, 4, 5 ⎥
196
+ * // ⎣ 6, 7, 8 ⎦
197
+ * ```
198
+ */
199
+ mapEntries(mapping) {
200
+ return new Mat33(mapping(this.a1), mapping(this.a2), mapping(this.a3), mapping(this.b1), mapping(this.b2), mapping(this.b3), mapping(this.c1), mapping(this.c2), mapping(this.c3));
201
+ }
186
202
  /** Constructs a 3x3 translation matrix (for translating `Vec2`s) */
187
203
  static translation(amount) {
188
204
  // When transforming Vec2s by a 3x3 matrix, we give the input
@@ -214,7 +230,20 @@ export default class Mat33 {
214
230
  // Translate such that [center] goes to (0, 0)
215
231
  return result.rightMul(Mat33.translation(center.times(-1)));
216
232
  }
217
- /** Converts a CSS-form `matrix(a, b, c, d, e, f)` to a Mat33. */
233
+ /** @see {@link !fromCSSMatrix} */
234
+ toCSSMatrix() {
235
+ return `matrix(${this.a1},${this.b1},${this.a2},${this.b2},${this.a3},${this.b3})`;
236
+ }
237
+ /**
238
+ * Converts a CSS-form `matrix(a, b, c, d, e, f)` to a Mat33.
239
+ *
240
+ * Note that such a matrix has the form,
241
+ * ```
242
+ * ⎡ a c e ⎤
243
+ * ⎢ b d f ⎥
244
+ * ⎣ 0 0 1 ⎦
245
+ * ```
246
+ */
218
247
  static fromCSSMatrix(cssString) {
219
248
  if (cssString === '' || cssString === 'none') {
220
249
  return Mat33.identity;
@@ -55,7 +55,7 @@ export default class Path {
55
55
  static fromRenderable(renderable: RenderablePathSpec): Path;
56
56
  toRenderable(fill: RenderingStyle): RenderablePathSpec;
57
57
  private cachedStringVersion;
58
- toString(): string;
58
+ toString(useNonAbsCommands?: boolean): string;
59
59
  serialize(): string;
60
60
  static toString(startPoint: Point2, parts: PathCommand[], onlyAbsCommands?: boolean): string;
61
61
  static fromString(pathString: string): Path;
@@ -282,13 +282,15 @@ export default class Path {
282
282
  path: this,
283
283
  };
284
284
  }
285
- toString() {
285
+ toString(useNonAbsCommands) {
286
286
  if (this.cachedStringVersion) {
287
287
  return this.cachedStringVersion;
288
288
  }
289
- // Hueristic: Try to determine whether converting absolute to relative commands is worth it.
290
- const makeRelativeCommands = Math.abs(this.bbox.topLeft.x) > 10 && Math.abs(this.bbox.topLeft.y) > 10;
291
- const result = Path.toString(this.startPoint, this.parts, !makeRelativeCommands);
289
+ if (useNonAbsCommands === undefined) {
290
+ // Hueristic: Try to determine whether converting absolute to relative commands is worth it.
291
+ useNonAbsCommands = Math.abs(this.bbox.topLeft.x) > 10 && Math.abs(this.bbox.topLeft.y) > 10;
292
+ }
293
+ const result = Path.toString(this.startPoint, this.parts, !useNonAbsCommands);
292
294
  this.cachedStringVersion = result;
293
295
  return result;
294
296
  }
@@ -307,10 +309,12 @@ export default class Path {
307
309
  const roundedPrevX = prevPoint ? toRoundedString(prevPoint.x) : '';
308
310
  const roundedPrevY = prevPoint ? toRoundedString(prevPoint.y) : '';
309
311
  for (const point of points) {
312
+ const xComponent = toRoundedString(point.x);
313
+ const yComponent = toRoundedString(point.y);
310
314
  // Relative commands are often shorter as strings than absolute commands.
311
315
  if (!makeAbsCommand) {
312
- const xComponentRelative = toStringOfSamePrecision(point.x - prevPoint.x, roundedPrevX, roundedPrevY);
313
- const yComponentRelative = toStringOfSamePrecision(point.y - prevPoint.y, roundedPrevX, roundedPrevY);
316
+ const xComponentRelative = toStringOfSamePrecision(point.x - prevPoint.x, xComponent, roundedPrevX, roundedPrevY);
317
+ const yComponentRelative = toStringOfSamePrecision(point.y - prevPoint.y, yComponent, roundedPrevX, roundedPrevY);
314
318
  // No need for an additional separator if it starts with a '-'
315
319
  if (yComponentRelative.charAt(0) === '-') {
316
320
  relativeCommandParts.push(`${xComponentRelative}${yComponentRelative}`);
@@ -320,8 +324,6 @@ export default class Path {
320
324
  }
321
325
  }
322
326
  else {
323
- const xComponent = toRoundedString(point.x);
324
- const yComponent = toRoundedString(point.y);
325
327
  absoluteCommandParts.push(`${xComponent},${yComponent}`);
326
328
  }
327
329
  }
@@ -38,6 +38,16 @@ export default class Vec3 {
38
38
  minus(v: Vec3): Vec3;
39
39
  dot(other: Vec3): number;
40
40
  cross(other: Vec3): Vec3;
41
+ /**
42
+ * If `other` is a `Vec3`, multiplies `this` component-wise by `other`. Otherwise,
43
+ * if `other is a `number`, returns the result of scalar multiplication.
44
+ *
45
+ * @example
46
+ * ```
47
+ * Vec3.of(1, 2, 3).scale(Vec3.of(2, 4, 6)); // → Vec3(2, 8, 18)
48
+ * ```
49
+ */
50
+ scale(other: Vec3 | number): Vec3;
41
51
  /**
42
52
  * Returns a vector orthogonal to this. If this is a Vec2, returns `this` rotated
43
53
  * 90 degrees counter-clockwise.
@@ -73,7 +83,7 @@ export default class Vec3 {
73
83
  * ```
74
84
  */
75
85
  map(fn: (component: number, index: number) => number): Vec3;
76
- asArray(): number[];
86
+ asArray(): [number, number, number];
77
87
  /**
78
88
  * [fuzz] The maximum difference between two components for this and [other]
79
89
  * to be considered equal.
@@ -87,7 +97,7 @@ export default class Vec3 {
87
97
  * Vec3.of(1, 2, 3).eq(Vec3.of(4, 5, 6), 2.99); // → false
88
98
  * ```
89
99
  */
90
- eq(other: Vec3, fuzz: number): boolean;
100
+ eq(other: Vec3, fuzz?: number): boolean;
91
101
  toString(): string;
92
102
  static unitX: Vec3;
93
103
  static unitY: Vec3;
@@ -76,6 +76,21 @@ export default class Vec3 {
76
76
  // | x2 y2 z2|
77
77
  return Vec3.of(this.y * other.z - other.y * this.z, other.x * this.z - this.x * other.z, this.x * other.y - other.x * this.y);
78
78
  }
79
+ /**
80
+ * If `other` is a `Vec3`, multiplies `this` component-wise by `other`. Otherwise,
81
+ * if `other is a `number`, returns the result of scalar multiplication.
82
+ *
83
+ * @example
84
+ * ```
85
+ * Vec3.of(1, 2, 3).scale(Vec3.of(2, 4, 6)); // → Vec3(2, 8, 18)
86
+ * ```
87
+ */
88
+ scale(other) {
89
+ if (typeof other === 'number') {
90
+ return this.times(other);
91
+ }
92
+ return Vec3.of(this.x * other.x, this.y * other.y, this.z * other.z);
93
+ }
79
94
  /**
80
95
  * Returns a vector orthogonal to this. If this is a Vec2, returns `this` rotated
81
96
  * 90 degrees counter-clockwise.
@@ -141,7 +156,7 @@ export default class Vec3 {
141
156
  * Vec3.of(1, 2, 3).eq(Vec3.of(4, 5, 6), 2.99); // → false
142
157
  * ```
143
158
  */
144
- eq(other, fuzz) {
159
+ eq(other, fuzz = 1e-10) {
145
160
  for (let i = 0; i < 3; i++) {
146
161
  if (Math.abs(other.at(i) - this.at(i)) > fuzz) {
147
162
  return false;
@@ -1,3 +1,4 @@
1
+ export declare const cleanUpNumber: (text: string) => string;
1
2
  export declare const toRoundedString: (num: number) => string;
2
3
  export declare const getLenAfterDecimal: (numberAsString: string) => number;
3
4
  export declare const toStringOfSamePrecision: (num: number, ...references: string[]) => string;
@@ -1,8 +1,14 @@
1
1
  // @packageDocumentation @internal
2
2
  // Clean up stringified numbers
3
- const cleanUpNumber = (text) => {
3
+ export const cleanUpNumber = (text) => {
4
4
  // Regular expression substitions can be somewhat expensive. Only do them
5
5
  // if necessary.
6
+ if (text.indexOf('e') > 0) {
7
+ // Round to zero.
8
+ if (text.match(/[eE][-]\d{2,}$/)) {
9
+ return '0';
10
+ }
11
+ }
6
12
  const lastChar = text.charAt(text.length - 1);
7
13
  if (lastChar === '0' || lastChar === '.') {
8
14
  // Remove trailing zeroes
@@ -10,23 +16,24 @@ const cleanUpNumber = (text) => {
10
16
  text = text.replace(/[.]0+$/, '.');
11
17
  // Remove trailing period
12
18
  text = text.replace(/[.]$/, '');
13
- if (text === '-0') {
14
- return '0';
15
- }
16
19
  }
17
20
  const firstChar = text.charAt(0);
18
21
  if (firstChar === '0' || firstChar === '-') {
19
22
  // Remove unnecessary leading zeroes.
20
23
  text = text.replace(/^(0+)[.]/, '.');
21
24
  text = text.replace(/^-(0+)[.]/, '-.');
25
+ text = text.replace(/^(-?)0+$/, '$10');
26
+ }
27
+ if (text === '-0') {
28
+ return '0';
22
29
  }
23
30
  return text;
24
31
  };
25
32
  export const toRoundedString = (num) => {
26
33
  // Try to remove rounding errors. If the number ends in at least three/four zeroes
27
34
  // (or nines) just one or two digits, it's probably a rounding error.
28
- const fixRoundingUpExp = /^([-]?\d*\.\d{3,})0{4,}\d{1,2}$/;
29
- const hasRoundingDownExp = /^([-]?)(\d*)\.(\d{3,}9{4,})\d{1,2}$/;
35
+ const fixRoundingUpExp = /^([-]?\d*\.\d{3,})0{4,}\d{1,4}$/;
36
+ const hasRoundingDownExp = /^([-]?)(\d*)\.(\d{3,}9{4,})\d{1,4}$/;
30
37
  let text = num.toString(10);
31
38
  if (text.indexOf('.') === -1) {
32
39
  return text;
@@ -64,7 +64,8 @@ export default class AbstractRenderer {
64
64
  this.currentPaths.push(path);
65
65
  }
66
66
  }
67
- // Draw a rectangle. Boundary lines have width [lineWidth] and are filled with [lineFill]
67
+ // Draw a rectangle. Boundary lines have width [lineWidth] and are filled with [lineFill].
68
+ // This is equivalent to `drawPath(Path.fromRect(...).toRenderable(...))`.
68
69
  drawRect(rect, lineWidth, lineFill) {
69
70
  const path = Path.fromRect(rect, lineWidth);
70
71
  this.drawPath(path.toRenderable(lineFill));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import loadExpectExtensions from './loadExpectExtensions';
2
+ loadExpectExtensions();
3
+ jest.useFakeTimers();
@@ -1,3 +1,4 @@
1
1
  import Editor from '../Editor';
2
+ /** Creates an editor. Should only be used in test files. */
2
3
  declare const _default: () => Editor;
3
4
  export default _default;
@@ -1,3 +1,9 @@
1
1
  import { RenderingMode } from '../rendering/Display';
2
2
  import Editor from '../Editor';
3
- export default () => new Editor(document.body, { renderingMode: RenderingMode.DummyRenderer });
3
+ /** Creates an editor. Should only be used in test files. */
4
+ export default () => {
5
+ if (jest === undefined) {
6
+ throw new Error('Files in the testing/ folder should only be used in tests!');
7
+ }
8
+ return new Editor(document.body, { renderingMode: RenderingMode.DummyRenderer });
9
+ };
@@ -1,17 +1,2 @@
1
1
  export declare const loadExpectExtensions: () => void;
2
- export interface CustomMatchers<R = unknown> {
3
- objEq(expected: {
4
- eq: (other: any, ...args: any) => boolean;
5
- }, ...opts: any): R;
6
- }
7
- declare global {
8
- export namespace jest {
9
- interface Expect extends CustomMatchers {
10
- }
11
- interface Matchers<R> extends CustomMatchers<R> {
12
- }
13
- interface AsyncAsymmetricMatchers extends CustomMatchers {
14
- }
15
- }
16
- }
17
2
  export default loadExpectExtensions;
@@ -1,17 +1,18 @@
1
1
  import { EditorEventType } from '../types';
2
2
  import { coloris, init as colorisInit } from '@melloware/coloris';
3
3
  import Color4 from '../Color4';
4
- import SelectionTool from '../tools/SelectionTool';
5
4
  import { defaultToolbarLocalization } from './localization';
6
5
  import { makeRedoIcon, makeUndoIcon } from './icons';
7
- import PanZoom from '../tools/PanZoom';
6
+ import SelectionTool from '../tools/SelectionTool/SelectionTool';
7
+ import PanZoomTool from '../tools/PanZoom';
8
8
  import TextTool from '../tools/TextTool';
9
+ import EraserTool from '../tools/Eraser';
10
+ import PenTool from '../tools/Pen';
9
11
  import PenToolWidget from './widgets/PenToolWidget';
10
12
  import EraserWidget from './widgets/EraserToolWidget';
11
13
  import SelectionToolWidget from './widgets/SelectionToolWidget';
12
14
  import TextToolWidget from './widgets/TextToolWidget';
13
15
  import HandToolWidget from './widgets/HandToolWidget';
14
- import { EraserTool, PenTool } from '../tools/lib';
15
16
  export const toolbarCSSPrefix = 'toolbar-';
16
17
  export default class HTMLToolbar {
17
18
  /** @internal */
@@ -158,7 +159,7 @@ export default class HTMLToolbar {
158
159
  for (const tool of toolController.getMatchingTools(TextTool)) {
159
160
  this.addWidget(new TextToolWidget(this.editor, tool, this.localizationTable));
160
161
  }
161
- const panZoomTool = toolController.getMatchingTools(PanZoom)[0];
162
+ const panZoomTool = toolController.getMatchingTools(PanZoomTool)[0];
162
163
  if (panZoomTool) {
163
164
  this.addWidget(new HandToolWidget(this.editor, panZoomTool, this.localizationTable));
164
165
  }
@@ -1,5 +1,5 @@
1
1
  import Editor from '../../Editor';
2
- import SelectionTool from '../../tools/SelectionTool';
2
+ import SelectionTool from '../../tools/SelectionTool/SelectionTool';
3
3
  import { ToolbarLocalization } from '../localization';
4
4
  import BaseToolWidget from './BaseToolWidget';
5
5
  export default class SelectionToolWidget extends BaseToolWidget {
@@ -17,10 +17,11 @@ import SVGLoader from '../SVGLoader';
17
17
  import { Mat33, Vec2 } from '../math/lib';
18
18
  import BaseTool from './BaseTool';
19
19
  import EditorImage from '../EditorImage';
20
- import SelectionTool from './SelectionTool';
20
+ import SelectionTool from './SelectionTool/SelectionTool';
21
21
  import TextTool from './TextTool';
22
22
  import Color4 from '../Color4';
23
23
  import ImageComponent from '../components/ImageComponent';
24
+ import Viewport from '../Viewport';
24
25
  // { @inheritDoc PasteHandler! }
25
26
  export default class PasteHandler extends BaseTool {
26
27
  constructor(editor) {
@@ -66,6 +67,7 @@ export default class PasteHandler extends BaseTool {
66
67
  scaleRatio = scaleRatioY;
67
68
  }
68
69
  scaleRatio *= 2 / 3;
70
+ scaleRatio = Viewport.roundScaleRatio(scaleRatio);
69
71
  const transfm = Mat33.translation(visibleRect.center.minus(bbox.center)).rightMul(Mat33.scaling2D(scaleRatio, bbox.center));
70
72
  const commands = [];
71
73
  for (const component of components) {
@@ -131,7 +131,7 @@ export default class Pen extends BaseTool {
131
131
  newThickness = this.getThickness() * 3 / 2;
132
132
  }
133
133
  if (newThickness !== undefined) {
134
- newThickness = Math.min(Math.max(1, newThickness), 128);
134
+ newThickness = Math.min(Math.max(1, newThickness), 256);
135
135
  this.setThickness(newThickness);
136
136
  return true;
137
137
  }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @internal
3
+ * @packageDocumentation
4
+ */
5
+ import Editor from '../../Editor';
6
+ import { Mat33, Rect2 } from '../../math/lib';
7
+ import { Point2 } from '../../math/Vec2';
8
+ import Pointer from '../../Pointer';
9
+ import AbstractComponent from '../../components/AbstractComponent';
10
+ import Command from '../../commands/Command';
11
+ export default class Selection {
12
+ private editor;
13
+ private handles;
14
+ private originalRegion;
15
+ private transformers;
16
+ private transform;
17
+ private transformCommands;
18
+ private selectedElems;
19
+ private container;
20
+ private backgroundElem;
21
+ constructor(startPoint: Point2, editor: Editor);
22
+ getTransform(): Mat33;
23
+ get preTransformRegion(): Rect2;
24
+ get region(): Rect2;
25
+ get regionRotation(): number;
26
+ get preTransformedScreenRegion(): Rect2;
27
+ get preTransformedScreenRegionRotation(): number;
28
+ get screenRegion(): Rect2;
29
+ get screenRegionRotation(): number;
30
+ private computeTransformCommands;
31
+ setTransform(transform: Mat33, preview?: boolean): void;
32
+ finalizeTransform(): void;
33
+ private static ApplyTransformationCommand;
34
+ private previewTransformCmds;
35
+ resolveToObjects(): boolean;
36
+ recomputeRegion(): boolean;
37
+ getMinCanvasSize(): number;
38
+ getSelectedItemCount(): number;
39
+ updateUI(): void;
40
+ private targetHandle;
41
+ private backgroundDragging;
42
+ onDragStart(pointer: Pointer, target: EventTarget): boolean;
43
+ onDragUpdate(pointer: Pointer): void;
44
+ onDragEnd(): void;
45
+ onDragCancel(): void;
46
+ scrollTo(): void;
47
+ deleteSelectedObjects(): Command;
48
+ duplicateSelectedObjects(): Command;
49
+ addTo(elem: HTMLElement): void;
50
+ setToPoint(point: Point2): void;
51
+ cancelSelection(): void;
52
+ setSelectedObjects(objects: AbstractComponent[], bbox: Rect2): void;
53
+ getSelectedObjects(): AbstractComponent[];
54
+ }