@next2d/geom 1.18.11 → 2.0.0

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 (98) hide show
  1. package/package.json +8 -24
  2. package/src/ColorTransform/service/ColorTransformConcatService.d.ts +12 -0
  3. package/src/ColorTransform/service/ColorTransformConcatService.js +25 -0
  4. package/{dist → src}/ColorTransform.d.ts +57 -69
  5. package/src/ColorTransform.js +240 -0
  6. package/src/GeomUtil.d.ts +63 -0
  7. package/src/GeomUtil.js +102 -0
  8. package/src/Matrix/service/MatirxConcatService.d.ts +12 -0
  9. package/src/Matrix/service/MatirxConcatService.js +34 -0
  10. package/src/Matrix/service/MatrixCloneService.d.ts +11 -0
  11. package/src/Matrix/service/MatrixCloneService.js +13 -0
  12. package/src/Matrix/service/MatrixCopyFromService.d.ts +12 -0
  13. package/src/Matrix/service/MatrixCopyFromService.js +18 -0
  14. package/src/Matrix/service/MatrixCreateBoxService.d.ts +15 -0
  15. package/src/Matrix/service/MatrixCreateBoxService.js +19 -0
  16. package/src/Matrix/service/MatrixCreateGradientBoxService.d.ts +16 -0
  17. package/src/Matrix/service/MatrixCreateGradientBoxService.js +33 -0
  18. package/src/Matrix/service/MatrixDeltaTransformPointService.d.ts +13 -0
  19. package/src/Matrix/service/MatrixDeltaTransformPointService.js +14 -0
  20. package/src/Matrix/service/MatrixIdentityService.d.ts +11 -0
  21. package/src/Matrix/service/MatrixIdentityService.js +17 -0
  22. package/src/Matrix/service/MatrixInvertService.d.ts +11 -0
  23. package/src/Matrix/service/MatrixInvertService.js +37 -0
  24. package/src/Matrix/service/MatrixRotateService.d.ts +11 -0
  25. package/src/Matrix/service/MatrixRotateService.js +24 -0
  26. package/src/Matrix/service/MatrixScaleService.d.ts +13 -0
  27. package/src/Matrix/service/MatrixScaleService.js +20 -0
  28. package/src/Matrix/service/MatrixSetToService.d.ts +17 -0
  29. package/src/Matrix/service/MatrixSetToService.js +24 -0
  30. package/src/Matrix/service/MatrixTransformPointService.d.ts +13 -0
  31. package/src/Matrix/service/MatrixTransformPointService.js +17 -0
  32. package/src/Matrix/service/MatrixTranslateService.d.ts +13 -0
  33. package/src/Matrix/service/MatrixTranslateService.js +15 -0
  34. package/{dist → src}/Matrix.d.ts +45 -69
  35. package/{dist → src}/Matrix.js +92 -204
  36. package/src/Point/service/PointAddService.d.ts +12 -0
  37. package/src/Point/service/PointAddService.js +14 -0
  38. package/src/Point/service/PointCloneService.d.ts +11 -0
  39. package/src/Point/service/PointCloneService.js +13 -0
  40. package/src/Point/service/PointCopyFromService.d.ts +12 -0
  41. package/src/Point/service/PointCopyFromService.js +14 -0
  42. package/src/Point/service/PointDistanceService.d.ts +12 -0
  43. package/src/Point/service/PointDistanceService.js +14 -0
  44. package/src/Point/service/PointEqualsService.d.ts +12 -0
  45. package/src/Point/service/PointEqualsService.js +13 -0
  46. package/src/Point/service/PointInterpolateService.d.ts +13 -0
  47. package/src/Point/service/PointInterpolateService.js +15 -0
  48. package/src/Point/service/PointNormalizeService.d.ts +12 -0
  49. package/src/Point/service/PointNormalizeService.js +15 -0
  50. package/src/Point/service/PointOffsetService.d.ts +13 -0
  51. package/src/Point/service/PointOffsetService.js +15 -0
  52. package/src/Point/service/PointPolarService.d.ts +12 -0
  53. package/src/Point/service/PointPolarService.js +14 -0
  54. package/src/Point/service/PointSetToService.d.ts +13 -0
  55. package/src/Point/service/PointSetToService.js +15 -0
  56. package/src/Point/service/PointSubtractService.d.ts +12 -0
  57. package/src/Point/service/PointSubtractService.js +14 -0
  58. package/{dist → src}/Point.d.ts +34 -82
  59. package/{dist → src}/Point.js +67 -128
  60. package/src/Rectangle/service/RectangleCloneService.d.ts +11 -0
  61. package/src/Rectangle/service/RectangleCloneService.js +13 -0
  62. package/src/Rectangle/service/RectangleContainsPointService.d.ts +13 -0
  63. package/src/Rectangle/service/RectangleContainsPointService.js +16 -0
  64. package/src/Rectangle/service/RectangleContainsRectService.d.ts +12 -0
  65. package/src/Rectangle/service/RectangleContainsRectService.js +16 -0
  66. package/src/Rectangle/service/RectangleContainsService.d.ts +13 -0
  67. package/src/Rectangle/service/RectangleContainsService.js +17 -0
  68. package/src/Rectangle/service/RectangleCopyFromService.d.ts +12 -0
  69. package/src/Rectangle/service/RectangleCopyFromService.js +16 -0
  70. package/src/Rectangle/service/RectangleEqualsService.d.ts +12 -0
  71. package/src/Rectangle/service/RectangleEqualsService.js +16 -0
  72. package/src/Rectangle/service/RectangleInflatePointService.d.ts +13 -0
  73. package/src/Rectangle/service/RectangleInflatePointService.js +16 -0
  74. package/src/Rectangle/service/RectangleInflateService.d.ts +13 -0
  75. package/src/Rectangle/service/RectangleInflateService.js +17 -0
  76. package/src/Rectangle/service/RectangleIntersectionService.d.ts +12 -0
  77. package/src/Rectangle/service/RectangleIntersectionService.js +22 -0
  78. package/src/Rectangle/service/RectangleIntersectsService.d.ts +12 -0
  79. package/src/Rectangle/service/RectangleIntersectsService.js +17 -0
  80. package/src/Rectangle/service/RectangleIsEmptyService.d.ts +11 -0
  81. package/src/Rectangle/service/RectangleIsEmptyService.js +12 -0
  82. package/src/Rectangle/service/RectangleOffsetPointService.d.ts +13 -0
  83. package/src/Rectangle/service/RectangleOffsetPointService.js +14 -0
  84. package/src/Rectangle/service/RectangleOffsetService.d.ts +13 -0
  85. package/src/Rectangle/service/RectangleOffsetService.js +15 -0
  86. package/src/Rectangle/service/RectangleSetEmptyService.d.ts +11 -0
  87. package/src/Rectangle/service/RectangleSetEmptyService.js +12 -0
  88. package/src/Rectangle/service/RectangleSetToService.d.ts +15 -0
  89. package/src/Rectangle/service/RectangleSetToService.js +19 -0
  90. package/src/Rectangle/service/RectangleUnionService.d.ts +12 -0
  91. package/src/Rectangle/service/RectangleUnionService.js +20 -0
  92. package/{dist → src}/Rectangle.d.ts +50 -102
  93. package/{dist → src}/Rectangle.js +110 -205
  94. package/{dist → src}/index.d.ts +0 -1
  95. package/{dist → src}/index.js +0 -1
  96. package/dist/ColorTransform.js +0 -278
  97. package/dist/Transform.d.ts +0 -209
  98. package/dist/Transform.js +0 -478
@@ -1,25 +1,35 @@
1
1
  import { Point } from "./Point";
2
- import { $Math, $clamp, $SHORT_INT_MIN, $SHORT_INT_MAX } from "@next2d/share";
2
+ import { execute as rectangleCloneService } from "../src/Rectangle/service/RectangleCloneService";
3
+ import { execute as rectangleContainsService } from "../src/Rectangle/service/RectangleContainsService";
4
+ import { execute as rectangleContainsPointService } from "../src/Rectangle/service/RectangleContainsPointService";
5
+ import { execute as rectangleContainsRectService } from "../src/Rectangle/service/RectangleContainsRectService";
6
+ import { execute as rectangleCopyFromService } from "../src/Rectangle/service/RectangleCopyFromService";
7
+ import { execute as rectangleEqualsService } from "../src/Rectangle/service/RectangleEqualsService";
8
+ import { execute as rectangleInflateService } from "../src/Rectangle/service/RectangleInflateService";
9
+ import { execute as rectangleInflatePointService } from "../src/Rectangle/service/RectangleInflatePointService";
10
+ import { execute as rectangleIntersectionService } from "../src/Rectangle/service/RectangleIntersectionService";
11
+ import { execute as rectangleIntersectsService } from "../src/Rectangle/service/RectangleIntersectsService";
12
+ import { execute as rectangleIsEmptyService } from "../src/Rectangle/service/RectangleIsEmptyService";
13
+ import { execute as rectangleOffsetService } from "../src/Rectangle/service/RectangleOffsetService";
14
+ import { execute as rectangleOffsetPointService } from "../src/Rectangle/service/RectangleOffsetPointService";
15
+ import { execute as rectangleSetEmptyService } from "../src/Rectangle/service/RectangleSetEmptyService";
16
+ import { execute as rectangleSetToService } from "../src/Rectangle/service/RectangleSetToService";
17
+ import { execute as rectangleUnionService } from "../src/Rectangle/service/RectangleUnionService";
3
18
  /**
4
- * Rectangle オブジェクトは、その位置(左上隅のポイント (x, y) で示される)、および幅と高さで定義される領域です。
5
- * Rectangle クラスの x、y、width、および height の各プロパティは、互いに独立しているため、
6
- * あるプロパティの値を変更しても、他のプロパティに影響はありません。
7
- * ただし、right プロパティと bottom プロパティはこれら 4 つのプロパティと不可分に関連しています。
8
- * 例えば、right プロパティの値を変更すると width プロパティの値も変更されます。
9
- * bottom プロパティの値を変更すると、height プロパティの値も変更されます。
19
+ * @description Rectangle オブジェクトは、その位置(左上隅のポイント (x, y) で示される)、および幅と高さで定義される領域です。
20
+ * Rectangle クラスの x、y、width、および height の各プロパティは、互いに独立しているため、
21
+ * あるプロパティの値を変更しても、他のプロパティに影響はありません。
22
+ * ただし、right プロパティと bottom プロパティはこれら 4 つのプロパティと不可分に関連しています。
23
+ * 例えば、right プロパティの値を変更すると width プロパティの値も変更されます。
24
+ * bottom プロパティの値を変更すると、height プロパティの値も変更されます。
10
25
  *
11
- * A Rectangle object is an area defined by its position,
12
- * as indicated by its top-left corner point (x, y) and by its width and its height.
13
- * The x, y, width, and height properties of the Rectangle class are independent of each other;
14
- * changing the value of one property has no effect on the others. However,
15
- * the right and bottom properties are integrally related to those four properties.
16
- * For example, if you change the value of the right property, the value of the width property changes;
17
- * if you change the bottom property, the value of the height property changes.
18
- *
19
- * @example <caption>Example usage of Rectangle.</caption>
20
- * // new Rectangle
21
- * const {Rectangle} = next2d.geom;
22
- * const rectangle = new Rectangle(0, 0, 100, 100);
26
+ * A Rectangle object is an area defined by its position,
27
+ * as indicated by its top-left corner point (x, y) and by its width and its height.
28
+ * The x, y, width, and height properties of the Rectangle class are independent of each other;
29
+ * changing the value of one property has no effect on the others. However,
30
+ * the right and bottom properties are integrally related to those four properties.
31
+ * For example, if you change the value of the right property, the value of the width property changes;
32
+ * if you change the bottom property, the value of the height property changes.
23
33
  *
24
34
  * @class
25
35
  * @memberOf next2d.geom
@@ -36,78 +46,61 @@ export class Rectangle {
36
46
  */
37
47
  constructor(x = 0, y = 0, width = 0, height = 0) {
38
48
  /**
39
- * @type {number}
40
- * @default 0
41
- * @private
49
+ * @description 矩形の左上隅の x 座標です。
50
+ * The x coordinate of the top-left corner of the rectangle.
51
+ *
52
+ * @member {number}
53
+ * @public
42
54
  */
43
- this._$x = 0;
55
+ Object.defineProperty(this, "x", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: void 0
60
+ });
44
61
  /**
45
- * @type {number}
46
- * @default 0
47
- * @private
62
+ * @description 矩形の左上隅の y 座標です。
63
+ * The y coordinate of the top-left corner of the rectangle.
64
+ *
65
+ * @member {number}
66
+ * @public
48
67
  */
49
- this._$y = 0;
68
+ Object.defineProperty(this, "y", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: void 0
73
+ });
50
74
  /**
51
- * @type {number}
52
- * @default 0
53
- * @private
75
+ * @description 矩形の幅(ピクセル単位)です。
76
+ * The width of the rectangle, in pixels.
77
+ *
78
+ * @member {number}
79
+ * @public
54
80
  */
55
- this._$width = 0;
81
+ Object.defineProperty(this, "width", {
82
+ enumerable: true,
83
+ configurable: true,
84
+ writable: true,
85
+ value: void 0
86
+ });
56
87
  /**
57
- * @type {number}
58
- * @default 0
59
- * @private
88
+ * @description 矩形の高さ(ピクセル単位)です。
89
+ * The height of the rectangle, in pixels.
90
+ *
91
+ * @member {number}
92
+ * @public
60
93
  */
61
- this._$height = 0;
62
- // init
63
- this.setTo(x, y, width, height);
64
- }
65
- /**
66
- * 指定されたクラスのストリングを返します。
67
- * Returns the string representation of the specified class.
68
- *
69
- * @return {string}
70
- * @default [class Rectangle]
71
- * @method
72
- * @static
73
- */
74
- static toString() {
75
- return "[class Rectangle]";
76
- }
77
- /**
78
- * @description 指定されたクラスの空間名を返します。
79
- * Returns the space name of the specified class.
80
- *
81
- * @member {string}
82
- * @default next2d.geom.Rectangle
83
- * @const
84
- * @static
85
- */
86
- static get namespace() {
87
- return "next2d.geom.Rectangle";
88
- }
89
- /**
90
- * @description 指定されたオブジェクトのストリングを返します。
91
- * Returns the string representation of the specified object.
92
- *
93
- * @return {string}
94
- * @method
95
- * @public
96
- */
97
- toString() {
98
- return `(x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height})`;
99
- }
100
- /**
101
- * @description 指定されたオブジェクトの空間名を返します。
102
- * Returns the space name of the specified object.
103
- *
104
- * @member {string}
105
- * @default next2d.geom.Rectangle
106
- * @const
107
- * @public
108
- */
109
- get namespace() {
110
- return "next2d.geom.Rectangle";
94
+ Object.defineProperty(this, "height", {
95
+ enumerable: true,
96
+ configurable: true,
97
+ writable: true,
98
+ value: void 0
99
+ });
100
+ this.x = x;
101
+ this.y = y;
102
+ this.width = width;
103
+ this.height = height;
111
104
  }
112
105
  /**
113
106
  * @description y プロパティと height プロパティの合計です。
@@ -120,7 +113,7 @@ export class Rectangle {
120
113
  return this.y + this.height;
121
114
  }
122
115
  set bottom(bottom) {
123
- this.height = +bottom - this.y;
116
+ this.height = bottom - this.y;
124
117
  }
125
118
  /**
126
119
  * @description Rectangle オブジェクトの右下隅の位置で、
@@ -138,19 +131,6 @@ export class Rectangle {
138
131
  this.right = point.x;
139
132
  this.bottom = point.y;
140
133
  }
141
- /**
142
- * @description 矩形の高さ(ピクセル単位)です。
143
- * The height of the rectangle, in pixels.
144
- *
145
- * @member {number}
146
- * @public
147
- */
148
- get height() {
149
- return this._$height;
150
- }
151
- set height(height) {
152
- this._$height = $clamp(+height, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
153
- }
154
134
  /**
155
135
  * @description 矩形の左上隅の x 座標です。
156
136
  * The x coordinate of the top-left corner of the rectangle.
@@ -162,7 +142,7 @@ export class Rectangle {
162
142
  return this.x;
163
143
  }
164
144
  set left(left) {
165
- this.width = this.right - +left;
145
+ this.width = this.right - left;
166
146
  this.x = left;
167
147
  }
168
148
  /**
@@ -176,7 +156,7 @@ export class Rectangle {
176
156
  return this.x + this.width;
177
157
  }
178
158
  set right(right) {
179
- this.width = +right - this.x;
159
+ this.width = right - this.x;
180
160
  }
181
161
  /**
182
162
  * @description Rectangle オブジェクトのサイズで、
@@ -205,7 +185,7 @@ export class Rectangle {
205
185
  return this.y;
206
186
  }
207
187
  set top(top) {
208
- this.height = +(this.bottom - +top);
188
+ this.height = this.bottom - top;
209
189
  this.y = top;
210
190
  }
211
191
  /**
@@ -224,45 +204,6 @@ export class Rectangle {
224
204
  this.left = point.x;
225
205
  this.top = point.y;
226
206
  }
227
- /**
228
- * @description 矩形の幅(ピクセル単位)です。
229
- * The width of the rectangle, in pixels.
230
- *
231
- * @member {number}
232
- * @public
233
- */
234
- get width() {
235
- return this._$width;
236
- }
237
- set width(width) {
238
- this._$width = $clamp(+width, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
239
- }
240
- /**
241
- * @description 矩形の左上隅の x 座標です。
242
- * The x coordinate of the top-left corner of the rectangle.
243
- *
244
- * @member {number}
245
- * @public
246
- */
247
- get x() {
248
- return this._$x;
249
- }
250
- set x(x) {
251
- this._$x = $clamp(+x, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
252
- }
253
- /**
254
- * @description 矩形の左上隅の y 座標です。
255
- * The y coordinate of the top-left corner of the rectangle.
256
- *
257
- * @member {number}
258
- * @public
259
- */
260
- get y() {
261
- return this._$y;
262
- }
263
- set y(y) {
264
- this._$y = $clamp(+y, $SHORT_INT_MIN, $SHORT_INT_MAX, 0);
265
- }
266
207
  /**
267
208
  * @description 元の Rectangle オブジェクトと x、y、width、および height の各プロパティの値が同じである、
268
209
  * 新しい Rectangle オブジェクトを返します。
@@ -274,7 +215,7 @@ export class Rectangle {
274
215
  * @public
275
216
  */
276
217
  clone() {
277
- return new Rectangle(this.x, this.y, this.width, this.height);
218
+ return rectangleCloneService(this);
278
219
  }
279
220
  /**
280
221
  * @description 指定されたポイントがこの Rectangle オブジェクトで定義される矩形領域内にあるかどうかを判別します。
@@ -288,7 +229,7 @@ export class Rectangle {
288
229
  * @public
289
230
  */
290
231
  contains(x, y) {
291
- return this.x <= x && this.y <= y && this.right > x && this.bottom > y;
232
+ return rectangleContainsService(this, x, y);
292
233
  }
293
234
  /**
294
235
  * @description 指定されたポイントがこの Rectangle オブジェクトで定義される矩形領域内にあるかどうかを判別します。
@@ -301,22 +242,20 @@ export class Rectangle {
301
242
  * @public
302
243
  */
303
244
  containsPoint(point) {
304
- return this.x <= point.x && this.y <= point.y &&
305
- this.right > point.x && this.bottom > point.y;
245
+ return rectangleContainsPointService(this, point);
306
246
  }
307
247
  /**
308
248
  * @description rect パラメーターで指定された Rectangle オブジェクトがこの Rectangle オブジェクト内にあるかどうかを判別します。
309
249
  * Determines whether the Rectangle object specified by
310
250
  * the rect parameter is contained within this Rectangle object.
311
251
  *
312
- * @param {Rectangle} rect
252
+ * @param {Rectangle} rectangle
313
253
  * @return {boolean}
314
254
  * @method
315
255
  * @public
316
256
  */
317
- containsRect(rect) {
318
- return this.x <= rect.x && this.y <= rect.y &&
319
- this.right >= rect.right && this.bottom >= rect.bottom;
257
+ containsRect(rectangle) {
258
+ return rectangleContainsRectService(this, rectangle);
320
259
  }
321
260
  /**
322
261
  * @description すべての矩形データを、ソース Rectangle オブジェクトから、
@@ -324,16 +263,13 @@ export class Rectangle {
324
263
  * Copies all of rectangle data from
325
264
  * the source Rectangle object into the calling Rectangle object.
326
265
  *
327
- * @param {Rectangle} source_rect
266
+ * @param {Rectangle} rectangle
328
267
  * @return {void}
329
268
  * @method
330
269
  * @public
331
270
  */
332
- copyFrom(source_rect) {
333
- this.x = source_rect.x;
334
- this.y = source_rect.y;
335
- this.width = source_rect.width;
336
- this.height = source_rect.height;
271
+ copyFrom(rectangle) {
272
+ rectangleCopyFromService(this, rectangle);
337
273
  }
338
274
  /**
339
275
  * @description toCompare パラメーターで指定されたオブジェクトが
@@ -341,14 +277,13 @@ export class Rectangle {
341
277
  * Determines whether the object specified
342
278
  * in the toCompare parameter is equal to this Rectangle object.
343
279
  *
344
- * @param {Rectangle} to_compare
280
+ * @param {Rectangle} rectangle
345
281
  * @return {boolean}
346
282
  * @method
347
283
  * @public
348
284
  */
349
- equals(to_compare) {
350
- return this.x === to_compare.x && this.y === to_compare.y &&
351
- this.width === to_compare.width && this.height === to_compare.height;
285
+ equals(rectangle) {
286
+ return rectangleEqualsService(this, rectangle);
352
287
  }
353
288
  /**
354
289
  * @description Rectangle オブジェクトのサイズを、指定された量(ピクセル単位)だけ大きくします。
@@ -356,15 +291,12 @@ export class Rectangle {
356
291
  *
357
292
  * @param {number} dx
358
293
  * @param {number} dy
359
- * @return void
294
+ * @return {void}
360
295
  * @method
361
296
  * @public
362
297
  */
363
298
  inflate(dx, dy) {
364
- this.x = this.x - +dx;
365
- this.width = this.width + 2 * +dx;
366
- this.y = this.y - +dy;
367
- this.height = this.height + 2 * +dy;
299
+ rectangleInflateService(this, dx, dy);
368
300
  }
369
301
  /**
370
302
  * @description Rectangle オブジェクトのサイズを大きくします。
@@ -376,10 +308,7 @@ export class Rectangle {
376
308
  * @public
377
309
  */
378
310
  inflatePoint(point) {
379
- this.x = this.x - point.x;
380
- this.width = this.width + 2 * point.x;
381
- this.y = this.y - point.y;
382
- this.height = this.height + 2 * point.y;
311
+ rectangleInflatePointService(this, point);
383
312
  }
384
313
  /**
385
314
  * @description toIntersect パラメーターで指定された Rectangle オブジェクトが
@@ -387,19 +316,13 @@ export class Rectangle {
387
316
  * If the Rectangle object specified in the toIntersect parameter intersects
388
317
  * with this Rectangle object, returns the area of intersection as a Rectangle object.
389
318
  *
390
- * @param {Rectangle} to_intersect
319
+ * @param {Rectangle} rectangle
391
320
  * @return {Rectangle}
392
321
  * @method
393
322
  * @public
394
323
  */
395
- intersection(to_intersect) {
396
- const sx = $Math.max(this.x, to_intersect.x);
397
- const sy = $Math.max(this.y, to_intersect.y);
398
- const ex = $Math.min(this.right, to_intersect.right);
399
- const ey = $Math.min(this.bottom, to_intersect.bottom);
400
- const w = ex - sx;
401
- const h = ey - sy;
402
- return w > 0 && h > 0 ? new Rectangle(sx, sy, w, h) : new Rectangle(0, 0, 0, 0);
324
+ intersection(rectangle) {
325
+ return rectangleIntersectionService(this, rectangle);
403
326
  }
404
327
  /**
405
328
  * @description toIntersect パラメーターで指定されたオブジェクトが
@@ -407,17 +330,13 @@ export class Rectangle {
407
330
  * Determines whether the object specified
408
331
  * in the toIntersect parameter intersects with this Rectangle object.
409
332
  *
410
- * @param {Rectangle} to_intersect
333
+ * @param {Rectangle} rectangle
411
334
  * @return {boolean}
412
335
  * @method
413
336
  * @public
414
337
  */
415
- intersects(to_intersect) {
416
- const sx = $Math.max(this.x, to_intersect.x);
417
- const sy = $Math.max(this.y, to_intersect.y);
418
- const ex = $Math.min(this.right, to_intersect.right);
419
- const ey = $Math.min(this.bottom, to_intersect.bottom);
420
- return ex - sx > 0 && ey - sy > 0;
338
+ intersects(rectangle) {
339
+ return rectangleIntersectsService(this, rectangle);
421
340
  }
422
341
  /**
423
342
  * @description この Rectangle オブジェクトが空かどうかを判別します。
@@ -428,7 +347,7 @@ export class Rectangle {
428
347
  * @public
429
348
  */
430
349
  isEmpty() {
431
- return this.width <= 0 || this.height <= 0;
350
+ return rectangleIsEmptyService(this);
432
351
  }
433
352
  /**
434
353
  * @description Rectangle オブジェクトの位置(左上隅で決定される)を、指定された量だけ調整します。
@@ -442,8 +361,7 @@ export class Rectangle {
442
361
  * @public
443
362
  */
444
363
  offset(dx, dy) {
445
- this.x += dx;
446
- this.y += dy;
364
+ rectangleOffsetService(this, dx, dy);
447
365
  }
448
366
  /**
449
367
  * @description Point オブジェクトをパラメーターとして使用して、Rectangle オブジェクトの位置を調整します。
@@ -455,8 +373,7 @@ export class Rectangle {
455
373
  * @public
456
374
  */
457
375
  offsetPoint(point) {
458
- this.x += point.x;
459
- this.y += point.y;
376
+ rectangleOffsetPointService(this, point);
460
377
  }
461
378
  /**
462
379
  * @description Rectangle オブジェクトのすべてのプロパティを 0 に設定します。
@@ -467,10 +384,7 @@ export class Rectangle {
467
384
  * @public
468
385
  */
469
386
  setEmpty() {
470
- this._$x = 0;
471
- this._$y = 0;
472
- this._$width = 0;
473
- this._$height = 0;
387
+ rectangleSetEmptyService(this);
474
388
  }
475
389
  /**
476
390
  * @description Rectangle のメンバーを指定の値に設定します。
@@ -485,10 +399,7 @@ export class Rectangle {
485
399
  * @public
486
400
  */
487
401
  setTo(x, y, width, height) {
488
- this.x = x;
489
- this.y = y;
490
- this.width = width;
491
- this.height = height;
402
+ rectangleSetToService(this, x, y, width, height);
492
403
  }
493
404
  /**
494
405
  * @description 2 つの矩形間の水平と垂直の空間を塗りつぶすことにより、
@@ -496,18 +407,12 @@ export class Rectangle {
496
407
  * Adds two rectangles together to create a new Rectangle object,
497
408
  * by filling in the horizontal and vertical space between the two rectangles.
498
409
  *
499
- * @param {Rectangle} to_union
410
+ * @param {Rectangle} rectangle
500
411
  * @return {Rectangle}
501
412
  * @method
502
413
  * @public
503
414
  */
504
- union(to_union) {
505
- if (this.isEmpty()) {
506
- return to_union.clone();
507
- }
508
- if (to_union.isEmpty()) {
509
- return this.clone();
510
- }
511
- return new Rectangle($Math.min(this.x, to_union.x), $Math.min(this.y, to_union.y), $Math.max(this.right - to_union.left, to_union.right - this.left), $Math.max(this.bottom - to_union.top, to_union.bottom - this.top));
415
+ union(rectangle) {
416
+ return rectangleUnionService(this, rectangle);
512
417
  }
513
418
  }
@@ -2,4 +2,3 @@ export * from "./ColorTransform";
2
2
  export * from "./Matrix";
3
3
  export * from "./Point";
4
4
  export * from "./Rectangle";
5
- export * from "./Transform";
@@ -2,4 +2,3 @@ export * from "./ColorTransform";
2
2
  export * from "./Matrix";
3
3
  export * from "./Point";
4
4
  export * from "./Rectangle";
5
- export * from "./Transform";