@meta2d/core 1.0.60 → 1.0.62
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/package.json +1 -1
- package/src/canvas/canvas.d.ts +0 -1
- package/src/canvas/canvas.js +37 -21
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/magnifierCanvas.d.ts +2 -0
- package/src/canvas/magnifierCanvas.js +21 -0
- package/src/canvas/magnifierCanvas.js.map +1 -1
- package/src/core.d.ts +7 -2
- package/src/core.js +259 -64
- package/src/core.js.map +1 -1
- package/src/dialog/dialog.js +2 -2
- package/src/dialog/dialog.js.map +1 -1
- package/src/event/event.d.ts +5 -0
- package/src/event/event.js.map +1 -1
- package/src/pen/model.d.ts +12 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.d.ts +1 -0
- package/src/pen/render.js +98 -13
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +4 -1
- package/src/store/store.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.d.ts
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -94,7 +94,7 @@ export class Canvas {
|
|
|
94
94
|
inputParent = document.createElement('div');
|
|
95
95
|
// input = document.createElement('textarea');
|
|
96
96
|
inputDiv = document.createElement('div');
|
|
97
|
-
inputRight = document.createElement('div');
|
|
97
|
+
// inputRight = document.createElement('div');
|
|
98
98
|
dropdown = document.createElement('ul');
|
|
99
99
|
tooltip;
|
|
100
100
|
title;
|
|
@@ -353,7 +353,7 @@ export class Canvas {
|
|
|
353
353
|
}
|
|
354
354
|
let data = JSON.parse(e.data);
|
|
355
355
|
if (typeof data === 'object') {
|
|
356
|
-
this.parent.doMessageEvent(data.name);
|
|
356
|
+
this.parent.doMessageEvent(data.name, data.value);
|
|
357
357
|
}
|
|
358
358
|
else {
|
|
359
359
|
this.parent.doMessageEvent(data);
|
|
@@ -6133,7 +6133,7 @@ export class Canvas {
|
|
|
6133
6133
|
textRect.x + this.store.data.x - (pen.textLeft || 0) + 'px'; //+ 5
|
|
6134
6134
|
this.inputParent.style.top =
|
|
6135
6135
|
textRect.y + this.store.data.y - (pen.textTop || 0) + 'px'; //+ 5
|
|
6136
|
-
let _width = textRect.width
|
|
6136
|
+
let _width = textRect.width; //+ (pen.textLeft || 0);
|
|
6137
6137
|
this.inputParent.style.width = (_width < 0 ? 12 : _width) + 'px'; //(textRect.width < pen.width ? 0 : 10)
|
|
6138
6138
|
this.inputParent.style.height = textRect.height + (pen.textTop || 0) + 'px'; // (textRect.height < pen.height ? 0 : 10)
|
|
6139
6139
|
this.inputParent.style.zIndex = '9999';
|
|
@@ -6149,13 +6149,15 @@ export class Canvas {
|
|
|
6149
6149
|
this.inputDiv.contentEditable =
|
|
6150
6150
|
pen.disableInput == undefined ? 'true' : pen.disableInput.toString();
|
|
6151
6151
|
if (pen.dropdownList && this.dropdown.style.display !== 'block') {
|
|
6152
|
-
if (!this.store.data.locked) {
|
|
6153
|
-
|
|
6154
|
-
}
|
|
6152
|
+
// if (!this.store.data.locked) {
|
|
6153
|
+
// this.inputRight.style.display = 'none';
|
|
6154
|
+
// }
|
|
6155
|
+
this.dropdown.style.background = pen.dropdownBackground || '#fff';
|
|
6156
|
+
this.dropdown.style.color = pen.dropdownColor || '#bdc7db';
|
|
6155
6157
|
this.setDropdownList();
|
|
6156
6158
|
}
|
|
6157
6159
|
else {
|
|
6158
|
-
this.inputRight.style.display = 'none';
|
|
6160
|
+
// this.inputRight.style.display = 'none';
|
|
6159
6161
|
}
|
|
6160
6162
|
this.inputDiv.contentEditable = 'true';
|
|
6161
6163
|
this.inputDiv.focus();
|
|
@@ -6357,7 +6359,7 @@ export class Canvas {
|
|
|
6357
6359
|
pen.text = this.inputDiv.dataset.value;
|
|
6358
6360
|
pen.calculative.text = pen.text;
|
|
6359
6361
|
this.inputDiv.dataset.penId = undefined;
|
|
6360
|
-
if (pen.
|
|
6362
|
+
if (pen.text && pen.textAutoAdjust) {
|
|
6361
6363
|
calcTextAutoWidth(pen);
|
|
6362
6364
|
}
|
|
6363
6365
|
calcTextRect(pen);
|
|
@@ -6383,10 +6385,10 @@ export class Canvas {
|
|
|
6383
6385
|
};
|
|
6384
6386
|
createInput() {
|
|
6385
6387
|
this.inputParent.classList.add('meta2d-input');
|
|
6386
|
-
this.inputRight.classList.add('right');
|
|
6388
|
+
// this.inputRight.classList.add('right');
|
|
6387
6389
|
this.inputDiv.classList.add('input-div');
|
|
6388
6390
|
this.inputParent.appendChild(this.inputDiv);
|
|
6389
|
-
this.inputParent.appendChild(this.inputRight);
|
|
6391
|
+
// this.inputParent.appendChild(this.inputRight);
|
|
6390
6392
|
this.dropdown.onmouseleave = () => {
|
|
6391
6393
|
this.store.hover = null;
|
|
6392
6394
|
};
|
|
@@ -6395,9 +6397,9 @@ export class Canvas {
|
|
|
6395
6397
|
this.inputParent.onmousedown = this.stopPropagation;
|
|
6396
6398
|
this.inputDiv.onmousedown = this.stopPropagation;
|
|
6397
6399
|
this.inputDiv.contentEditable = 'false';
|
|
6398
|
-
this.inputRight.onmousedown = this.stopPropagation;
|
|
6400
|
+
// this.inputRight.onmousedown = this.stopPropagation;
|
|
6399
6401
|
this.dropdown.onmousedown = this.stopPropagation;
|
|
6400
|
-
this.inputRight.style.transform = 'rotate(135deg)';
|
|
6402
|
+
// this.inputRight.style.transform = 'rotate(135deg)';
|
|
6401
6403
|
let sheet;
|
|
6402
6404
|
for (let i = 0; i < document.styleSheets.length; i++) {
|
|
6403
6405
|
if (document.styleSheets[i].title === 'le5le.com') {
|
|
@@ -6491,11 +6493,11 @@ export class Canvas {
|
|
|
6491
6493
|
const pen = this.store.pens[this.inputDiv.dataset.penId];
|
|
6492
6494
|
if (this.dropdown.style.display === 'block') {
|
|
6493
6495
|
this.dropdown.style.display = 'none';
|
|
6494
|
-
this.inputRight.style.transform = 'rotate(135deg)';
|
|
6496
|
+
// this.inputRight.style.transform = 'rotate(135deg)';
|
|
6495
6497
|
}
|
|
6496
6498
|
else if (pen?.dropdownList && this.store.data.locked) {
|
|
6497
6499
|
this.dropdown.style.display = 'block';
|
|
6498
|
-
this.inputRight.style.transform = 'rotate(315deg)';
|
|
6500
|
+
// this.inputRight.style.transform = 'rotate(315deg)';
|
|
6499
6501
|
}
|
|
6500
6502
|
this.store.emitter.emit('clickInput', pen);
|
|
6501
6503
|
};
|
|
@@ -6536,15 +6538,15 @@ export class Canvas {
|
|
|
6536
6538
|
return;
|
|
6537
6539
|
}
|
|
6538
6540
|
this.dropdown.style.display = 'block';
|
|
6539
|
-
this.inputRight.style.display = 'block';
|
|
6540
|
-
setTimeout(() => {
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
});
|
|
6541
|
+
// this.inputRight.style.display = 'block';
|
|
6542
|
+
// setTimeout(() => {
|
|
6543
|
+
// this.inputRight.style.transform = 'rotate(315deg)';
|
|
6544
|
+
// (this.inputRight.style as any).zoom = this.store.data.scale;
|
|
6545
|
+
// });
|
|
6544
6546
|
if (!pen || !pen.dropdownList) {
|
|
6545
6547
|
this.dropdown.style.display = 'none';
|
|
6546
|
-
this.inputRight.style.display = 'none';
|
|
6547
|
-
this.inputRight.style.transform = 'rotate(135deg)';
|
|
6548
|
+
// this.inputRight.style.display = 'none';
|
|
6549
|
+
// this.inputRight.style.transform = 'rotate(135deg)';
|
|
6548
6550
|
return;
|
|
6549
6551
|
}
|
|
6550
6552
|
if (!pen.dropdownList.length) {
|
|
@@ -6597,6 +6599,15 @@ export class Canvas {
|
|
|
6597
6599
|
li.onmousedown = this.stopPropagation;
|
|
6598
6600
|
li.dataset.i = index + '';
|
|
6599
6601
|
li.onclick = this.selectDropdown;
|
|
6602
|
+
const pen = this.store.pens[this.inputDiv.dataset.penId];
|
|
6603
|
+
li.onmouseenter = () => {
|
|
6604
|
+
li.style.background = pen.dropdownHoverBackground || '#eee';
|
|
6605
|
+
li.style.color = pen.dropdownHoverColor || '#bdc7db';
|
|
6606
|
+
};
|
|
6607
|
+
li.onmouseleave = () => {
|
|
6608
|
+
li.style.background = pen.dropdownBackground || '#fff';
|
|
6609
|
+
li.style.color = pen.dropdownColor || '#bdc7db';
|
|
6610
|
+
};
|
|
6600
6611
|
this.dropdown.appendChild(li);
|
|
6601
6612
|
}
|
|
6602
6613
|
selectDropdown = (e) => {
|
|
@@ -7210,11 +7221,16 @@ export class Canvas {
|
|
|
7210
7221
|
this.render();
|
|
7211
7222
|
}
|
|
7212
7223
|
showMagnifier() {
|
|
7224
|
+
this.magnifierCanvas.canvas.style.zIndex = '100';
|
|
7225
|
+
this.externalElements.style.zIndex = '101';
|
|
7213
7226
|
this.magnifierCanvas.magnifier = true;
|
|
7227
|
+
this.magnifierCanvas.updateDomOffscreen();
|
|
7214
7228
|
this.externalElements.style.cursor = 'default';
|
|
7215
7229
|
this.render();
|
|
7216
7230
|
}
|
|
7217
7231
|
hideMagnifier() {
|
|
7232
|
+
this.magnifierCanvas.canvas.style.zIndex = '5';
|
|
7233
|
+
this.externalElements.style.zIndex = '5';
|
|
7218
7234
|
this.magnifierCanvas.magnifier = false;
|
|
7219
7235
|
this.externalElements.style.cursor = 'default';
|
|
7220
7236
|
this.render();
|