@meta2d/core 1.0.60 → 1.0.61

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta2d/core",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -126,13 +126,13 @@ export class Canvas {
126
126
  this.canvasImage = new CanvasImage(parentElement, store);
127
127
  this.canvasImage.canvas.style.zIndex = '4';
128
128
  this.magnifierCanvas = new MagnifierCanvas(this, parentElement, store);
129
- this.magnifierCanvas.canvas.style.zIndex = '5';
129
+ this.magnifierCanvas.canvas.style.zIndex = '100'; //放大镜盖过dom图元
130
130
  this.externalElements.style.position = 'absolute';
131
131
  this.externalElements.style.left = '0';
132
132
  this.externalElements.style.top = '0';
133
133
  this.externalElements.style.outline = 'none';
134
134
  this.externalElements.style.background = 'transparent';
135
- this.externalElements.style.zIndex = '5';
135
+ this.externalElements.style.zIndex = '101';
136
136
  parentElement.style.position = 'relative';
137
137
  parentElement.appendChild(this.externalElements);
138
138
  this.createInput();
@@ -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 + (pen.textLeft || 0);
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';
@@ -6152,6 +6152,8 @@ export class Canvas {
6152
6152
  if (!this.store.data.locked) {
6153
6153
  this.inputRight.style.display = 'none';
6154
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 {
@@ -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.name === 'text' && pen.textAutoAdjust) {
6362
+ if (pen.text && pen.textAutoAdjust) {
6361
6363
  calcTextAutoWidth(pen);
6362
6364
  }
6363
6365
  calcTextRect(pen);
@@ -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) => {
@@ -7211,6 +7222,7 @@ export class Canvas {
7211
7222
  }
7212
7223
  showMagnifier() {
7213
7224
  this.magnifierCanvas.magnifier = true;
7225
+ this.magnifierCanvas.updateDomOffscreen();
7214
7226
  this.externalElements.style.cursor = 'default';
7215
7227
  this.render();
7216
7228
  }