@leafer-ui/draw 1.4.1 → 1.5.0

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/lib/draw.cjs CHANGED
@@ -85,7 +85,11 @@ const State = {
85
85
  setStyleName() { return core.Plugin.need('state'); },
86
86
  set() { return core.Plugin.need('state'); }
87
87
  };
88
- const Transition = {};
88
+ const Transition = {
89
+ list: {},
90
+ register(attrName, fn) { Transition.list[attrName] = fn; },
91
+ get(attrName) { return Transition.list[attrName]; }
92
+ };
89
93
 
90
94
  const { parse, objectToCanvasData } = core.PathConvert;
91
95
  const emptyPaint = {};
@@ -509,9 +513,6 @@ exports.UI = UI_1 = class UI extends core.Leaf {
509
513
  this.__drawPathByBox(core.pen);
510
514
  return core.pen;
511
515
  }
512
- get editConfig() { return undefined; }
513
- get editOuter() { return ''; }
514
- get editInner() { return ''; }
515
516
  constructor(data) {
516
517
  super(data);
517
518
  }
@@ -593,8 +594,11 @@ exports.UI = UI_1 = class UI extends core.Leaf {
593
594
  export(_filename, _options) {
594
595
  return core.Plugin.need('export');
595
596
  }
597
+ syncExport(_filename, _options) {
598
+ return core.Plugin.need('export');
599
+ }
596
600
  clone(data) {
597
- const json = this.toJSON();
601
+ const json = core.DataHelper.clone(this.toJSON());
598
602
  if (data)
599
603
  Object.assign(json, data);
600
604
  return UI_1.one(json);
@@ -893,7 +897,7 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
893
897
  get layoutLocked() { return !this.layouter.running; }
894
898
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
895
899
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
896
- get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
900
+ get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || core.getBoundsData(); }
897
901
  constructor(userConfig, data) {
898
902
  super(data);
899
903
  this.config = {
@@ -1195,6 +1199,10 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
1195
1199
  getPagePointByClient(clientPoint, updateClient) {
1196
1200
  return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
1197
1201
  }
1202
+ getClientPointByWorld(worldPoint) {
1203
+ const { x, y } = this.clientBounds;
1204
+ return { x: x + worldPoint.x, y: y + worldPoint.y };
1205
+ }
1198
1206
  updateClientBounds() {
1199
1207
  this.canvas && this.canvas.updateClientBounds();
1200
1208
  }