@meta2d/core 1.0.64 → 1.0.65

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.64",
3
+ "version": "1.0.65",
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",
@@ -146,7 +146,7 @@ export class Canvas {
146
146
  setHover(hover, false);
147
147
  };
148
148
  this.popconfirm = new Popconfirm(parentElement, store);
149
- this.dialog = new Dialog(parentElement);
149
+ this.dialog = new Dialog(parentElement, store);
150
150
  this.title = new Title(parentElement);
151
151
  if (this.store.options.scroll) {
152
152
  this.scroll = new Scroll(this);
@@ -366,7 +366,7 @@ export class Canvas {
366
366
  }
367
367
  let data = JSON.parse(e.data);
368
368
  if (typeof data === 'object') {
369
- this.parent.doMessageEvent(data.name, data.value);
369
+ this.parent.doMessageEvent(data.name, JSON.stringify(data.data));
370
370
  }
371
371
  else {
372
372
  this.parent.doMessageEvent(data);
@@ -2208,7 +2208,12 @@ export class Canvas {
2208
2208
  if (e.button !== 2) {
2209
2209
  if (distance(this.mouseDown, e) < 2) {
2210
2210
  if (this.store.hover && this.store.hover.input) {
2211
- this.showInput(this.store.hover);
2211
+ if (this.store.hover.onShowInput) {
2212
+ this.store.hover.onShowInput(this.store.hover, e);
2213
+ }
2214
+ else {
2215
+ this.showInput(this.store.hover);
2216
+ }
2212
2217
  }
2213
2218
  this.store.emitter.emit('click', {
2214
2219
  x: e.x,
@@ -6156,9 +6161,9 @@ export class Canvas {
6156
6161
  // this.inputDiv.style.fontSize = pen.calculative.fontSize + 'px';
6157
6162
  // this.inputDiv.style.color = getTextColor(pen, this.store);
6158
6163
  this.inputParent.style.left =
6159
- textRect.x + this.store.data.x - (pen.textLeft || 0) + 'px'; //+ 5
6164
+ textRect.x + this.store.data.x - (pen.calculative.textLeft || 0) + 'px'; //+ 5
6160
6165
  this.inputParent.style.top =
6161
- textRect.y + this.store.data.y - (pen.textTop || 0) + 'px'; //+ 5
6166
+ textRect.y + this.store.data.y - (pen.calculative.textTop || 0) + 'px'; //+ 5
6162
6167
  let _width = textRect.width; //+ (pen.textLeft || 0);
6163
6168
  this.inputParent.style.width = (_width < 0 ? 12 : _width) + 'px'; //(textRect.width < pen.width ? 0 : 10)
6164
6169
  this.inputParent.style.height = textRect.height + (pen.textTop || 0) + 'px'; // (textRect.height < pen.height ? 0 : 10)
@@ -6180,6 +6185,8 @@ export class Canvas {
6180
6185
  // }
6181
6186
  this.dropdown.style.background = pen.dropdownBackground || '#fff';
6182
6187
  this.dropdown.style.color = pen.dropdownColor || '#bdc7db';
6188
+ this.dropdown.style.width = this.inputParent.style.width;
6189
+ this.dropdown.style.fontSize = (pen.fontSize || 12) + 'px';
6183
6190
  this.setDropdownList();
6184
6191
  this.externalElements.style.zIndex = '9999';
6185
6192
  }
@@ -6442,7 +6449,7 @@ export class Canvas {
6442
6449
  sheet.insertRule('.meta2d-input{display:none;position:absolute;outline:none;align-items: center;}');
6443
6450
  sheet.insertRule('.meta2d-input textarea{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;left:0;top:0}');
6444
6451
  sheet.insertRule('.meta2d-input .right{width:10px;height:10px;flex-shrink:0;border-top: 1px solid;border-right: 1px solid;margin-right: 5px;transition: all .3s cubic-bezier(.645,.045,.355,1);position:absolute;right:1px;}');
6445
- sheet.insertRule('.meta2d-input ul{position:absolute;top:100%;left:-5px;width:calc(100% + 10px);min-height:30px;border-radius: 2px;box-shadow: 0 2px 8px #00000026;list-style-type: none;background-color: #fff;padding: 4px 0;max-height: 105px;overflow-y: auto;}');
6452
+ sheet.insertRule('.meta2d-input ul{position:absolute;top:100%;margin-top:4px; width:calc(100% + 10px);min-height:30px;border-radius: 2px;box-shadow: 0 2px 8px #00000026;list-style-type: none;background-color: #fff;padding: 4px 0;max-height: 105px;overflow-y: auto;}');
6446
6453
  sheet.insertRule('.meta2d-input ul li{padding: 5px 12px;line-height: 22px;white-space: nowrap;cursor: pointer;}');
6447
6454
  sheet.insertRule('.meta2d-input ul li:hover{background: #eeeeee;}');
6448
6455
  sheet.insertRule(`.input-div::-webkit-scrollbar {display:none}`);
@@ -7055,6 +7062,9 @@ export class Canvas {
7055
7062
  if (!isShowChild(pen, this.store) || pen.visible == false) {
7056
7063
  continue;
7057
7064
  }
7065
+ if (pen.name === 'combine' && !pen.draw) {
7066
+ continue;
7067
+ }
7058
7068
  // TODO: hover 待考虑,若出现再补上
7059
7069
  const { active } = pen.calculative;
7060
7070
  pen.calculative.active = false;