microboard-temp 0.4.27 → 0.4.29
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 +90 -87
- package/dist/cjs/index.js +90 -87
- package/dist/cjs/node.js +90 -87
- package/dist/esm/browser.js +90 -87
- package/dist/esm/index.js +90 -87
- package/dist/esm/node.js +90 -87
- package/dist/types/Events/EventsOperations.d.ts +1 -1
- package/dist/types/Items/Examples/CardGame/Dice/Dice.d.ts +3 -3
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -19463,9 +19463,19 @@ class BaseCommand {
|
|
|
19463
19463
|
const items = this.items;
|
|
19464
19464
|
return mapItemsByOperation(items, (item) => {
|
|
19465
19465
|
const op = this.operation;
|
|
19466
|
+
let newData = {};
|
|
19467
|
+
if (op.prevData) {
|
|
19468
|
+
newData = op.prevData;
|
|
19469
|
+
} else {
|
|
19470
|
+
Object.keys(op.newData).forEach((key) => {
|
|
19471
|
+
if (item[key]) {
|
|
19472
|
+
op.newData[key] = item[key];
|
|
19473
|
+
}
|
|
19474
|
+
});
|
|
19475
|
+
}
|
|
19466
19476
|
return {
|
|
19467
19477
|
...op,
|
|
19468
|
-
newData
|
|
19478
|
+
newData
|
|
19469
19479
|
};
|
|
19470
19480
|
});
|
|
19471
19481
|
}
|
|
@@ -46257,7 +46267,7 @@ class Dice extends BaseItem {
|
|
|
46257
46267
|
if (values2) {
|
|
46258
46268
|
this.values = values2;
|
|
46259
46269
|
}
|
|
46260
|
-
this.
|
|
46270
|
+
this.updateRenderValues();
|
|
46261
46271
|
this.transformPath();
|
|
46262
46272
|
this.transformation.subject.subscribe(() => {
|
|
46263
46273
|
this.transformPath();
|
|
@@ -46273,7 +46283,7 @@ class Dice extends BaseItem {
|
|
|
46273
46283
|
this.path.setBorderColor(this.borderColor);
|
|
46274
46284
|
this.path.setBorderWidth(this.borderWidth);
|
|
46275
46285
|
}
|
|
46276
|
-
|
|
46286
|
+
updateRenderValues() {
|
|
46277
46287
|
this.values.forEach((value, index2) => {
|
|
46278
46288
|
if (typeof value === "number") {
|
|
46279
46289
|
this.renderValues[index2] = value;
|
|
@@ -46348,7 +46358,7 @@ class Dice extends BaseItem {
|
|
|
46348
46358
|
}
|
|
46349
46359
|
deserialize(data) {
|
|
46350
46360
|
super.deserialize(data);
|
|
46351
|
-
this.
|
|
46361
|
+
this.updateRenderValues();
|
|
46352
46362
|
this.transformPath();
|
|
46353
46363
|
this.subject.publish(this);
|
|
46354
46364
|
return this;
|
|
@@ -46455,6 +46465,7 @@ class Dice extends BaseItem {
|
|
|
46455
46465
|
this.valueIndex = 0;
|
|
46456
46466
|
}
|
|
46457
46467
|
this.values = op.newData.values;
|
|
46468
|
+
this.updateRenderValues();
|
|
46458
46469
|
break;
|
|
46459
46470
|
}
|
|
46460
46471
|
break;
|
|
@@ -50525,93 +50536,85 @@ class BoardSelection {
|
|
|
50525
50536
|
}
|
|
50526
50537
|
}
|
|
50527
50538
|
setStrokeColor(borderColor) {
|
|
50528
|
-
const
|
|
50529
|
-
|
|
50530
|
-
|
|
50531
|
-
|
|
50532
|
-
|
|
50533
|
-
|
|
50534
|
-
|
|
50535
|
-
|
|
50536
|
-
|
|
50537
|
-
|
|
50538
|
-
|
|
50539
|
-
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50545
|
-
|
|
50546
|
-
|
|
50547
|
-
|
|
50548
|
-
|
|
50549
|
-
|
|
50550
|
-
|
|
50551
|
-
|
|
50552
|
-
|
|
50553
|
-
|
|
50554
|
-
}
|
|
50539
|
+
const operation = {
|
|
50540
|
+
class: "Shape",
|
|
50541
|
+
method: "setBorderColor",
|
|
50542
|
+
item: [],
|
|
50543
|
+
newData: { borderColor }
|
|
50544
|
+
};
|
|
50545
|
+
const operations2 = {};
|
|
50546
|
+
this.items.list().forEach((item) => {
|
|
50547
|
+
if (!operations2[item.itemType]) {
|
|
50548
|
+
const operationCopy = { ...operation };
|
|
50549
|
+
if (item.itemType === "Connector") {
|
|
50550
|
+
operationCopy.method = "setLineColor";
|
|
50551
|
+
operationCopy.lineColor = borderColor;
|
|
50552
|
+
} else if (item.itemType === "Drawing") {
|
|
50553
|
+
operationCopy.method = "setStrokeColor";
|
|
50554
|
+
operationCopy.color = borderColor;
|
|
50555
|
+
} else {
|
|
50556
|
+
operationCopy.borderColor = borderColor;
|
|
50557
|
+
}
|
|
50558
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50559
|
+
} else {
|
|
50560
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50561
|
+
}
|
|
50562
|
+
});
|
|
50563
|
+
Object.values(operations2).forEach((op) => {
|
|
50564
|
+
this.emit(op);
|
|
50565
|
+
});
|
|
50555
50566
|
}
|
|
50556
50567
|
setStrokeWidth(width2) {
|
|
50557
|
-
const
|
|
50558
|
-
|
|
50559
|
-
|
|
50560
|
-
|
|
50561
|
-
|
|
50562
|
-
|
|
50563
|
-
|
|
50564
|
-
|
|
50565
|
-
|
|
50566
|
-
|
|
50567
|
-
|
|
50568
|
-
|
|
50569
|
-
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50577
|
-
|
|
50578
|
-
|
|
50579
|
-
class:
|
|
50580
|
-
|
|
50581
|
-
item
|
|
50582
|
-
|
|
50583
|
-
|
|
50584
|
-
|
|
50585
|
-
|
|
50568
|
+
const operation = {
|
|
50569
|
+
class: "Shape",
|
|
50570
|
+
method: "setStrokeWidth",
|
|
50571
|
+
item: [],
|
|
50572
|
+
width: width2,
|
|
50573
|
+
newData: { width: width2 }
|
|
50574
|
+
};
|
|
50575
|
+
const operations2 = {};
|
|
50576
|
+
this.items.list().forEach((item) => {
|
|
50577
|
+
if (!operations2[item.itemType]) {
|
|
50578
|
+
const operationCopy = { ...operation };
|
|
50579
|
+
if (item.itemType === "Connector") {
|
|
50580
|
+
operationCopy.method = "setLineWidth";
|
|
50581
|
+
operationCopy.lineWidth = width2;
|
|
50582
|
+
} else if (item.itemType === "Drawing") {
|
|
50583
|
+
operationCopy.method = "setStrokeWidth";
|
|
50584
|
+
operationCopy.width = width2;
|
|
50585
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
50586
|
+
} else {
|
|
50587
|
+
operationCopy.borderWidth = width2;
|
|
50588
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
50589
|
+
}
|
|
50590
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50591
|
+
} else {
|
|
50592
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50593
|
+
}
|
|
50594
|
+
});
|
|
50595
|
+
Object.values(operations2).forEach((op) => {
|
|
50596
|
+
this.emit(op);
|
|
50597
|
+
});
|
|
50586
50598
|
}
|
|
50587
50599
|
setFillColor(backgroundColor) {
|
|
50588
|
-
const
|
|
50589
|
-
|
|
50590
|
-
|
|
50591
|
-
|
|
50592
|
-
|
|
50593
|
-
|
|
50594
|
-
|
|
50595
|
-
|
|
50596
|
-
|
|
50597
|
-
|
|
50598
|
-
|
|
50599
|
-
|
|
50600
|
-
|
|
50601
|
-
|
|
50602
|
-
|
|
50603
|
-
|
|
50604
|
-
|
|
50605
|
-
}
|
|
50606
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
50607
|
-
if (frames.length) {
|
|
50608
|
-
this.emit({
|
|
50609
|
-
class: "Frame",
|
|
50610
|
-
method: "setBackgroundColor",
|
|
50611
|
-
item: frames,
|
|
50612
|
-
backgroundColor
|
|
50613
|
-
});
|
|
50614
|
-
}
|
|
50600
|
+
const operation = {
|
|
50601
|
+
class: "Shape",
|
|
50602
|
+
method: "setBackgroundColor",
|
|
50603
|
+
item: [],
|
|
50604
|
+
backgroundColor,
|
|
50605
|
+
newData: { backgroundColor }
|
|
50606
|
+
};
|
|
50607
|
+
const operations2 = {};
|
|
50608
|
+
this.items.list().forEach((item) => {
|
|
50609
|
+
if (!operations2[item.itemType]) {
|
|
50610
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
50611
|
+
} else {
|
|
50612
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50613
|
+
}
|
|
50614
|
+
});
|
|
50615
|
+
Object.values(operations2).forEach((op) => {
|
|
50616
|
+
this.emit(op);
|
|
50617
|
+
});
|
|
50615
50618
|
}
|
|
50616
50619
|
setCanChangeRatio(canChangeRatio) {
|
|
50617
50620
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
package/dist/cjs/index.js
CHANGED
|
@@ -19463,9 +19463,19 @@ class BaseCommand {
|
|
|
19463
19463
|
const items = this.items;
|
|
19464
19464
|
return mapItemsByOperation(items, (item) => {
|
|
19465
19465
|
const op = this.operation;
|
|
19466
|
+
let newData = {};
|
|
19467
|
+
if (op.prevData) {
|
|
19468
|
+
newData = op.prevData;
|
|
19469
|
+
} else {
|
|
19470
|
+
Object.keys(op.newData).forEach((key) => {
|
|
19471
|
+
if (item[key]) {
|
|
19472
|
+
op.newData[key] = item[key];
|
|
19473
|
+
}
|
|
19474
|
+
});
|
|
19475
|
+
}
|
|
19466
19476
|
return {
|
|
19467
19477
|
...op,
|
|
19468
|
-
newData
|
|
19478
|
+
newData
|
|
19469
19479
|
};
|
|
19470
19480
|
});
|
|
19471
19481
|
}
|
|
@@ -46257,7 +46267,7 @@ class Dice extends BaseItem {
|
|
|
46257
46267
|
if (values2) {
|
|
46258
46268
|
this.values = values2;
|
|
46259
46269
|
}
|
|
46260
|
-
this.
|
|
46270
|
+
this.updateRenderValues();
|
|
46261
46271
|
this.transformPath();
|
|
46262
46272
|
this.transformation.subject.subscribe(() => {
|
|
46263
46273
|
this.transformPath();
|
|
@@ -46273,7 +46283,7 @@ class Dice extends BaseItem {
|
|
|
46273
46283
|
this.path.setBorderColor(this.borderColor);
|
|
46274
46284
|
this.path.setBorderWidth(this.borderWidth);
|
|
46275
46285
|
}
|
|
46276
|
-
|
|
46286
|
+
updateRenderValues() {
|
|
46277
46287
|
this.values.forEach((value, index2) => {
|
|
46278
46288
|
if (typeof value === "number") {
|
|
46279
46289
|
this.renderValues[index2] = value;
|
|
@@ -46348,7 +46358,7 @@ class Dice extends BaseItem {
|
|
|
46348
46358
|
}
|
|
46349
46359
|
deserialize(data) {
|
|
46350
46360
|
super.deserialize(data);
|
|
46351
|
-
this.
|
|
46361
|
+
this.updateRenderValues();
|
|
46352
46362
|
this.transformPath();
|
|
46353
46363
|
this.subject.publish(this);
|
|
46354
46364
|
return this;
|
|
@@ -46455,6 +46465,7 @@ class Dice extends BaseItem {
|
|
|
46455
46465
|
this.valueIndex = 0;
|
|
46456
46466
|
}
|
|
46457
46467
|
this.values = op.newData.values;
|
|
46468
|
+
this.updateRenderValues();
|
|
46458
46469
|
break;
|
|
46459
46470
|
}
|
|
46460
46471
|
break;
|
|
@@ -50525,93 +50536,85 @@ class BoardSelection {
|
|
|
50525
50536
|
}
|
|
50526
50537
|
}
|
|
50527
50538
|
setStrokeColor(borderColor) {
|
|
50528
|
-
const
|
|
50529
|
-
|
|
50530
|
-
|
|
50531
|
-
|
|
50532
|
-
|
|
50533
|
-
|
|
50534
|
-
|
|
50535
|
-
|
|
50536
|
-
|
|
50537
|
-
|
|
50538
|
-
|
|
50539
|
-
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50545
|
-
|
|
50546
|
-
|
|
50547
|
-
|
|
50548
|
-
|
|
50549
|
-
|
|
50550
|
-
|
|
50551
|
-
|
|
50552
|
-
|
|
50553
|
-
|
|
50554
|
-
}
|
|
50539
|
+
const operation = {
|
|
50540
|
+
class: "Shape",
|
|
50541
|
+
method: "setBorderColor",
|
|
50542
|
+
item: [],
|
|
50543
|
+
newData: { borderColor }
|
|
50544
|
+
};
|
|
50545
|
+
const operations2 = {};
|
|
50546
|
+
this.items.list().forEach((item) => {
|
|
50547
|
+
if (!operations2[item.itemType]) {
|
|
50548
|
+
const operationCopy = { ...operation };
|
|
50549
|
+
if (item.itemType === "Connector") {
|
|
50550
|
+
operationCopy.method = "setLineColor";
|
|
50551
|
+
operationCopy.lineColor = borderColor;
|
|
50552
|
+
} else if (item.itemType === "Drawing") {
|
|
50553
|
+
operationCopy.method = "setStrokeColor";
|
|
50554
|
+
operationCopy.color = borderColor;
|
|
50555
|
+
} else {
|
|
50556
|
+
operationCopy.borderColor = borderColor;
|
|
50557
|
+
}
|
|
50558
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50559
|
+
} else {
|
|
50560
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50561
|
+
}
|
|
50562
|
+
});
|
|
50563
|
+
Object.values(operations2).forEach((op) => {
|
|
50564
|
+
this.emit(op);
|
|
50565
|
+
});
|
|
50555
50566
|
}
|
|
50556
50567
|
setStrokeWidth(width2) {
|
|
50557
|
-
const
|
|
50558
|
-
|
|
50559
|
-
|
|
50560
|
-
|
|
50561
|
-
|
|
50562
|
-
|
|
50563
|
-
|
|
50564
|
-
|
|
50565
|
-
|
|
50566
|
-
|
|
50567
|
-
|
|
50568
|
-
|
|
50569
|
-
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50577
|
-
|
|
50578
|
-
|
|
50579
|
-
class:
|
|
50580
|
-
|
|
50581
|
-
item
|
|
50582
|
-
|
|
50583
|
-
|
|
50584
|
-
|
|
50585
|
-
|
|
50568
|
+
const operation = {
|
|
50569
|
+
class: "Shape",
|
|
50570
|
+
method: "setStrokeWidth",
|
|
50571
|
+
item: [],
|
|
50572
|
+
width: width2,
|
|
50573
|
+
newData: { width: width2 }
|
|
50574
|
+
};
|
|
50575
|
+
const operations2 = {};
|
|
50576
|
+
this.items.list().forEach((item) => {
|
|
50577
|
+
if (!operations2[item.itemType]) {
|
|
50578
|
+
const operationCopy = { ...operation };
|
|
50579
|
+
if (item.itemType === "Connector") {
|
|
50580
|
+
operationCopy.method = "setLineWidth";
|
|
50581
|
+
operationCopy.lineWidth = width2;
|
|
50582
|
+
} else if (item.itemType === "Drawing") {
|
|
50583
|
+
operationCopy.method = "setStrokeWidth";
|
|
50584
|
+
operationCopy.width = width2;
|
|
50585
|
+
operationCopy.prevWidth = this.getStrokeWidth();
|
|
50586
|
+
} else {
|
|
50587
|
+
operationCopy.borderWidth = width2;
|
|
50588
|
+
operationCopy.prevBorderWidth = this.getStrokeWidth();
|
|
50589
|
+
}
|
|
50590
|
+
operations2[item.itemType] = { ...operationCopy, class: item.itemType, item: [item.getId()] };
|
|
50591
|
+
} else {
|
|
50592
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50593
|
+
}
|
|
50594
|
+
});
|
|
50595
|
+
Object.values(operations2).forEach((op) => {
|
|
50596
|
+
this.emit(op);
|
|
50597
|
+
});
|
|
50586
50598
|
}
|
|
50587
50599
|
setFillColor(backgroundColor) {
|
|
50588
|
-
const
|
|
50589
|
-
|
|
50590
|
-
|
|
50591
|
-
|
|
50592
|
-
|
|
50593
|
-
|
|
50594
|
-
|
|
50595
|
-
|
|
50596
|
-
|
|
50597
|
-
|
|
50598
|
-
|
|
50599
|
-
|
|
50600
|
-
|
|
50601
|
-
|
|
50602
|
-
|
|
50603
|
-
|
|
50604
|
-
|
|
50605
|
-
}
|
|
50606
|
-
const frames = this.items.getIdsByItemTypes(["Frame"]);
|
|
50607
|
-
if (frames.length) {
|
|
50608
|
-
this.emit({
|
|
50609
|
-
class: "Frame",
|
|
50610
|
-
method: "setBackgroundColor",
|
|
50611
|
-
item: frames,
|
|
50612
|
-
backgroundColor
|
|
50613
|
-
});
|
|
50614
|
-
}
|
|
50600
|
+
const operation = {
|
|
50601
|
+
class: "Shape",
|
|
50602
|
+
method: "setBackgroundColor",
|
|
50603
|
+
item: [],
|
|
50604
|
+
backgroundColor,
|
|
50605
|
+
newData: { backgroundColor }
|
|
50606
|
+
};
|
|
50607
|
+
const operations2 = {};
|
|
50608
|
+
this.items.list().forEach((item) => {
|
|
50609
|
+
if (!operations2[item.itemType]) {
|
|
50610
|
+
operations2[item.itemType] = { ...operation, class: item.itemType, item: [item.getId()] };
|
|
50611
|
+
} else {
|
|
50612
|
+
operations2[item.itemType].item.push(item.getId());
|
|
50613
|
+
}
|
|
50614
|
+
});
|
|
50615
|
+
Object.values(operations2).forEach((op) => {
|
|
50616
|
+
this.emit(op);
|
|
50617
|
+
});
|
|
50615
50618
|
}
|
|
50616
50619
|
setCanChangeRatio(canChangeRatio) {
|
|
50617
50620
|
const frames = this.items.getIdsByItemTypes(["Frame"]);
|