microboard-temp 0.6.1 → 0.6.2
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.
- package/dist/cjs/browser.js +296 -385
- package/dist/cjs/index.js +296 -385
- package/dist/cjs/node.js +296 -385
- package/dist/esm/browser.js +296 -385
- package/dist/esm/index.js +296 -385
- package/dist/esm/node.js +296 -385
- package/dist/types/Items/Transformation/Transformation.d.ts +42 -31
- package/dist/types/Items/Transformation/TransformationOperations.d.ts +4 -0
- package/package.json +1 -1
package/dist/esm/browser.js
CHANGED
|
@@ -7201,13 +7201,6 @@ class TransformationCommand {
|
|
|
7201
7201
|
};
|
|
7202
7202
|
});
|
|
7203
7203
|
}
|
|
7204
|
-
case "rotateTo":
|
|
7205
|
-
return mapItemsByOperation(this.transformation, (transformation) => {
|
|
7206
|
-
return {
|
|
7207
|
-
...this.operation,
|
|
7208
|
-
degree: transformation.getRotation()
|
|
7209
|
-
};
|
|
7210
|
-
});
|
|
7211
7204
|
case "scaleByTranslateBy": {
|
|
7212
7205
|
const op2 = this.operation;
|
|
7213
7206
|
const scaleTransformation = mapItemsByOperation(this.transformation, () => {
|
|
@@ -7229,6 +7222,13 @@ class TransformationCommand {
|
|
|
7229
7222
|
});
|
|
7230
7223
|
return scaleTransformation;
|
|
7231
7224
|
}
|
|
7225
|
+
case "rotateTo":
|
|
7226
|
+
return mapItemsByOperation(this.transformation, (transformation) => {
|
|
7227
|
+
return {
|
|
7228
|
+
...this.operation,
|
|
7229
|
+
degree: transformation.getRotation()
|
|
7230
|
+
};
|
|
7231
|
+
});
|
|
7232
7232
|
case "rotateBy": {
|
|
7233
7233
|
const op2 = this.operation;
|
|
7234
7234
|
return mapItemsByOperation(this.transformation, () => {
|
|
@@ -7318,7 +7318,7 @@ class Transformation {
|
|
|
7318
7318
|
id;
|
|
7319
7319
|
events;
|
|
7320
7320
|
subject = new SubjectOperation;
|
|
7321
|
-
|
|
7321
|
+
_matrix = new Matrix2;
|
|
7322
7322
|
previous = new Matrix2;
|
|
7323
7323
|
rotate = defaultData.rotate;
|
|
7324
7324
|
isLocked = false;
|
|
@@ -7326,29 +7326,73 @@ class Transformation {
|
|
|
7326
7326
|
this.id = id;
|
|
7327
7327
|
this.events = events;
|
|
7328
7328
|
}
|
|
7329
|
+
getMatrixData() {
|
|
7330
|
+
const { translateX, translateY, scaleX, scaleY, shearX, shearY } = this._matrix;
|
|
7331
|
+
return { translateX, translateY, scaleX, scaleY, shearX, shearY };
|
|
7332
|
+
}
|
|
7333
|
+
toMatrix() {
|
|
7334
|
+
return this._matrix.copy();
|
|
7335
|
+
}
|
|
7336
|
+
applyToContext(ctx) {
|
|
7337
|
+
this._matrix.applyToContext(ctx);
|
|
7338
|
+
}
|
|
7339
|
+
getTranslation() {
|
|
7340
|
+
return { x: this._matrix.translateX, y: this._matrix.translateY };
|
|
7341
|
+
}
|
|
7342
|
+
getScale() {
|
|
7343
|
+
return { x: this._matrix.scaleX, y: this._matrix.scaleY };
|
|
7344
|
+
}
|
|
7345
|
+
getRotation() {
|
|
7346
|
+
return this.rotate;
|
|
7347
|
+
}
|
|
7348
|
+
setLocal(xOrData, y, scaleX, scaleY) {
|
|
7349
|
+
this.previous = this._matrix.copy();
|
|
7350
|
+
if (typeof xOrData === "object") {
|
|
7351
|
+
if (xOrData.translateX !== undefined)
|
|
7352
|
+
this._matrix.translateX = xOrData.translateX;
|
|
7353
|
+
if (xOrData.translateY !== undefined)
|
|
7354
|
+
this._matrix.translateY = xOrData.translateY;
|
|
7355
|
+
if (xOrData.scaleX !== undefined)
|
|
7356
|
+
this._matrix.scaleX = xOrData.scaleX;
|
|
7357
|
+
if (xOrData.scaleY !== undefined)
|
|
7358
|
+
this._matrix.scaleY = xOrData.scaleY;
|
|
7359
|
+
} else {
|
|
7360
|
+
this._matrix.translateX = xOrData;
|
|
7361
|
+
this._matrix.translateY = y;
|
|
7362
|
+
if (scaleX !== undefined)
|
|
7363
|
+
this._matrix.scaleX = scaleX;
|
|
7364
|
+
if (scaleY !== undefined)
|
|
7365
|
+
this._matrix.scaleY = scaleY;
|
|
7366
|
+
}
|
|
7367
|
+
this.subject.publish(this, {
|
|
7368
|
+
class: "Transformation",
|
|
7369
|
+
method: "applyMatrix",
|
|
7370
|
+
items: [{ id: this.id, matrix: this.getMatrixData() }]
|
|
7371
|
+
});
|
|
7372
|
+
}
|
|
7329
7373
|
serialize() {
|
|
7330
7374
|
return {
|
|
7331
|
-
translateX: this.
|
|
7332
|
-
translateY: this.
|
|
7333
|
-
scaleX: this.
|
|
7334
|
-
scaleY: this.
|
|
7375
|
+
translateX: this._matrix.translateX,
|
|
7376
|
+
translateY: this._matrix.translateY,
|
|
7377
|
+
scaleX: this._matrix.scaleX,
|
|
7378
|
+
scaleY: this._matrix.scaleY,
|
|
7335
7379
|
rotate: this.rotate,
|
|
7336
7380
|
isLocked: this.isLocked
|
|
7337
7381
|
};
|
|
7338
7382
|
}
|
|
7339
7383
|
deserialize(data) {
|
|
7340
|
-
this.previous = this.
|
|
7384
|
+
this.previous = this._matrix.copy();
|
|
7341
7385
|
if (data.translateX) {
|
|
7342
|
-
this.
|
|
7386
|
+
this._matrix.translateX = data.translateX;
|
|
7343
7387
|
}
|
|
7344
7388
|
if (data.translateY) {
|
|
7345
|
-
this.
|
|
7389
|
+
this._matrix.translateY = data.translateY;
|
|
7346
7390
|
}
|
|
7347
7391
|
if (data.scaleX) {
|
|
7348
|
-
this.
|
|
7392
|
+
this._matrix.scaleX = data.scaleX;
|
|
7349
7393
|
}
|
|
7350
7394
|
if (data.scaleY) {
|
|
7351
|
-
this.
|
|
7395
|
+
this._matrix.scaleY = data.scaleY;
|
|
7352
7396
|
}
|
|
7353
7397
|
if (data.isLocked) {
|
|
7354
7398
|
this.isLocked = data.isLocked;
|
|
@@ -7365,7 +7409,7 @@ class Transformation {
|
|
|
7365
7409
|
return this;
|
|
7366
7410
|
}
|
|
7367
7411
|
copy(id) {
|
|
7368
|
-
const { translateX, translateY, scaleX, scaleY } = this.
|
|
7412
|
+
const { translateX, translateY, scaleX, scaleY } = this._matrix;
|
|
7369
7413
|
const { rotate } = this;
|
|
7370
7414
|
return new Transformation(id || "", this.events).deserialize({
|
|
7371
7415
|
translateX,
|
|
@@ -7376,6 +7420,17 @@ class Transformation {
|
|
|
7376
7420
|
isLocked: false
|
|
7377
7421
|
});
|
|
7378
7422
|
}
|
|
7423
|
+
getInverse() {
|
|
7424
|
+
const copy2 = this.copy();
|
|
7425
|
+
copy2._matrix.invert();
|
|
7426
|
+
return copy2;
|
|
7427
|
+
}
|
|
7428
|
+
getId() {
|
|
7429
|
+
return this.id;
|
|
7430
|
+
}
|
|
7431
|
+
setId(id) {
|
|
7432
|
+
this.id = id;
|
|
7433
|
+
}
|
|
7379
7434
|
emit(operation) {
|
|
7380
7435
|
if (this.events) {
|
|
7381
7436
|
const command = new TransformationCommand([this], operation);
|
|
@@ -7385,150 +7440,6 @@ class Transformation {
|
|
|
7385
7440
|
this.apply(operation);
|
|
7386
7441
|
}
|
|
7387
7442
|
}
|
|
7388
|
-
setId(id) {
|
|
7389
|
-
this.id = id;
|
|
7390
|
-
}
|
|
7391
|
-
apply(op) {
|
|
7392
|
-
this.previous = this.matrix.copy();
|
|
7393
|
-
switch (op.method) {
|
|
7394
|
-
case "applyMatrix": {
|
|
7395
|
-
const itemOp = op.items.find((i) => i.id === this.id);
|
|
7396
|
-
if (itemOp) {
|
|
7397
|
-
this.matrix.scale(itemOp.matrix.scaleX, itemOp.matrix.scaleY);
|
|
7398
|
-
this.matrix.translate(itemOp.matrix.translateX, itemOp.matrix.translateY);
|
|
7399
|
-
}
|
|
7400
|
-
break;
|
|
7401
|
-
}
|
|
7402
|
-
case "translateTo":
|
|
7403
|
-
this.applyTranslateTo(op.x, op.y);
|
|
7404
|
-
break;
|
|
7405
|
-
case "translateBy":
|
|
7406
|
-
this.applyTranslateBy(op.x, op.y);
|
|
7407
|
-
break;
|
|
7408
|
-
case "scaleTo":
|
|
7409
|
-
this.applyScaleTo(op.x, op.y);
|
|
7410
|
-
break;
|
|
7411
|
-
case "scaleBy":
|
|
7412
|
-
this.applyScaleBy(op.x, op.y);
|
|
7413
|
-
break;
|
|
7414
|
-
case "scaleToRelativeTo":
|
|
7415
|
-
this.applyScaleToRelativeTo(op.x, op.y, op.point);
|
|
7416
|
-
break;
|
|
7417
|
-
case "scaleByRelativeTo":
|
|
7418
|
-
this.applyScaleByRelativeTo(op.x, op.y, op.point);
|
|
7419
|
-
break;
|
|
7420
|
-
case "rotateTo":
|
|
7421
|
-
this.applyRotateTo(op.degree);
|
|
7422
|
-
break;
|
|
7423
|
-
case "rotateBy":
|
|
7424
|
-
this.applyRotateBy(op.degree);
|
|
7425
|
-
break;
|
|
7426
|
-
case "scaleByTranslateBy":
|
|
7427
|
-
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7428
|
-
break;
|
|
7429
|
-
case "transformMany":
|
|
7430
|
-
this.applyTransformMany(op.items[this.id]);
|
|
7431
|
-
break;
|
|
7432
|
-
case "locked":
|
|
7433
|
-
this.applyLocked(op.locked);
|
|
7434
|
-
break;
|
|
7435
|
-
case "unlocked":
|
|
7436
|
-
this.applyUnlocked(op.locked);
|
|
7437
|
-
break;
|
|
7438
|
-
default:
|
|
7439
|
-
return;
|
|
7440
|
-
}
|
|
7441
|
-
this.subject.publish(this, op);
|
|
7442
|
-
}
|
|
7443
|
-
applyTranslateTo(x, y) {
|
|
7444
|
-
this.matrix.translateX = x;
|
|
7445
|
-
this.matrix.translateY = y;
|
|
7446
|
-
}
|
|
7447
|
-
applyTranslateBy(x, y) {
|
|
7448
|
-
this.matrix.translate(x, y);
|
|
7449
|
-
}
|
|
7450
|
-
applyScaleTo(x, y) {
|
|
7451
|
-
this.matrix.scaleX = x;
|
|
7452
|
-
this.matrix.scaleY = y;
|
|
7453
|
-
}
|
|
7454
|
-
applyScaleBy(x, y) {
|
|
7455
|
-
this.matrix.scale(x, y);
|
|
7456
|
-
}
|
|
7457
|
-
applyScaleByTranslateBy(scale, translate) {
|
|
7458
|
-
this.matrix.scale(scale.x, scale.y);
|
|
7459
|
-
this.matrix.translate(translate.x, translate.y);
|
|
7460
|
-
}
|
|
7461
|
-
applyTransformMany(op) {
|
|
7462
|
-
if (op.method === "applyMatrix") {
|
|
7463
|
-
this.matrix.scale(op.matrix.scaleX, op.matrix.scaleY);
|
|
7464
|
-
this.matrix.translate(op.matrix.translateX, op.matrix.translateY);
|
|
7465
|
-
} else if (op.method === "scaleByTranslateBy") {
|
|
7466
|
-
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7467
|
-
} else if (op.method === "scaleBy") {
|
|
7468
|
-
this.applyScaleBy(op.x, op.y);
|
|
7469
|
-
} else if (op.method === "translateBy") {
|
|
7470
|
-
this.applyTranslateBy(op.x, op.y);
|
|
7471
|
-
} else if (op.method === "translateTo") {
|
|
7472
|
-
this.applyTranslateTo(op.x, op.y);
|
|
7473
|
-
}
|
|
7474
|
-
}
|
|
7475
|
-
applyScaleByRelativeTo(x, y, point) {
|
|
7476
|
-
const scaleX = this.matrix.scaleX * x;
|
|
7477
|
-
const scaleY = this.matrix.scaleY * y;
|
|
7478
|
-
this.matrix.translateX = -point.x * scaleX + point.x;
|
|
7479
|
-
this.matrix.translateY = -point.y * scaleY + point.y;
|
|
7480
|
-
this.matrix.scaleX = scaleX;
|
|
7481
|
-
this.matrix.scaleY = scaleY;
|
|
7482
|
-
}
|
|
7483
|
-
applyScaleToRelativeTo(x, y, point) {
|
|
7484
|
-
this.applyTranslateBy(-point.x, -point.y);
|
|
7485
|
-
this.applyScaleTo(x, y);
|
|
7486
|
-
this.applyTranslateBy(point.x, point.y);
|
|
7487
|
-
}
|
|
7488
|
-
applyRotateTo(degree) {
|
|
7489
|
-
if (degree > 0) {
|
|
7490
|
-
while (degree > 360) {
|
|
7491
|
-
degree -= 360;
|
|
7492
|
-
}
|
|
7493
|
-
if (degree === 360) {
|
|
7494
|
-
degree = 0;
|
|
7495
|
-
}
|
|
7496
|
-
} else {
|
|
7497
|
-
while (degree < -360) {
|
|
7498
|
-
degree += 360;
|
|
7499
|
-
}
|
|
7500
|
-
if (degree === -360) {
|
|
7501
|
-
degree = 0;
|
|
7502
|
-
}
|
|
7503
|
-
}
|
|
7504
|
-
this.rotate = degree;
|
|
7505
|
-
}
|
|
7506
|
-
applyRotateBy(degree) {
|
|
7507
|
-
this.applyRotateTo(this.rotate + degree);
|
|
7508
|
-
}
|
|
7509
|
-
applyLocked(locked) {
|
|
7510
|
-
this.isLocked = locked;
|
|
7511
|
-
}
|
|
7512
|
-
applyUnlocked(locked) {
|
|
7513
|
-
this.isLocked = locked;
|
|
7514
|
-
}
|
|
7515
|
-
getTranslation() {
|
|
7516
|
-
return { x: this.matrix.translateX, y: this.matrix.translateY };
|
|
7517
|
-
}
|
|
7518
|
-
getScale() {
|
|
7519
|
-
return { x: this.matrix.scaleX, y: this.matrix.scaleY };
|
|
7520
|
-
}
|
|
7521
|
-
getRotation() {
|
|
7522
|
-
return this.rotate;
|
|
7523
|
-
}
|
|
7524
|
-
getInverse() {
|
|
7525
|
-
const copy2 = this.copy();
|
|
7526
|
-
copy2.matrix.invert();
|
|
7527
|
-
return copy2;
|
|
7528
|
-
}
|
|
7529
|
-
getId() {
|
|
7530
|
-
return this.id;
|
|
7531
|
-
}
|
|
7532
7443
|
emitMatrix(matrix, timeStamp) {
|
|
7533
7444
|
this.emit({
|
|
7534
7445
|
class: "Transformation",
|
|
@@ -7540,8 +7451,8 @@ class Transformation {
|
|
|
7540
7451
|
translateTo(x, y, timeStamp) {
|
|
7541
7452
|
if (!this.id) {}
|
|
7542
7453
|
this.emitMatrix({
|
|
7543
|
-
translateX: x - this.
|
|
7544
|
-
translateY: y - this.
|
|
7454
|
+
translateX: x - this._matrix.translateX,
|
|
7455
|
+
translateY: y - this._matrix.translateY,
|
|
7545
7456
|
scaleX: 1,
|
|
7546
7457
|
scaleY: 1,
|
|
7547
7458
|
shearX: 0,
|
|
@@ -7566,8 +7477,8 @@ class Transformation {
|
|
|
7566
7477
|
this.emitMatrix({
|
|
7567
7478
|
translateX: 0,
|
|
7568
7479
|
translateY: 0,
|
|
7569
|
-
scaleX: x / this.
|
|
7570
|
-
scaleY: y / this.
|
|
7480
|
+
scaleX: x / this._matrix.scaleX,
|
|
7481
|
+
scaleY: y / this._matrix.scaleY,
|
|
7571
7482
|
shearX: 0,
|
|
7572
7483
|
shearY: 0
|
|
7573
7484
|
}, timeStamp);
|
|
@@ -7620,14 +7531,14 @@ class Transformation {
|
|
|
7620
7531
|
this.emitMatrix({
|
|
7621
7532
|
translateX: 0,
|
|
7622
7533
|
translateY: 0,
|
|
7623
|
-
scaleX: x / this.
|
|
7624
|
-
scaleY: y / this.
|
|
7534
|
+
scaleX: x / this._matrix.scaleX,
|
|
7535
|
+
scaleY: y / this._matrix.scaleY,
|
|
7625
7536
|
shearX: 0,
|
|
7626
7537
|
shearY: 0
|
|
7627
7538
|
}, timeStamp);
|
|
7628
7539
|
}
|
|
7629
7540
|
scaleByRelativeTo(x, y, point, timeStamp) {
|
|
7630
|
-
const { scaleX: sx0, scaleY: sy0, translateX: tx0, translateY: ty0 } = this.
|
|
7541
|
+
const { scaleX: sx0, scaleY: sy0, translateX: tx0, translateY: ty0 } = this._matrix;
|
|
7631
7542
|
const newSx = sx0 * x;
|
|
7632
7543
|
const newSy = sy0 * y;
|
|
7633
7544
|
this.emitMatrix({
|
|
@@ -7658,6 +7569,130 @@ class Transformation {
|
|
|
7658
7569
|
});
|
|
7659
7570
|
}
|
|
7660
7571
|
}
|
|
7572
|
+
apply(op) {
|
|
7573
|
+
this.previous = this._matrix.copy();
|
|
7574
|
+
switch (op.method) {
|
|
7575
|
+
case "applyMatrix": {
|
|
7576
|
+
const itemOp = op.items.find((i) => i.id === this.id);
|
|
7577
|
+
if (itemOp) {
|
|
7578
|
+
this._matrix.scale(itemOp.matrix.scaleX, itemOp.matrix.scaleY);
|
|
7579
|
+
this._matrix.translate(itemOp.matrix.translateX, itemOp.matrix.translateY);
|
|
7580
|
+
}
|
|
7581
|
+
break;
|
|
7582
|
+
}
|
|
7583
|
+
case "translateTo":
|
|
7584
|
+
this.applyTranslateTo(op.x, op.y);
|
|
7585
|
+
break;
|
|
7586
|
+
case "translateBy":
|
|
7587
|
+
this.applyTranslateBy(op.x, op.y);
|
|
7588
|
+
break;
|
|
7589
|
+
case "scaleTo":
|
|
7590
|
+
this.applyScaleTo(op.x, op.y);
|
|
7591
|
+
break;
|
|
7592
|
+
case "scaleBy":
|
|
7593
|
+
this.applyScaleBy(op.x, op.y);
|
|
7594
|
+
break;
|
|
7595
|
+
case "scaleToRelativeTo":
|
|
7596
|
+
this.applyScaleToRelativeTo(op.x, op.y, op.point);
|
|
7597
|
+
break;
|
|
7598
|
+
case "scaleByRelativeTo":
|
|
7599
|
+
this.applyScaleByRelativeTo(op.x, op.y, op.point);
|
|
7600
|
+
break;
|
|
7601
|
+
case "scaleByTranslateBy":
|
|
7602
|
+
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7603
|
+
break;
|
|
7604
|
+
case "rotateTo":
|
|
7605
|
+
this.applyRotateTo(op.degree);
|
|
7606
|
+
break;
|
|
7607
|
+
case "rotateBy":
|
|
7608
|
+
this.applyRotateBy(op.degree);
|
|
7609
|
+
break;
|
|
7610
|
+
case "transformMany":
|
|
7611
|
+
this.applyTransformMany(op.items[this.id]);
|
|
7612
|
+
break;
|
|
7613
|
+
case "locked":
|
|
7614
|
+
this.applyLocked(op.locked);
|
|
7615
|
+
break;
|
|
7616
|
+
case "unlocked":
|
|
7617
|
+
this.applyUnlocked(op.locked);
|
|
7618
|
+
break;
|
|
7619
|
+
default:
|
|
7620
|
+
return;
|
|
7621
|
+
}
|
|
7622
|
+
this.subject.publish(this, op);
|
|
7623
|
+
}
|
|
7624
|
+
applyTranslateTo(x, y) {
|
|
7625
|
+
this._matrix.translateX = x;
|
|
7626
|
+
this._matrix.translateY = y;
|
|
7627
|
+
}
|
|
7628
|
+
applyTranslateBy(x, y) {
|
|
7629
|
+
this._matrix.translate(x, y);
|
|
7630
|
+
}
|
|
7631
|
+
applyScaleTo(x, y) {
|
|
7632
|
+
this._matrix.scaleX = x;
|
|
7633
|
+
this._matrix.scaleY = y;
|
|
7634
|
+
}
|
|
7635
|
+
applyScaleBy(x, y) {
|
|
7636
|
+
this._matrix.scale(x, y);
|
|
7637
|
+
}
|
|
7638
|
+
applyScaleByTranslateBy(scale, translate) {
|
|
7639
|
+
this._matrix.scale(scale.x, scale.y);
|
|
7640
|
+
this._matrix.translate(translate.x, translate.y);
|
|
7641
|
+
}
|
|
7642
|
+
applyTransformMany(op) {
|
|
7643
|
+
if (op.method === "applyMatrix") {
|
|
7644
|
+
this._matrix.scale(op.matrix.scaleX, op.matrix.scaleY);
|
|
7645
|
+
this._matrix.translate(op.matrix.translateX, op.matrix.translateY);
|
|
7646
|
+
} else if (op.method === "scaleByTranslateBy") {
|
|
7647
|
+
this.applyScaleByTranslateBy(op.scale, op.translate);
|
|
7648
|
+
} else if (op.method === "scaleBy") {
|
|
7649
|
+
this.applyScaleBy(op.x, op.y);
|
|
7650
|
+
} else if (op.method === "translateBy") {
|
|
7651
|
+
this.applyTranslateBy(op.x, op.y);
|
|
7652
|
+
} else if (op.method === "translateTo") {
|
|
7653
|
+
this.applyTranslateTo(op.x, op.y);
|
|
7654
|
+
}
|
|
7655
|
+
}
|
|
7656
|
+
applyScaleByRelativeTo(x, y, point) {
|
|
7657
|
+
const scaleX = this._matrix.scaleX * x;
|
|
7658
|
+
const scaleY = this._matrix.scaleY * y;
|
|
7659
|
+
this._matrix.translateX = -point.x * scaleX + point.x;
|
|
7660
|
+
this._matrix.translateY = -point.y * scaleY + point.y;
|
|
7661
|
+
this._matrix.scaleX = scaleX;
|
|
7662
|
+
this._matrix.scaleY = scaleY;
|
|
7663
|
+
}
|
|
7664
|
+
applyScaleToRelativeTo(x, y, point) {
|
|
7665
|
+
this.applyTranslateBy(-point.x, -point.y);
|
|
7666
|
+
this.applyScaleTo(x, y);
|
|
7667
|
+
this.applyTranslateBy(point.x, point.y);
|
|
7668
|
+
}
|
|
7669
|
+
applyRotateTo(degree) {
|
|
7670
|
+
if (degree > 0) {
|
|
7671
|
+
while (degree > 360) {
|
|
7672
|
+
degree -= 360;
|
|
7673
|
+
}
|
|
7674
|
+
if (degree === 360) {
|
|
7675
|
+
degree = 0;
|
|
7676
|
+
}
|
|
7677
|
+
} else {
|
|
7678
|
+
while (degree < -360) {
|
|
7679
|
+
degree += 360;
|
|
7680
|
+
}
|
|
7681
|
+
if (degree === -360) {
|
|
7682
|
+
degree = 0;
|
|
7683
|
+
}
|
|
7684
|
+
}
|
|
7685
|
+
this.rotate = degree;
|
|
7686
|
+
}
|
|
7687
|
+
applyRotateBy(degree) {
|
|
7688
|
+
this.applyRotateTo(this.rotate + degree);
|
|
7689
|
+
}
|
|
7690
|
+
applyLocked(locked) {
|
|
7691
|
+
this.isLocked = locked;
|
|
7692
|
+
}
|
|
7693
|
+
applyUnlocked(locked) {
|
|
7694
|
+
this.isLocked = locked;
|
|
7695
|
+
}
|
|
7661
7696
|
}
|
|
7662
7697
|
// src/Items/DrawingContext.ts
|
|
7663
7698
|
class DrawingContext {
|
|
@@ -19095,12 +19130,11 @@ class Comment {
|
|
|
19095
19130
|
});
|
|
19096
19131
|
}
|
|
19097
19132
|
transform() {
|
|
19098
|
-
const
|
|
19099
|
-
if (
|
|
19100
|
-
this.anchor = new Point(
|
|
19133
|
+
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
19134
|
+
if (translateX && translateY) {
|
|
19135
|
+
this.anchor = new Point(translateX, translateY);
|
|
19101
19136
|
} else {
|
|
19102
|
-
|
|
19103
|
-
matrix.translateY = this.anchor.y;
|
|
19137
|
+
this.transformation.setLocal(this.anchor.x, this.anchor.y);
|
|
19104
19138
|
}
|
|
19105
19139
|
}
|
|
19106
19140
|
getUnreadMessages(userId = ANONYMOUS_ID) {
|
|
@@ -19209,7 +19243,7 @@ class Comment {
|
|
|
19209
19243
|
render(context) {}
|
|
19210
19244
|
renderHTML(documentFactory) {
|
|
19211
19245
|
const div = documentFactory.createElement("comment-item");
|
|
19212
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
19246
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
19213
19247
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
19214
19248
|
div.style.transformOrigin = "top left";
|
|
19215
19249
|
div.style.transform = transform;
|
|
@@ -21735,7 +21769,7 @@ class BaseItem extends Mbr {
|
|
|
21735
21769
|
}
|
|
21736
21770
|
renderHTML(documentFactory) {
|
|
21737
21771
|
const div = documentFactory.createElement("base-item");
|
|
21738
|
-
const { translateX, translateY } = this.transformation.
|
|
21772
|
+
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
21739
21773
|
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
21740
21774
|
div.style.backgroundColor = "#b2b0c3";
|
|
21741
21775
|
div.id = this.getId();
|
|
@@ -21877,7 +21911,7 @@ class RichText extends BaseItem {
|
|
|
21877
21911
|
mbr.right += 20;
|
|
21878
21912
|
mbr.bottom += 20;
|
|
21879
21913
|
}
|
|
21880
|
-
const linkMbr = mbr.getTransformed(this.transformation.
|
|
21914
|
+
const linkMbr = mbr.getTransformed(this.transformation.toMatrix());
|
|
21881
21915
|
if (linkMbr.isUnderPoint(point3)) {
|
|
21882
21916
|
return { hyperLink, linkMbr };
|
|
21883
21917
|
}
|
|
@@ -22074,12 +22108,13 @@ class RichText extends BaseItem {
|
|
|
22074
22108
|
return this.shrinkWidth;
|
|
22075
22109
|
}
|
|
22076
22110
|
getTransformedContainer() {
|
|
22077
|
-
let matrix = this.transformation.matrix;
|
|
22078
22111
|
if (this.insideOf === "Frame") {
|
|
22112
|
+
const { translateX, translateY, scaleX } = this.transformation.getMatrixData();
|
|
22079
22113
|
const scaleY = this.getMbr().getHeight() * 2 / 10;
|
|
22080
|
-
matrix = new Matrix2(
|
|
22114
|
+
const matrix = new Matrix2(translateX, translateY, scaleX, scaleY);
|
|
22115
|
+
return this.container.getTransformed(matrix);
|
|
22081
22116
|
}
|
|
22082
|
-
return this.container.getTransformed(
|
|
22117
|
+
return this.container.getTransformed(this.transformation.toMatrix());
|
|
22083
22118
|
}
|
|
22084
22119
|
emitWithoutApplying = (op) => {
|
|
22085
22120
|
if (this.board.events) {
|
|
@@ -22440,7 +22475,7 @@ class RichText extends BaseItem {
|
|
|
22440
22475
|
ctx.translate(this.left, this.top);
|
|
22441
22476
|
const shouldScale = !this.isInShape && !this.autoSize;
|
|
22442
22477
|
if (shouldScale) {
|
|
22443
|
-
const { scaleX, scaleY } = this.transformation.
|
|
22478
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22444
22479
|
ctx.scale(scaleX, scaleY);
|
|
22445
22480
|
}
|
|
22446
22481
|
const shouldClip = this.insideOf === "Shape" || this.insideOf === "Sticker";
|
|
@@ -22573,7 +22608,7 @@ class RichText extends BaseItem {
|
|
|
22573
22608
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
22574
22609
|
};
|
|
22575
22610
|
const elements = this.editor.editor.children.map(renderNode);
|
|
22576
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
22611
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
22577
22612
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
22578
22613
|
const transformedWidth = this.getTransformedContainer().getWidth();
|
|
22579
22614
|
const transformedHeight = this.getTransformedContainer().getHeight();
|
|
@@ -35805,17 +35840,17 @@ class AINode extends BaseItem {
|
|
|
35805
35840
|
}
|
|
35806
35841
|
transformPath() {
|
|
35807
35842
|
const { left, right, top, bottom } = this.text.getTransformedContainer();
|
|
35808
|
-
const { scaleX, scaleY } = this.transformation.
|
|
35843
|
+
const { scaleX, scaleY, translateX: nodeTranslateX, translateY: nodeTranslateY } = this.transformation.getMatrixData();
|
|
35809
35844
|
const minScale = Math.min(scaleX, scaleY);
|
|
35810
35845
|
const leftOffset = 20 * minScale;
|
|
35811
35846
|
const topOffset = 20 * minScale;
|
|
35812
35847
|
const nodeRight = right + 80 * minScale;
|
|
35813
35848
|
const nodeBottom = bottom + (bottom - top > 400 ? 60 : 40) * minScale;
|
|
35814
35849
|
if (!this.path || this.text.left < this.path.getMbr().left + leftOffset && this.text.top < this.path.getMbr().top + topOffset) {
|
|
35815
|
-
this.text.left =
|
|
35816
|
-
this.text.top =
|
|
35850
|
+
this.text.left = nodeTranslateX + leftOffset;
|
|
35851
|
+
this.text.top = nodeTranslateY + topOffset;
|
|
35817
35852
|
}
|
|
35818
|
-
this.path = createNodePath(new Mbr(left, top, nodeRight, nodeBottom), this.transformation.
|
|
35853
|
+
this.path = createNodePath(new Mbr(left, top, nodeRight, nodeBottom), this.transformation.toMatrix());
|
|
35819
35854
|
const scaledSize = BUTTON_SIZE * minScale;
|
|
35820
35855
|
this.buttonMbr = new Mbr(nodeRight - scaledSize * 2, nodeBottom - scaledSize * 2, nodeRight - scaledSize, nodeBottom - scaledSize);
|
|
35821
35856
|
}
|
|
@@ -35976,7 +36011,7 @@ class AINode extends BaseItem {
|
|
|
35976
36011
|
}
|
|
35977
36012
|
renderHTML(documentFactory) {
|
|
35978
36013
|
const div = documentFactory.createElement("ainode-item");
|
|
35979
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
36014
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
35980
36015
|
const mbr = this.getMbr();
|
|
35981
36016
|
const width = mbr.getWidth();
|
|
35982
36017
|
const height = mbr.getHeight();
|
|
@@ -37449,7 +37484,7 @@ class Connector2 extends BaseItem {
|
|
|
37449
37484
|
}
|
|
37450
37485
|
renderHTML(documentFactory) {
|
|
37451
37486
|
const div = documentFactory.createElement("connector-item");
|
|
37452
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
37487
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
37453
37488
|
const mbr = this.getMbr();
|
|
37454
37489
|
const width = mbr.getWidth();
|
|
37455
37490
|
const height = mbr.getHeight();
|
|
@@ -37514,7 +37549,7 @@ class Connector2 extends BaseItem {
|
|
|
37514
37549
|
return div;
|
|
37515
37550
|
}
|
|
37516
37551
|
renderPathHTML(documentFactory, path2) {
|
|
37517
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
37552
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
37518
37553
|
const pathElement = path2.renderHTML(documentFactory);
|
|
37519
37554
|
const paths = Array.isArray(pathElement) ? pathElement : [pathElement];
|
|
37520
37555
|
paths.forEach((element4) => {
|
|
@@ -37536,8 +37571,7 @@ class Connector2 extends BaseItem {
|
|
|
37536
37571
|
text5.transformation = undefined;
|
|
37537
37572
|
const mbr = this.getMbr();
|
|
37538
37573
|
const transformation = new Transformation;
|
|
37539
|
-
transformation.
|
|
37540
|
-
transformation.matrix.translateY = mbr.top;
|
|
37574
|
+
transformation.setLocal(mbr.left, mbr.top);
|
|
37541
37575
|
return {
|
|
37542
37576
|
itemType: "Connector",
|
|
37543
37577
|
transformation: transformation.serialize(),
|
|
@@ -37617,7 +37651,7 @@ class Connector2 extends BaseItem {
|
|
|
37617
37651
|
previous2.translateX = 0;
|
|
37618
37652
|
previous2.translateY = 0;
|
|
37619
37653
|
previous2.invert();
|
|
37620
|
-
const currUnscaled = this.transformation.
|
|
37654
|
+
const currUnscaled = this.transformation.toMatrix();
|
|
37621
37655
|
currUnscaled.translateX = 0;
|
|
37622
37656
|
currUnscaled.translateY = 0;
|
|
37623
37657
|
const delta = previous2.multiplyByMatrix(currUnscaled);
|
|
@@ -37644,7 +37678,7 @@ class Connector2 extends BaseItem {
|
|
|
37644
37678
|
previous2.scaleX = 1;
|
|
37645
37679
|
previous2.scaleY = 1;
|
|
37646
37680
|
previous2.invert();
|
|
37647
|
-
const currUnscaled = this.transformation.
|
|
37681
|
+
const currUnscaled = this.transformation.toMatrix();
|
|
37648
37682
|
currUnscaled.scaleX = 1;
|
|
37649
37683
|
currUnscaled.scaleY = 1;
|
|
37650
37684
|
const delta = previous2.multiplyByMatrix(currUnscaled);
|
|
@@ -39611,7 +39645,7 @@ class Shape extends BaseItem {
|
|
|
39611
39645
|
}
|
|
39612
39646
|
renderHTML(documentFactory) {
|
|
39613
39647
|
const div = documentFactory.createElement("shape-item");
|
|
39614
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
39648
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
39615
39649
|
const mbr = this.getMbr();
|
|
39616
39650
|
const width = mbr.getWidth();
|
|
39617
39651
|
const height = mbr.getHeight();
|
|
@@ -39700,8 +39734,8 @@ class Shape extends BaseItem {
|
|
|
39700
39734
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
39701
39735
|
this.textContainer = Shapes[this.shapeType].textBounds.copy();
|
|
39702
39736
|
this.text.setContainer(this.textContainer.copy());
|
|
39703
|
-
this.textContainer.transform(this.transformation.
|
|
39704
|
-
this.path.transform(this.transformation.
|
|
39737
|
+
this.textContainer.transform(this.transformation.toMatrix());
|
|
39738
|
+
this.path.transform(this.transformation.toMatrix());
|
|
39705
39739
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
39706
39740
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
39707
39741
|
this.path.setBorderColor(this.borderColor);
|
|
@@ -39716,7 +39750,7 @@ class Shape extends BaseItem {
|
|
|
39716
39750
|
const anchorPoints = Shapes[this.shapeType].anchorPoints;
|
|
39717
39751
|
const points = [];
|
|
39718
39752
|
for (const anchorPoint of anchorPoints) {
|
|
39719
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
39753
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
39720
39754
|
}
|
|
39721
39755
|
return points;
|
|
39722
39756
|
}
|
|
@@ -39886,10 +39920,9 @@ class Sticker extends BaseItem {
|
|
|
39886
39920
|
}
|
|
39887
39921
|
this.stickerPath = StickerShape.stickerPath.copy();
|
|
39888
39922
|
this.textContainer = StickerShape.textBounds.copy();
|
|
39889
|
-
|
|
39890
|
-
this.stickerPath.transform(matrix);
|
|
39923
|
+
this.stickerPath.transform(this.transformation.toMatrix());
|
|
39891
39924
|
this.text.setContainer(this.textContainer.copy());
|
|
39892
|
-
this.textContainer.transform(this.transformation.
|
|
39925
|
+
this.textContainer.transform(this.transformation.toMatrix());
|
|
39893
39926
|
this.stickerPath.setBackgroundColor(this.backgroundColor);
|
|
39894
39927
|
this.saveStickerData();
|
|
39895
39928
|
}
|
|
@@ -39990,7 +40023,7 @@ class Sticker extends BaseItem {
|
|
|
39990
40023
|
}
|
|
39991
40024
|
renderHTML(documentFactory) {
|
|
39992
40025
|
const div = documentFactory.createElement("sticker-item");
|
|
39993
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
40026
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
39994
40027
|
const transform = `translate(${Math.round(translateX)}px, ${Math.round(translateY)}px) scale(${scaleX}, ${scaleY})`;
|
|
39995
40028
|
const itemMbr = this.getMbr();
|
|
39996
40029
|
const height2 = itemMbr.getHeight();
|
|
@@ -40071,7 +40104,7 @@ class Sticker extends BaseItem {
|
|
|
40071
40104
|
const anchorPoints = StickerShape.anchorPoints;
|
|
40072
40105
|
const points = [];
|
|
40073
40106
|
for (const anchorPoint of anchorPoints) {
|
|
40074
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
40107
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
40075
40108
|
}
|
|
40076
40109
|
return points;
|
|
40077
40110
|
}
|
|
@@ -40085,20 +40118,7 @@ class Sticker extends BaseItem {
|
|
|
40085
40118
|
if (line.end.y < line.start.y) {
|
|
40086
40119
|
y -= l * height;
|
|
40087
40120
|
}
|
|
40088
|
-
this.transformation.
|
|
40089
|
-
class: "Transformation",
|
|
40090
|
-
method: "translateTo",
|
|
40091
|
-
item: [this.id],
|
|
40092
|
-
x,
|
|
40093
|
-
y
|
|
40094
|
-
});
|
|
40095
|
-
this.transformation.apply({
|
|
40096
|
-
class: "Transformation",
|
|
40097
|
-
method: "scaleTo",
|
|
40098
|
-
item: [this.id],
|
|
40099
|
-
x: l,
|
|
40100
|
-
y: l
|
|
40101
|
-
});
|
|
40121
|
+
this.transformation.setLocal(x, y, l, l);
|
|
40102
40122
|
this.saveStickerData();
|
|
40103
40123
|
}
|
|
40104
40124
|
applyTransformToCenter(pt, newWidth) {
|
|
@@ -40106,35 +40126,9 @@ class Sticker extends BaseItem {
|
|
|
40106
40126
|
const scale = newWidth / width;
|
|
40107
40127
|
const w = width * scale;
|
|
40108
40128
|
const h2 = height * scale;
|
|
40109
|
-
this.transformation.
|
|
40110
|
-
class: "Transformation",
|
|
40111
|
-
method: "translateTo",
|
|
40112
|
-
item: [this.id],
|
|
40113
|
-
x: pt.x - w / 2,
|
|
40114
|
-
y: pt.y - h2 / 2
|
|
40115
|
-
});
|
|
40116
|
-
this.transformation.apply({
|
|
40117
|
-
class: "Transformation",
|
|
40118
|
-
method: "scaleTo",
|
|
40119
|
-
item: [this.id],
|
|
40120
|
-
x: scale,
|
|
40121
|
-
y: scale
|
|
40122
|
-
});
|
|
40129
|
+
this.transformation.setLocal(pt.x - w / 2, pt.y - h2 / 2, scale, scale);
|
|
40123
40130
|
} else {
|
|
40124
|
-
this.transformation.
|
|
40125
|
-
class: "Transformation",
|
|
40126
|
-
method: "translateTo",
|
|
40127
|
-
item: [this.id],
|
|
40128
|
-
x: pt.x - width / 2,
|
|
40129
|
-
y: pt.y - height / 2
|
|
40130
|
-
});
|
|
40131
|
-
this.transformation.apply({
|
|
40132
|
-
class: "Transformation",
|
|
40133
|
-
method: "scaleTo",
|
|
40134
|
-
item: [this.id],
|
|
40135
|
-
x: 1,
|
|
40136
|
-
y: 1
|
|
40137
|
-
});
|
|
40131
|
+
this.transformation.setLocal(pt.x - width / 2, pt.y - height / 2, 1, 1);
|
|
40138
40132
|
}
|
|
40139
40133
|
}
|
|
40140
40134
|
doResize(resizeType, pointer, mbr, opposite, startMbr, timeStamp) {
|
|
@@ -40440,7 +40434,7 @@ class Frame2 extends BaseItem {
|
|
|
40440
40434
|
const res = this.getCanChangeRatio() ? getResize(resizeType, pointer, mbr, opposite) : getProportionalResize(resizeType, pointer, mbr, opposite);
|
|
40441
40435
|
if (!res) {
|
|
40442
40436
|
return {
|
|
40443
|
-
matrix: this.transformation.
|
|
40437
|
+
matrix: this.transformation.toMatrix(),
|
|
40444
40438
|
mbr: this.getMbr()
|
|
40445
40439
|
};
|
|
40446
40440
|
}
|
|
@@ -40539,8 +40533,9 @@ class Frame2 extends BaseItem {
|
|
|
40539
40533
|
return this;
|
|
40540
40534
|
}
|
|
40541
40535
|
getSavedProportionsMatrix() {
|
|
40542
|
-
const
|
|
40543
|
-
const
|
|
40536
|
+
const { scaleX, scaleY } = this.transformation.getMatrixData();
|
|
40537
|
+
const newScale = Math.min(scaleX, scaleY);
|
|
40538
|
+
const newMatrix = this.transformation.toMatrix();
|
|
40544
40539
|
newMatrix.scaleX = newScale;
|
|
40545
40540
|
newMatrix.scaleY = newScale;
|
|
40546
40541
|
return newMatrix;
|
|
@@ -40554,8 +40549,8 @@ class Frame2 extends BaseItem {
|
|
|
40554
40549
|
this.textContainer.transform(newMatrix);
|
|
40555
40550
|
this.transformation.applyScaleTo(newMatrix.scaleX, newMatrix.scaleY);
|
|
40556
40551
|
} else {
|
|
40557
|
-
this.path.transform(this.transformation.
|
|
40558
|
-
this.textContainer.transform(this.transformation.
|
|
40552
|
+
this.path.transform(this.transformation.toMatrix());
|
|
40553
|
+
this.textContainer.transform(this.transformation.toMatrix());
|
|
40559
40554
|
}
|
|
40560
40555
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
40561
40556
|
this.path.setBackgroundOpacity(this.backgroundOpacity);
|
|
@@ -40611,7 +40606,7 @@ class Frame2 extends BaseItem {
|
|
|
40611
40606
|
const anchorPoints = Frames[this.shapeType].anchorPoints;
|
|
40612
40607
|
const points = [];
|
|
40613
40608
|
for (const anchorPoint of anchorPoints) {
|
|
40614
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
40609
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
40615
40610
|
}
|
|
40616
40611
|
return points;
|
|
40617
40612
|
}
|
|
@@ -40787,7 +40782,7 @@ class Frame2 extends BaseItem {
|
|
|
40787
40782
|
div.style.borderColor = this.borderColor;
|
|
40788
40783
|
div.style.borderWidth = `${this.borderWidth}px`;
|
|
40789
40784
|
div.style.borderStyle = this.borderStyle;
|
|
40790
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
40785
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
40791
40786
|
const transform = `translate(${Math.round(translateX)}px, ${Math.round(translateY)}px) scale(1, 1)`;
|
|
40792
40787
|
const width2 = this.getMbr().getWidth();
|
|
40793
40788
|
const height2 = this.getMbr().getHeight();
|
|
@@ -41100,13 +41095,13 @@ class VideoItem extends BaseItem {
|
|
|
41100
41095
|
this.shootLoadCallbacks();
|
|
41101
41096
|
};
|
|
41102
41097
|
updateMbr() {
|
|
41103
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41098
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41104
41099
|
this.left = translateX;
|
|
41105
41100
|
this.top = translateY;
|
|
41106
41101
|
this.right = this.left + this.videoDimension.width * scaleX;
|
|
41107
41102
|
this.bottom = this.top + this.videoDimension.height * scaleY;
|
|
41108
41103
|
const playBtnSize = 50;
|
|
41109
|
-
const scaledPlayBtn = playBtnSize * this.transformation.
|
|
41104
|
+
const scaledPlayBtn = playBtnSize * this.transformation.getMatrixData().scaleX;
|
|
41110
41105
|
this.playBtnMbr = new Mbr(this.left + this.getWidth() / 2 - scaledPlayBtn / 2, this.top + this.getHeight() / 2 - scaledPlayBtn / 2, this.right - this.getWidth() / 2 + scaledPlayBtn / 2, this.bottom - this.getHeight() / 2 + scaledPlayBtn / 2);
|
|
41111
41106
|
}
|
|
41112
41107
|
render(context) {
|
|
@@ -41122,7 +41117,7 @@ class VideoItem extends BaseItem {
|
|
|
41122
41117
|
return;
|
|
41123
41118
|
}
|
|
41124
41119
|
ctx.save();
|
|
41125
|
-
this.transformation.
|
|
41120
|
+
this.transformation.applyToContext(ctx);
|
|
41126
41121
|
ctx.drawImage(this.preview, 0, 0);
|
|
41127
41122
|
if (this.shouldShowControls && this.previewUrl) {
|
|
41128
41123
|
ctx.restore();
|
|
@@ -41143,7 +41138,7 @@ class VideoItem extends BaseItem {
|
|
|
41143
41138
|
}
|
|
41144
41139
|
renderHTML(documentFactory) {
|
|
41145
41140
|
const div = documentFactory.createElement("video-item");
|
|
41146
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41141
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41147
41142
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
41148
41143
|
div.style.backgroundImage = this.previewUrl ? `url(${this.previewUrl})` : `url(${createPlaceholderImage(this.videoDimension.width, this.videoDimension.height).src})`;
|
|
41149
41144
|
div.id = this.getId();
|
|
@@ -41601,7 +41596,7 @@ class AudioItem extends BaseItem {
|
|
|
41601
41596
|
this.shootLoadCallbacks();
|
|
41602
41597
|
};
|
|
41603
41598
|
updateMbr() {
|
|
41604
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41599
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41605
41600
|
this.left = translateX;
|
|
41606
41601
|
this.top = translateY;
|
|
41607
41602
|
this.right = this.left + conf.AUDIO_DIMENSIONS.width * scaleX;
|
|
@@ -41631,7 +41626,7 @@ class AudioItem extends BaseItem {
|
|
|
41631
41626
|
}
|
|
41632
41627
|
renderHTML(documentFactory) {
|
|
41633
41628
|
const div = documentFactory.createElement("audio-item");
|
|
41634
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
41629
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
41635
41630
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
41636
41631
|
div.id = this.getId();
|
|
41637
41632
|
div.style.width = `${conf.AUDIO_DIMENSIONS.width}px`;
|
|
@@ -41983,7 +41978,7 @@ class Placeholder extends BaseItem {
|
|
|
41983
41978
|
const anchorPoints = Shapes[this.shapeType].anchorPoints;
|
|
41984
41979
|
const points = [];
|
|
41985
41980
|
for (const anchorPoint of anchorPoints) {
|
|
41986
|
-
points.push(anchorPoint.getTransformed(this.transformation.
|
|
41981
|
+
points.push(anchorPoint.getTransformed(this.transformation.toMatrix()));
|
|
41987
41982
|
}
|
|
41988
41983
|
return points;
|
|
41989
41984
|
}
|
|
@@ -42001,7 +41996,7 @@ class Placeholder extends BaseItem {
|
|
|
42001
41996
|
}
|
|
42002
41997
|
transformPath() {
|
|
42003
41998
|
this.path = Shapes[this.shapeType].createPath(this.mbr);
|
|
42004
|
-
this.path.transform(this.transformation.
|
|
41999
|
+
this.path.transform(this.transformation.toMatrix());
|
|
42005
42000
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
42006
42001
|
this.path.setBorderColor("transparent");
|
|
42007
42002
|
}
|
|
@@ -42197,7 +42192,7 @@ class ImageItem extends BaseItem {
|
|
|
42197
42192
|
this.subject.publish(this);
|
|
42198
42193
|
};
|
|
42199
42194
|
updateMbr() {
|
|
42200
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
42195
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
42201
42196
|
const rotation = this.transformation.getRotation();
|
|
42202
42197
|
const width2 = this.image.width * scaleX;
|
|
42203
42198
|
const height2 = this.image.height * scaleY;
|
|
@@ -42240,10 +42235,11 @@ class ImageItem extends BaseItem {
|
|
|
42240
42235
|
};
|
|
42241
42236
|
}
|
|
42242
42237
|
setCoordinates() {
|
|
42243
|
-
|
|
42244
|
-
this.
|
|
42245
|
-
this.
|
|
42246
|
-
this.
|
|
42238
|
+
const { translateX: coordX, translateY: coordY, scaleX: coordScaleX, scaleY: coordScaleY } = this.transformation.getMatrixData();
|
|
42239
|
+
this.left = coordX;
|
|
42240
|
+
this.top = coordY;
|
|
42241
|
+
this.right = this.left + this.image.width * coordScaleX;
|
|
42242
|
+
this.bottom = this.top + this.image.height * coordScaleY;
|
|
42247
42243
|
this.subject.publish(this);
|
|
42248
42244
|
}
|
|
42249
42245
|
shootBeforeLoadCallbacks() {
|
|
@@ -42310,7 +42306,7 @@ class ImageItem extends BaseItem {
|
|
|
42310
42306
|
}
|
|
42311
42307
|
const ctx = context.ctx;
|
|
42312
42308
|
ctx.save();
|
|
42313
|
-
this.transformation.
|
|
42309
|
+
this.transformation.applyToContext(ctx);
|
|
42314
42310
|
const rotation = this.transformation.getRotation();
|
|
42315
42311
|
if (rotation !== 0) {
|
|
42316
42312
|
const imgWidth = this.image.width || 0;
|
|
@@ -42328,7 +42324,7 @@ class ImageItem extends BaseItem {
|
|
|
42328
42324
|
}
|
|
42329
42325
|
renderHTML(documentFactory) {
|
|
42330
42326
|
const div = documentFactory.createElement("image-item");
|
|
42331
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
42327
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
42332
42328
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
42333
42329
|
div.style.backgroundImage = `url(${this.storageLink})`;
|
|
42334
42330
|
div.id = this.getId();
|
|
@@ -42481,7 +42477,7 @@ class Drawing extends BaseItem {
|
|
|
42481
42477
|
untransformedMbr.top -= offset;
|
|
42482
42478
|
untransformedMbr.right += offset;
|
|
42483
42479
|
untransformedMbr.bottom += offset;
|
|
42484
|
-
const mbr = untransformedMbr.getTransformed(this.transformation.
|
|
42480
|
+
const mbr = untransformedMbr.getTransformed(this.transformation.toMatrix());
|
|
42485
42481
|
this.left = mbr.left;
|
|
42486
42482
|
this.top = mbr.top;
|
|
42487
42483
|
this.right = mbr.right;
|
|
@@ -42528,7 +42524,7 @@ class Drawing extends BaseItem {
|
|
|
42528
42524
|
}
|
|
42529
42525
|
updateLines() {
|
|
42530
42526
|
this.lines = [];
|
|
42531
|
-
const matrix = this.transformation.
|
|
42527
|
+
const matrix = this.transformation.toMatrix();
|
|
42532
42528
|
if (this.points.length < 2) {
|
|
42533
42529
|
return;
|
|
42534
42530
|
}
|
|
@@ -42576,7 +42572,7 @@ class Drawing extends BaseItem {
|
|
|
42576
42572
|
ctx.lineWidth = this.strokeWidth;
|
|
42577
42573
|
ctx.lineCap = "round";
|
|
42578
42574
|
ctx.setLineDash(this.linePattern);
|
|
42579
|
-
this.transformation.
|
|
42575
|
+
this.transformation.applyToContext(ctx);
|
|
42580
42576
|
ctx.stroke(this.path2d.nativePath);
|
|
42581
42577
|
ctx.restore();
|
|
42582
42578
|
if (this.getLinkTo()) {
|
|
@@ -42586,7 +42582,7 @@ class Drawing extends BaseItem {
|
|
|
42586
42582
|
}
|
|
42587
42583
|
renderHTML(documentFactory) {
|
|
42588
42584
|
const div = documentFactory.createElement("drawing-item");
|
|
42589
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
42585
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
42590
42586
|
const mbr = this.getMbr();
|
|
42591
42587
|
const width2 = mbr.getWidth();
|
|
42592
42588
|
const height2 = mbr.getHeight();
|
|
@@ -42775,8 +42771,9 @@ class Drawing extends BaseItem {
|
|
|
42775
42771
|
return null;
|
|
42776
42772
|
}
|
|
42777
42773
|
isPointNearLine(point5, threshold = 10) {
|
|
42778
|
-
const
|
|
42779
|
-
const
|
|
42774
|
+
const { translateX: drawingTranslateX, translateY: drawingTranslateY, scaleX: drawingScaleX, scaleY: drawingScaleY } = this.transformation.getMatrixData();
|
|
42775
|
+
const transformedMouseX = (point5.x - drawingTranslateX) / drawingScaleX;
|
|
42776
|
+
const transformedMouseY = (point5.y - drawingTranslateY) / drawingScaleY;
|
|
42780
42777
|
const transformedMouse = new Point(transformedMouseX, transformedMouseY);
|
|
42781
42778
|
for (let i = 0;i < this.points.length - 1; i++) {
|
|
42782
42779
|
const p1 = this.points[i];
|
|
@@ -44103,40 +44100,16 @@ class AddFrame extends BoardTool {
|
|
|
44103
44100
|
this.applyTranslateBy(-this.frame.getMbr().getWidth() / 2, -this.frame.getMbr().getHeight() / 2);
|
|
44104
44101
|
}
|
|
44105
44102
|
applyScaleTo(x, y) {
|
|
44106
|
-
this.frame.transformation.
|
|
44107
|
-
class: "Transformation",
|
|
44108
|
-
method: "scaleTo",
|
|
44109
|
-
item: [this.frame.getId()],
|
|
44110
|
-
x,
|
|
44111
|
-
y
|
|
44112
|
-
});
|
|
44103
|
+
this.frame.transformation.setLocal({ scaleX: x, scaleY: y });
|
|
44113
44104
|
}
|
|
44114
44105
|
applyScaleBy(x, y) {
|
|
44115
|
-
this.frame.transformation.
|
|
44116
|
-
class: "Transformation",
|
|
44117
|
-
method: "scaleBy",
|
|
44118
|
-
item: [this.frame.getId()],
|
|
44119
|
-
x,
|
|
44120
|
-
y
|
|
44121
|
-
});
|
|
44106
|
+
this.frame.transformation.scaleBy(x, y);
|
|
44122
44107
|
}
|
|
44123
44108
|
applyTranslateTo(x, y) {
|
|
44124
|
-
this.frame.transformation.
|
|
44125
|
-
class: "Transformation",
|
|
44126
|
-
method: "translateTo",
|
|
44127
|
-
item: [this.frame.getId()],
|
|
44128
|
-
x,
|
|
44129
|
-
y
|
|
44130
|
-
});
|
|
44109
|
+
this.frame.transformation.setLocal(x, y);
|
|
44131
44110
|
}
|
|
44132
44111
|
applyTranslateBy(x, y) {
|
|
44133
|
-
this.frame.transformation.
|
|
44134
|
-
class: "Transformation",
|
|
44135
|
-
method: "translateBy",
|
|
44136
|
-
item: [this.frame.getId()],
|
|
44137
|
-
x,
|
|
44138
|
-
y
|
|
44139
|
-
});
|
|
44112
|
+
this.frame.transformation.translateBy(x, y);
|
|
44140
44113
|
}
|
|
44141
44114
|
applyAddChildren(children) {
|
|
44142
44115
|
const childrenIds = children.map((child) => {
|
|
@@ -44204,20 +44177,7 @@ class AddShape extends BoardTool {
|
|
|
44204
44177
|
initTransformation(sx, sy) {
|
|
44205
44178
|
sx = sx || this.bounds.getWidth() / 100;
|
|
44206
44179
|
sy = sy || this.bounds.getHeight() / 100;
|
|
44207
|
-
this.shape.transformation.
|
|
44208
|
-
class: "Transformation",
|
|
44209
|
-
method: "translateTo",
|
|
44210
|
-
item: [this.shape.getId()],
|
|
44211
|
-
x: this.bounds.left,
|
|
44212
|
-
y: this.bounds.top
|
|
44213
|
-
});
|
|
44214
|
-
this.shape.transformation.apply({
|
|
44215
|
-
class: "Transformation",
|
|
44216
|
-
method: "scaleTo",
|
|
44217
|
-
item: [this.shape.getId()],
|
|
44218
|
-
x: sx,
|
|
44219
|
-
y: sy
|
|
44220
|
-
});
|
|
44180
|
+
this.shape.transformation.setLocal(this.bounds.left, this.bounds.top, sx, sy);
|
|
44221
44181
|
}
|
|
44222
44182
|
leftButtonDown() {
|
|
44223
44183
|
if (this.type === "None") {
|
|
@@ -44752,7 +44712,7 @@ class ExportSnapshot extends Tool {
|
|
|
44752
44712
|
}
|
|
44753
44713
|
rectMoveTo(x, y) {
|
|
44754
44714
|
this.transformation.translateTo(x, y);
|
|
44755
|
-
this.mbr.transform(this.transformation.
|
|
44715
|
+
this.mbr.transform(this.transformation.toMatrix());
|
|
44756
44716
|
this.board.tools.publish();
|
|
44757
44717
|
}
|
|
44758
44718
|
resize() {
|
|
@@ -46943,20 +46903,7 @@ class ShapeTool extends CustomTool {
|
|
|
46943
46903
|
initTransformation(sx, sy) {
|
|
46944
46904
|
sx = sx || this.bounds.getWidth() / 100;
|
|
46945
46905
|
sy = sy || this.bounds.getHeight() / 100;
|
|
46946
|
-
this.item.transformation.
|
|
46947
|
-
class: "Transformation",
|
|
46948
|
-
method: "translateTo",
|
|
46949
|
-
item: [this.item.getId()],
|
|
46950
|
-
x: this.bounds.left,
|
|
46951
|
-
y: this.bounds.top
|
|
46952
|
-
});
|
|
46953
|
-
this.item.transformation.apply({
|
|
46954
|
-
class: "Transformation",
|
|
46955
|
-
method: "scaleTo",
|
|
46956
|
-
item: [this.item.getId()],
|
|
46957
|
-
x: sx,
|
|
46958
|
-
y: sy
|
|
46959
|
-
});
|
|
46906
|
+
this.item.transformation.setLocal(this.bounds.left, this.bounds.top, sx, sy);
|
|
46960
46907
|
}
|
|
46961
46908
|
pointerDown() {
|
|
46962
46909
|
this.isDown = true;
|
|
@@ -47027,22 +46974,10 @@ class StickerTool extends CustomTool {
|
|
|
47027
46974
|
}
|
|
47028
46975
|
pointerDown() {
|
|
47029
46976
|
const point5 = this.board.pointer.point;
|
|
47030
|
-
this.item.transformation.
|
|
47031
|
-
class: "Transformation",
|
|
47032
|
-
method: "translateTo",
|
|
47033
|
-
item: [this.item.getId()],
|
|
47034
|
-
x: point5.x - this.settings.width / 2,
|
|
47035
|
-
y: point5.y - this.settings.height / 2
|
|
47036
|
-
});
|
|
46977
|
+
this.item.transformation.setLocal(point5.x - this.settings.width / 2, point5.y - this.settings.height / 2);
|
|
47037
46978
|
const width2 = this.item.getWidth();
|
|
47038
46979
|
const height3 = this.item.getHeight();
|
|
47039
|
-
this.item.transformation.
|
|
47040
|
-
class: "Transformation",
|
|
47041
|
-
method: "scaleBy",
|
|
47042
|
-
item: [this.item.getId()],
|
|
47043
|
-
x: width2 / this.settings.width,
|
|
47044
|
-
y: height3 / this.settings.height
|
|
47045
|
-
});
|
|
46980
|
+
this.item.transformation.scaleBy(width2 / this.settings.width, height3 / this.settings.height);
|
|
47046
46981
|
const addedItem = this.board.add(this.item);
|
|
47047
46982
|
this.board.selection.removeAll();
|
|
47048
46983
|
this.board.selection.add(addedItem);
|
|
@@ -47660,7 +47595,7 @@ class Star2 extends BaseItem {
|
|
|
47660
47595
|
}
|
|
47661
47596
|
transformPath() {
|
|
47662
47597
|
this.path = starPath.copy();
|
|
47663
|
-
this.path.transform(this.transformation.
|
|
47598
|
+
this.path.transform(this.transformation.toMatrix());
|
|
47664
47599
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
47665
47600
|
this.path.setBorderColor(this.borderColor);
|
|
47666
47601
|
this.path.setBorderWidth(this.borderWidth);
|
|
@@ -47688,7 +47623,7 @@ class Star2 extends BaseItem {
|
|
|
47688
47623
|
}
|
|
47689
47624
|
renderHTML(documentFactory) {
|
|
47690
47625
|
const div = documentFactory.createElement("star-item");
|
|
47691
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
47626
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
47692
47627
|
const mbr = this.getMbr();
|
|
47693
47628
|
const unscaledWidth = mbr.getWidth() / scaleX;
|
|
47694
47629
|
const unscaledHeight = mbr.getHeight() / scaleY;
|
|
@@ -47775,13 +47710,7 @@ class AddCounter extends StickerTool {
|
|
|
47775
47710
|
const x = (left + right) / 2 - COUNTER_DIMENSIONS.width / 2;
|
|
47776
47711
|
const y = (top + bottom) / 2 - COUNTER_DIMENSIONS.height / 2;
|
|
47777
47712
|
const counter2 = new Counter(this.board, "");
|
|
47778
|
-
counter2.transformation.
|
|
47779
|
-
class: "Transformation",
|
|
47780
|
-
method: "translateTo",
|
|
47781
|
-
item: [counter2.getId()],
|
|
47782
|
-
x,
|
|
47783
|
-
y
|
|
47784
|
-
});
|
|
47713
|
+
counter2.transformation.setLocal(x, y);
|
|
47785
47714
|
const addedCounter = this.board.add(counter2);
|
|
47786
47715
|
this.board.selection.add(addedCounter);
|
|
47787
47716
|
}
|
|
@@ -47821,7 +47750,7 @@ class Counter extends BaseItem {
|
|
|
47821
47750
|
}
|
|
47822
47751
|
}
|
|
47823
47752
|
updateMbr() {
|
|
47824
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
47753
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
47825
47754
|
this.left = translateX;
|
|
47826
47755
|
this.top = translateY;
|
|
47827
47756
|
this.right = this.left + COUNTER_DIMENSIONS.width * scaleX;
|
|
@@ -48018,7 +47947,7 @@ class Card extends BaseItem {
|
|
|
48018
47947
|
}
|
|
48019
47948
|
renderHTML(documentFactory) {
|
|
48020
47949
|
const div = super.renderHTML(documentFactory);
|
|
48021
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
47950
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
48022
47951
|
const transform = `translate(${translateX}px, ${translateY}px) scale(${scaleX}, ${scaleY})`;
|
|
48023
47952
|
div.style.backgroundImage = `url(${this.imageToRender?.src || this.backsideUrl})`;
|
|
48024
47953
|
div.id = this.getId();
|
|
@@ -48032,7 +47961,7 @@ class Card extends BaseItem {
|
|
|
48032
47961
|
return div;
|
|
48033
47962
|
}
|
|
48034
47963
|
updateMbr() {
|
|
48035
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
47964
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
48036
47965
|
const rotation = this.transformation.getRotation();
|
|
48037
47966
|
const height3 = this.dimensions.height * scaleY;
|
|
48038
47967
|
const width2 = this.dimensions.width * scaleX;
|
|
@@ -48183,24 +48112,12 @@ class Deck extends BaseItem {
|
|
|
48183
48112
|
const canAddItem = !this.index?.getById(childId) && foundItem instanceof Card && (typeof this.isPerpendicular === "undefined" || this.isPerpendicular === foundItem.getIsRotatedPerpendicular()) && (!firstCardDimensions || firstCardDimensions.width === foundItem.getDimensions().width && firstCardDimensions.height === foundItem.getDimensions().height);
|
|
48184
48113
|
if (canAddItem) {
|
|
48185
48114
|
this.isPerpendicular = foundItem.getIsRotatedPerpendicular();
|
|
48186
|
-
foundItem.transformation.
|
|
48187
|
-
class: "Transformation",
|
|
48188
|
-
method: "translateTo",
|
|
48189
|
-
item: [this.id],
|
|
48190
|
-
x: this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET),
|
|
48191
|
-
y: this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0)
|
|
48192
|
-
});
|
|
48115
|
+
foundItem.transformation.setLocal(this.left + (this.index?.list().length || 0) * (this.isPerpendicular ? 0 : conf.DECK_HORIZONTAL_OFFSET), this.top + (this.index?.list().length || 0) * (this.isPerpendicular ? conf.DECK_VERTICAL_OFFSET : 0));
|
|
48193
48116
|
if (firstCard) {
|
|
48194
|
-
const { scaleX, scaleY } = foundItem.transformation.
|
|
48195
|
-
const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.
|
|
48117
|
+
const { scaleX, scaleY } = foundItem.transformation.getMatrixData();
|
|
48118
|
+
const { scaleX: targetScaleX, scaleY: targetScaleY } = firstCard.transformation.getMatrixData();
|
|
48196
48119
|
if (scaleX !== targetScaleX || scaleY !== targetScaleY) {
|
|
48197
|
-
foundItem.transformation.
|
|
48198
|
-
class: "Transformation",
|
|
48199
|
-
method: "scaleTo",
|
|
48200
|
-
item: [this.id],
|
|
48201
|
-
x: targetScaleX,
|
|
48202
|
-
y: targetScaleY
|
|
48203
|
-
});
|
|
48120
|
+
foundItem.transformation.setLocal({ scaleX: targetScaleX, scaleY: targetScaleY });
|
|
48204
48121
|
}
|
|
48205
48122
|
}
|
|
48206
48123
|
this.board.selection.remove(foundItem);
|
|
@@ -48302,7 +48219,7 @@ class Deck extends BaseItem {
|
|
|
48302
48219
|
this.subject.publish(this);
|
|
48303
48220
|
}
|
|
48304
48221
|
updateMbr() {
|
|
48305
|
-
const { translateX, translateY } = this.transformation.
|
|
48222
|
+
const { translateX, translateY } = this.transformation.getMatrixData();
|
|
48306
48223
|
const items = this.index.list();
|
|
48307
48224
|
const itemsMbr = items[0]?.getMbr().combine(items.slice(1).map((item) => item.getMbr()));
|
|
48308
48225
|
this.left = translateX;
|
|
@@ -48376,7 +48293,7 @@ class Deck extends BaseItem {
|
|
|
48376
48293
|
if (!topCard) {
|
|
48377
48294
|
return div;
|
|
48378
48295
|
}
|
|
48379
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
48296
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
48380
48297
|
const transform = `translate(${translateX}px, ${translateY}px) scale(1, 1)`;
|
|
48381
48298
|
const topCardElement = topCard.renderHTML(documentFactory);
|
|
48382
48299
|
div.appendChild(topCardElement);
|
|
@@ -48531,13 +48448,7 @@ function createDeck(event, board) {
|
|
|
48531
48448
|
const onlyCards = board.selection.items.isAllItemsType("Card");
|
|
48532
48449
|
if (onlyCards) {
|
|
48533
48450
|
const deck = new Deck(board, "");
|
|
48534
|
-
deck.transformation.
|
|
48535
|
-
class: "Transformation",
|
|
48536
|
-
method: "translateTo",
|
|
48537
|
-
item: [deck.getId()],
|
|
48538
|
-
x: cardsOrDecks[cardsOrDecks.length - 1].left,
|
|
48539
|
-
y: cardsOrDecks[cardsOrDecks.length - 1].top
|
|
48540
|
-
});
|
|
48451
|
+
deck.transformation.setLocal(cardsOrDecks[cardsOrDecks.length - 1].left, cardsOrDecks[cardsOrDecks.length - 1].top);
|
|
48541
48452
|
const addedDeck = board.add(deck);
|
|
48542
48453
|
board.selection.items.removeAll();
|
|
48543
48454
|
addedDeck.addChildItems(cardsOrDecks);
|
|
@@ -48624,7 +48535,7 @@ class Dice extends BaseItem {
|
|
|
48624
48535
|
}
|
|
48625
48536
|
transformPath() {
|
|
48626
48537
|
this.path = createRoundedRectanglePath(this).copy();
|
|
48627
|
-
this.path.transform(this.transformation.
|
|
48538
|
+
this.path.transform(this.transformation.toMatrix());
|
|
48628
48539
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
48629
48540
|
this.path.setBorderColor(this.borderColor);
|
|
48630
48541
|
this.path.setBorderWidth(this.borderWidth);
|
|
@@ -48846,7 +48757,7 @@ class Dice extends BaseItem {
|
|
|
48846
48757
|
}
|
|
48847
48758
|
renderHTML(documentFactory) {
|
|
48848
48759
|
const div = super.renderHTML(documentFactory);
|
|
48849
|
-
const { translateX, translateY, scaleX, scaleY } = this.transformation.
|
|
48760
|
+
const { translateX, translateY, scaleX, scaleY } = this.transformation.getMatrixData();
|
|
48850
48761
|
const mbr = this.getMbr();
|
|
48851
48762
|
const width2 = mbr.getWidth();
|
|
48852
48763
|
const height3 = mbr.getHeight();
|
|
@@ -49097,7 +49008,7 @@ class Screen extends BaseItem {
|
|
|
49097
49008
|
}
|
|
49098
49009
|
transformPath() {
|
|
49099
49010
|
this.path = screenPath.copy();
|
|
49100
|
-
this.path.transform(this.transformation.
|
|
49011
|
+
this.path.transform(this.transformation.toMatrix());
|
|
49101
49012
|
this.path.setBackgroundColor(this.backgroundColor);
|
|
49102
49013
|
this.path.setBorderColor(this.borderColor);
|
|
49103
49014
|
this.path.setBorderWidth(this.borderWidth);
|
|
@@ -51713,8 +51624,8 @@ function handleMultipleItemsResize({
|
|
|
51713
51624
|
let itemX = item.getMbr().left;
|
|
51714
51625
|
let itemY = item.getMbr().top;
|
|
51715
51626
|
if (item.itemType === "Drawing") {
|
|
51716
|
-
itemX = item.transformation.
|
|
51717
|
-
itemY = item.transformation.
|
|
51627
|
+
itemX = item.transformation.getMatrixData().translateX;
|
|
51628
|
+
itemY = item.transformation.getMatrixData().translateY;
|
|
51718
51629
|
}
|
|
51719
51630
|
const deltaX = itemX - initMbr.left;
|
|
51720
51631
|
const translateX = deltaX * matrix.scaleX - deltaX + matrix.translateX;
|