leafer-ui 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/web.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$f = 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
  const debug$6 = Debug.get('LeaferCanvas');
5998
6010
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7163,8 +7175,8 @@ var LeaferUI = (function (exports) {
7163
7175
  const Effect = {};
7164
7176
  const Export = {};
7165
7177
  const State = {
7166
- setStyleName(_leaf, _styleName, _value) { return needPlugin('state'); },
7167
- set(_leaf, _stateName) { return needPlugin('state'); }
7178
+ setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
7179
+ set(_leaf, _stateName) { return Plugin.need('state'); }
7168
7180
  };
7169
7181
  const Transition = {
7170
7182
  list: {},
@@ -7665,7 +7677,7 @@ var LeaferUI = (function (exports) {
7665
7677
  drawer.rect(x, y, width, height);
7666
7678
  }
7667
7679
  animate(_keyframe, _options, _type, _isTemp) {
7668
- return needPlugin('animate');
7680
+ return Plugin.need('animate');
7669
7681
  }
7670
7682
  killAnimate(_type) { }
7671
7683
  export(filename, options) {
@@ -8064,10 +8076,13 @@ var LeaferUI = (function (exports) {
8064
8076
  const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
8065
8077
  Object.keys(data).forEach(key => this[key] = data[key]);
8066
8078
  }
8067
- forceRender(bounds) {
8068
- this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
8069
- if (this.viewReady)
8070
- this.renderer.render();
8079
+ forceRender(bounds, sync) {
8080
+ const { renderer } = this;
8081
+ if (renderer) {
8082
+ renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
8083
+ if (this.viewReady)
8084
+ sync ? renderer.render() : renderer.update();
8085
+ }
8071
8086
  }
8072
8087
  requestRender(change = false) {
8073
8088
  if (this.renderer)
@@ -8243,7 +8258,7 @@ var LeaferUI = (function (exports) {
8243
8258
  this.requestRender();
8244
8259
  }
8245
8260
  zoom(_zoomType, _padding, _fixedScale) {
8246
- return needPlugin('view');
8261
+ return Plugin.need('view');
8247
8262
  }
8248
8263
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
8249
8264
  getValidScale(changeScale) { return changeScale; }
@@ -9056,8 +9071,8 @@ var LeaferUI = (function (exports) {
9056
9071
  super.lockLayout();
9057
9072
  this.children.forEach(leafer => leafer.lockLayout());
9058
9073
  }
9059
- forceRender(bounds) {
9060
- this.children.forEach(leafer => leafer.forceRender(bounds));
9074
+ forceRender(bounds, sync) {
9075
+ this.children.forEach(leafer => leafer.forceRender(bounds, sync));
9061
9076
  }
9062
9077
  addLeafer(merge) {
9063
9078
  const leafer = new exports.Leafer(merge);
@@ -12369,6 +12384,7 @@ var LeaferUI = (function (exports) {
12369
12384
  exports.PathNumberCommandMap = PathNumberCommandMap;
12370
12385
  exports.PenData = PenData;
12371
12386
  exports.Platform = Platform;
12387
+ exports.Plugin = Plugin;
12372
12388
  exports.Point = Point;
12373
12389
  exports.PointHelper = PointHelper;
12374
12390
  exports.PointerButton = PointerButton;
@@ -12428,7 +12444,6 @@ var LeaferUI = (function (exports) {
12428
12444
  exports.layoutProcessor = layoutProcessor;
12429
12445
  exports.maskType = maskType;
12430
12446
  exports.naturalBoundsType = naturalBoundsType;
12431
- exports.needPlugin = needPlugin;
12432
12447
  exports.opacityType = opacityType;
12433
12448
  exports.pathInputType = pathInputType;
12434
12449
  exports.pathType = pathType;