@leafer/core 2.0.0 → 2.0.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/lib/core.cjs CHANGED
@@ -1720,7 +1720,7 @@ const Platform = {
1720
1720
  resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
1721
1721
  const realWidth = max(floor(width + (xGap || 0)), 1), realHeight = max(floor(height + (yGap || 0)), 1);
1722
1722
  let interlaceX, interlaceY, interlaceOffset;
1723
- if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (interlaceY = true);
1723
+ if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
1724
1724
  const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
1725
1725
  const ctx = canvas.getContext("2d");
1726
1726
  if (opacity) ctx.globalAlpha = opacity;
@@ -3310,10 +3310,10 @@ const PathCommandDataHelper = {
3310
3310
  data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
3311
3311
  }
3312
3312
  },
3313
- arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3313
+ arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3314
3314
  if (!isUndefined(lastX)) {
3315
- const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3316
- radius = min(radius, min(d / 2, d / 2 * abs(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3315
+ const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3316
+ radius = min(radius, min(r, r * abs(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3317
3317
  }
3318
3318
  data.push(U$2, x1, y1, x2, y2, radius);
3319
3319
  },
@@ -3657,7 +3657,7 @@ const PathCorner = {
3657
3657
  let command, lastCommand, commandLen;
3658
3658
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3659
3659
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3660
- const len = data.length;
3660
+ const len = data.length, three = len === 9;
3661
3661
  const smooth = [];
3662
3662
  while (i < len) {
3663
3663
  command = data[i];
@@ -3669,7 +3669,7 @@ const PathCorner = {
3669
3669
  if (data[i] === L$1) {
3670
3670
  secondX = data[i + 1];
3671
3671
  secondY = data[i + 2];
3672
- smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
3672
+ three ? smooth.push(M, startX, startY) : smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
3673
3673
  } else {
3674
3674
  smooth.push(M, startX, startY);
3675
3675
  }
@@ -3681,11 +3681,11 @@ const PathCorner = {
3681
3681
  i += 3;
3682
3682
  switch (data[i]) {
3683
3683
  case L$1:
3684
- arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
3684
+ arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
3685
3685
  break;
3686
3686
 
3687
3687
  case Z:
3688
- arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
3688
+ arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
3689
3689
  break;
3690
3690
 
3691
3691
  default:
@@ -3697,7 +3697,7 @@ const PathCorner = {
3697
3697
 
3698
3698
  case Z:
3699
3699
  if (lastCommand !== Z) {
3700
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3700
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
3701
3701
  smooth.push(Z);
3702
3702
  }
3703
3703
  i += 1;
@@ -6972,7 +6972,7 @@ class LeafLevelList {
6972
6972
  }
6973
6973
  }
6974
6974
 
6975
- const version = "2.0.0";
6975
+ const version = "2.0.1";
6976
6976
 
6977
6977
  exports.AlignHelper = AlignHelper;
6978
6978
 
package/lib/core.esm.js CHANGED
@@ -1718,7 +1718,7 @@ const Platform = {
1718
1718
  resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
1719
1719
  const realWidth = max(floor(width + (xGap || 0)), 1), realHeight = max(floor(height + (yGap || 0)), 1);
1720
1720
  let interlaceX, interlaceY, interlaceOffset;
1721
- if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (interlaceY = true);
1721
+ if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
1722
1722
  const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
1723
1723
  const ctx = canvas.getContext("2d");
1724
1724
  if (opacity) ctx.globalAlpha = opacity;
@@ -3308,10 +3308,10 @@ const PathCommandDataHelper = {
3308
3308
  data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
3309
3309
  }
3310
3310
  },
3311
- arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3311
+ arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3312
3312
  if (!isUndefined(lastX)) {
3313
- const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3314
- radius = min(radius, min(d / 2, d / 2 * abs(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3313
+ const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3314
+ radius = min(radius, min(r, r * abs(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3315
3315
  }
3316
3316
  data.push(U$2, x1, y1, x2, y2, radius);
3317
3317
  },
@@ -3655,7 +3655,7 @@ const PathCorner = {
3655
3655
  let command, lastCommand, commandLen;
3656
3656
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3657
3657
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3658
- const len = data.length;
3658
+ const len = data.length, three = len === 9;
3659
3659
  const smooth = [];
3660
3660
  while (i < len) {
3661
3661
  command = data[i];
@@ -3667,7 +3667,7 @@ const PathCorner = {
3667
3667
  if (data[i] === L$1) {
3668
3668
  secondX = data[i + 1];
3669
3669
  secondY = data[i + 2];
3670
- smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
3670
+ three ? smooth.push(M, startX, startY) : smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
3671
3671
  } else {
3672
3672
  smooth.push(M, startX, startY);
3673
3673
  }
@@ -3679,11 +3679,11 @@ const PathCorner = {
3679
3679
  i += 3;
3680
3680
  switch (data[i]) {
3681
3681
  case L$1:
3682
- arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
3682
+ arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
3683
3683
  break;
3684
3684
 
3685
3685
  case Z:
3686
- arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
3686
+ arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
3687
3687
  break;
3688
3688
 
3689
3689
  default:
@@ -3695,7 +3695,7 @@ const PathCorner = {
3695
3695
 
3696
3696
  case Z:
3697
3697
  if (lastCommand !== Z) {
3698
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3698
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
3699
3699
  smooth.push(Z);
3700
3700
  }
3701
3701
  i += 1;
@@ -6970,6 +6970,6 @@ class LeafLevelList {
6970
6970
  }
6971
6971
  }
6972
6972
 
6973
- const version = "2.0.0";
6973
+ const version = "2.0.1";
6974
6974
 
6975
6975
  export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, FourNumberHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, UnitConvertHelper, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useModule, version, visibleType };