@leafer-draw/worker 1.1.2 → 1.2.1

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/worker.js CHANGED
@@ -1405,9 +1405,21 @@ var LeaferUI = (function (exports) {
1405
1405
  };
1406
1406
  const R = Run;
1407
1407
 
1408
- function needPlugin(name) {
1409
- console.error('need plugin: @leafer-in/' + name);
1410
- }
1408
+ const Plugin = {
1409
+ list: {},
1410
+ add(name) {
1411
+ this.list[name] = true;
1412
+ },
1413
+ check(name, tip) {
1414
+ const rs = this.list[name];
1415
+ if (!rs && tip)
1416
+ this.need(name);
1417
+ return rs;
1418
+ },
1419
+ need(name) {
1420
+ console.error('need plugin: @leafer-in/' + name);
1421
+ }
1422
+ };
1411
1423
 
1412
1424
  const debug$d = Debug.get('UICreator');
1413
1425
  const UICreator = {
@@ -5422,7 +5434,7 @@ var LeaferUI = (function (exports) {
5422
5434
  this.__[attrName] = value === undefined ? null : undefined;
5423
5435
  this[attrName] = value;
5424
5436
  }
5425
- forceRender(_bounds) {
5437
+ forceRender(_bounds, _sync) {
5426
5438
  this.forceUpdate('surface');
5427
5439
  }
5428
5440
  __updateWorldMatrix() { }
@@ -5632,10 +5644,10 @@ var LeaferUI = (function (exports) {
5632
5644
  __updatePath() { }
5633
5645
  __updateRenderPath() { }
5634
5646
  getMotionPathData() {
5635
- return needPlugin('path');
5647
+ return Plugin.need('path');
5636
5648
  }
5637
5649
  getMotionPoint(_motionDistance) {
5638
- return needPlugin('path');
5650
+ return Plugin.need('path');
5639
5651
  }
5640
5652
  getMotionTotal() {
5641
5653
  return 0;
@@ -5992,7 +6004,7 @@ var LeaferUI = (function (exports) {
5992
6004
  }
5993
6005
  }
5994
6006
 
5995
- const version = "1.1.1";
6007
+ const version = "1.2.1";
5996
6008
 
5997
6009
  class LeaferCanvas extends LeaferCanvasBase {
5998
6010
  get allowBackgroundColor() { return true; }
@@ -6717,8 +6729,8 @@ var LeaferUI = (function (exports) {
6717
6729
  const Effect = {};
6718
6730
  const Export = {};
6719
6731
  const State = {
6720
- setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
6721
- set(_leaf, _stateName) { return needPlugin('state'); }
6732
+ setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
6733
+ set(_leaf, _stateName) { return Plugin.need('state'); }
6722
6734
  };
6723
6735
  const Transition = {
6724
6736
  list: {},
@@ -7219,7 +7231,7 @@ var LeaferUI = (function (exports) {
7219
7231
  drawer.rect(x, y, width, height);
7220
7232
  }
7221
7233
  animate(_keyframe, _options, _type, _isTemp) {
7222
- return needPlugin('animate');
7234
+ return Plugin.need('animate');
7223
7235
  }
7224
7236
  killAnimate(_type) { }
7225
7237
  export(filename, options) {
@@ -7618,10 +7630,13 @@ var LeaferUI = (function (exports) {
7618
7630
  const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
7619
7631
  Object.keys(data).forEach(key => this[key] = data[key]);
7620
7632
  }
7621
- forceRender(bounds) {
7622
- this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
7623
- if (this.viewReady)
7624
- this.renderer.render();
7633
+ forceRender(bounds, sync) {
7634
+ const { renderer } = this;
7635
+ if (renderer) {
7636
+ renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
7637
+ if (this.viewReady)
7638
+ sync ? renderer.render() : renderer.update();
7639
+ }
7625
7640
  }
7626
7641
  requestRender(change = false) {
7627
7642
  if (this.renderer)
@@ -7797,7 +7812,7 @@ var LeaferUI = (function (exports) {
7797
7812
  this.requestRender();
7798
7813
  }
7799
7814
  zoom(_zoomType, _padding, _fixedScale) {
7800
- return needPlugin('view');
7815
+ return Plugin.need('view');
7801
7816
  }
7802
7817
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7803
7818
  getValidScale(changeScale) { return changeScale; }
@@ -10309,6 +10324,7 @@ var LeaferUI = (function (exports) {
10309
10324
  exports.PathNumberCommandMap = PathNumberCommandMap;
10310
10325
  exports.PenData = PenData;
10311
10326
  exports.Platform = Platform;
10327
+ exports.Plugin = Plugin;
10312
10328
  exports.Point = Point;
10313
10329
  exports.PointHelper = PointHelper;
10314
10330
  exports.PolygonData = PolygonData;
@@ -10365,7 +10381,6 @@ var LeaferUI = (function (exports) {
10365
10381
  exports.layoutProcessor = layoutProcessor;
10366
10382
  exports.maskType = maskType;
10367
10383
  exports.naturalBoundsType = naturalBoundsType;
10368
- exports.needPlugin = needPlugin;
10369
10384
  exports.opacityType = opacityType;
10370
10385
  exports.pathInputType = pathInputType;
10371
10386
  exports.pathType = pathType;