@leafer/worker 2.0.4 → 2.0.6

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
@@ -6637,7 +6637,7 @@ var LeaferUI = function(exports) {
6637
6637
  this.levelMap = null;
6638
6638
  }
6639
6639
  }
6640
- const version = "2.0.4";
6640
+ const version = "2.0.6";
6641
6641
  class LeaferCanvas extends LeaferCanvasBase {
6642
6642
  get allowBackgroundColor() {
6643
6643
  return true;
@@ -8045,6 +8045,7 @@ var LeaferUI = function(exports) {
8045
8045
  createProxyData() {
8046
8046
  return undefined;
8047
8047
  }
8048
+ clearProxyData() {}
8048
8049
  find(_condition, _options) {
8049
8050
  return Plugin.need("find");
8050
8051
  }
@@ -10963,17 +10964,19 @@ var LeaferUI = function(exports) {
10963
10964
  return leafPaint;
10964
10965
  }
10965
10966
  function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
10967
+ let needUpdate = true;
10966
10968
  const data = ui.__;
10967
10969
  if (attrName === "fill" && !data.__naturalWidth) {
10968
10970
  data.__naturalWidth = image.width / data.pixelRatio;
10969
10971
  data.__naturalHeight = image.height / data.pixelRatio;
10970
10972
  if (data.__autoSide) {
10971
10973
  ui.forceUpdate("width");
10974
+ LeafHelper.updateBounds(ui);
10972
10975
  if (ui.__proxyData) {
10973
10976
  ui.setProxyAttr("width", data.width);
10974
10977
  ui.setProxyAttr("height", data.height);
10975
10978
  }
10976
- return false;
10979
+ needUpdate = false;
10977
10980
  }
10978
10981
  }
10979
10982
  if (!leafPaint.data) {
@@ -10983,7 +10986,7 @@ var LeaferUI = function(exports) {
10983
10986
  if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
10984
10987
  }
10985
10988
  if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
10986
- return true;
10989
+ return needUpdate;
10987
10990
  }
10988
10991
  function onLoad(ui, event) {
10989
10992
  emit(ui, ImageEvent.LOAD, event);
@@ -11386,10 +11389,10 @@ var LeaferUI = function(exports) {
11386
11389
  const realFrom = {};
11387
11390
  const realTo = {};
11388
11391
  function conicGradient(paint, box) {
11389
- let {from: from, to: to, type: type, opacity: opacity, stretch: stretch} = paint;
11392
+ let {from: from, to: to, type: type, opacity: opacity, rotation: rotation, stretch: stretch} = paint;
11390
11393
  toPoint$1(from || "center", box, realFrom);
11391
11394
  toPoint$1(to || "bottom", box, realTo);
11392
- const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
11395
+ const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(rotation ? rotation * OneRadian : 0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
11393
11396
  const data = {
11394
11397
  type: type,
11395
11398
  style: style
@@ -12144,11 +12147,7 @@ var LeaferUI = function(exports) {
12144
12147
  });
12145
12148
  if (isObject(check)) value = check; else if (check === false) return;
12146
12149
  }
12147
- if (t.hasDimOthers) {
12148
- t.setDimOthers(false);
12149
- t.setBright(false);
12150
- t.hasDimOthers = undefined;
12151
- }
12150
+ if (t.hasDimOthers) t.cancelDimOthers();
12152
12151
  if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
12153
12152
  if (t.single) {
12154
12153
  delete t.element.syncEventer;
@@ -13055,6 +13054,8 @@ var LeaferUI = function(exports) {
13055
13054
  editor.setDimOthers(dimOthers);
13056
13055
  editor.setBright(!!dimOthers || bright);
13057
13056
  editor.hasDimOthers = true;
13057
+ } else if (editor.hasDimOthers) {
13058
+ editor.cancelDimOthers();
13058
13059
  }
13059
13060
  if (spread) BoundsHelper.spread(bounds, spread);
13060
13061
  if (this.view.worldOpacity) {
@@ -14044,6 +14045,11 @@ var LeaferUI = function(exports) {
14044
14045
  setBright(value) {
14045
14046
  this.setDimOthers(value, "bright", this.list);
14046
14047
  }
14048
+ cancelDimOthers() {
14049
+ this.setDimOthers(false);
14050
+ this.setBright(false);
14051
+ this.hasDimOthers = undefined;
14052
+ }
14047
14053
  update() {
14048
14054
  if (this.editing) {
14049
14055
  if (!this.element.parent) return this.cancel();