@leafer/core 2.1.1 → 2.1.3

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
@@ -3041,7 +3041,7 @@ const PathConvert = {
3041
3041
  current.length = PathCommandLengthMap[char];
3042
3042
  current.index = 0;
3043
3043
  pushData(data, current.name);
3044
- if (!needConvert && convertCommand[char]) needConvert = true;
3044
+ if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"]; else if (!needConvert && convertCommand[char]) needConvert = true;
3045
3045
  } else {
3046
3046
  if (char === "-" || char === "+") {
3047
3047
  if (lastChar === "e" || lastChar === "E") {
@@ -3063,7 +3063,7 @@ const PathConvert = {
3063
3063
  return needConvert ? PathConvert.toCanvasData(data, curveMode) : data;
3064
3064
  },
3065
3065
  toCanvasData(old, curveMode) {
3066
- let x = 0, y = 0, x1 = 0, y1 = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
3066
+ let x = 0, y = 0, x1 = 0, y1 = 0, startX = 0, startY = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
3067
3067
  const data = [];
3068
3068
  while (i < len) {
3069
3069
  command = old[i];
@@ -3073,9 +3073,9 @@ const PathConvert = {
3073
3073
  old[i + 2] += y;
3074
3074
 
3075
3075
  case M$4:
3076
- x = old[i + 1];
3077
- y = old[i + 2];
3078
- data.push(lastCommand === command ? L$5 : M$4, x, y);
3076
+ x = startX = old[i + 1];
3077
+ y = startY = old[i + 2];
3078
+ data.push(M$4, x, y);
3079
3079
  i += 3;
3080
3080
  break;
3081
3081
 
@@ -3190,6 +3190,8 @@ const PathConvert = {
3190
3190
  case z:
3191
3191
  case Z$4:
3192
3192
  data.push(Z$4);
3193
+ x = startX;
3194
+ y = startY;
3193
3195
  i++;
3194
3196
  break;
3195
3197
 
@@ -6074,39 +6076,45 @@ const LeafBounds = {
6074
6076
  this.__updateRenderPath();
6075
6077
  this.__updateBoxBounds();
6076
6078
  layout.resized = "inner";
6077
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
6078
6079
  }
6079
6080
  if (layout.localBoxChanged) {
6080
6081
  if (this.__local) this.__updateLocalBoxBounds();
6081
6082
  layout.localBoxChanged = undefined;
6082
- if (layout.strokeSpread) layout.strokeChanged = true;
6083
- if (layout.renderSpread) layout.renderChanged = true;
6083
+ if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
6084
+ if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
6084
6085
  if (this.parent) this.parent.__layout.boxChange();
6085
6086
  }
6086
6087
  layout.boxChanged = undefined;
6087
6088
  if (layout.strokeChanged) {
6088
- layout.strokeSpread = this.__updateStrokeSpread();
6089
- if (layout.strokeSpread) {
6090
- if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
6091
- this.__updateStrokeBounds();
6089
+ if (layout.strokeChanged === 2) {
6092
6090
  this.__updateLocalStrokeBounds();
6093
6091
  } else {
6094
- layout.spreadStrokeCancel();
6092
+ layout.strokeSpread = this.__updateStrokeSpread();
6093
+ if (layout.strokeSpread) {
6094
+ if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
6095
+ this.__updateStrokeBounds();
6096
+ this.__updateLocalStrokeBounds();
6097
+ } else {
6098
+ layout.spreadStrokeCancel();
6099
+ }
6100
+ layout.resized = "inner";
6101
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
6095
6102
  }
6096
6103
  layout.strokeChanged = undefined;
6097
- if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
6098
6104
  if (this.parent) this.parent.__layout.strokeChange();
6099
- layout.resized = "inner";
6100
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
6101
6105
  }
6102
6106
  if (layout.renderChanged) {
6103
- layout.renderSpread = this.__updateRenderSpread();
6104
- if (layout.renderSpread) {
6105
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
6106
- this.__updateRenderBounds();
6107
+ if (layout.renderChanged === 2) {
6107
6108
  this.__updateLocalRenderBounds();
6108
6109
  } else {
6109
- layout.spreadRenderCancel();
6110
+ layout.renderSpread = this.__updateRenderSpread();
6111
+ if (layout.renderSpread) {
6112
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
6113
+ this.__updateRenderBounds();
6114
+ this.__updateLocalRenderBounds();
6115
+ } else {
6116
+ layout.spreadRenderCancel();
6117
+ }
6110
6118
  }
6111
6119
  layout.renderChanged = undefined;
6112
6120
  if (this.parent) this.parent.__layout.renderChange();
@@ -7074,7 +7082,7 @@ class LeafLevelList {
7074
7082
  }
7075
7083
  }
7076
7084
 
7077
- const version = "2.1.1";
7085
+ const version = "2.1.3";
7078
7086
 
7079
7087
  exports.AlignHelper = AlignHelper;
7080
7088
 
package/lib/core.esm.js CHANGED
@@ -3039,7 +3039,7 @@ const PathConvert = {
3039
3039
  current.length = PathCommandLengthMap[char];
3040
3040
  current.index = 0;
3041
3041
  pushData(data, current.name);
3042
- if (!needConvert && convertCommand[char]) needConvert = true;
3042
+ if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"]; else if (!needConvert && convertCommand[char]) needConvert = true;
3043
3043
  } else {
3044
3044
  if (char === "-" || char === "+") {
3045
3045
  if (lastChar === "e" || lastChar === "E") {
@@ -3061,7 +3061,7 @@ const PathConvert = {
3061
3061
  return needConvert ? PathConvert.toCanvasData(data, curveMode) : data;
3062
3062
  },
3063
3063
  toCanvasData(old, curveMode) {
3064
- let x = 0, y = 0, x1 = 0, y1 = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
3064
+ let x = 0, y = 0, x1 = 0, y1 = 0, startX = 0, startY = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
3065
3065
  const data = [];
3066
3066
  while (i < len) {
3067
3067
  command = old[i];
@@ -3071,9 +3071,9 @@ const PathConvert = {
3071
3071
  old[i + 2] += y;
3072
3072
 
3073
3073
  case M$4:
3074
- x = old[i + 1];
3075
- y = old[i + 2];
3076
- data.push(lastCommand === command ? L$5 : M$4, x, y);
3074
+ x = startX = old[i + 1];
3075
+ y = startY = old[i + 2];
3076
+ data.push(M$4, x, y);
3077
3077
  i += 3;
3078
3078
  break;
3079
3079
 
@@ -3188,6 +3188,8 @@ const PathConvert = {
3188
3188
  case z:
3189
3189
  case Z$4:
3190
3190
  data.push(Z$4);
3191
+ x = startX;
3192
+ y = startY;
3191
3193
  i++;
3192
3194
  break;
3193
3195
 
@@ -6072,39 +6074,45 @@ const LeafBounds = {
6072
6074
  this.__updateRenderPath();
6073
6075
  this.__updateBoxBounds();
6074
6076
  layout.resized = "inner";
6075
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
6076
6077
  }
6077
6078
  if (layout.localBoxChanged) {
6078
6079
  if (this.__local) this.__updateLocalBoxBounds();
6079
6080
  layout.localBoxChanged = undefined;
6080
- if (layout.strokeSpread) layout.strokeChanged = true;
6081
- if (layout.renderSpread) layout.renderChanged = true;
6081
+ if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
6082
+ if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
6082
6083
  if (this.parent) this.parent.__layout.boxChange();
6083
6084
  }
6084
6085
  layout.boxChanged = undefined;
6085
6086
  if (layout.strokeChanged) {
6086
- layout.strokeSpread = this.__updateStrokeSpread();
6087
- if (layout.strokeSpread) {
6088
- if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
6089
- this.__updateStrokeBounds();
6087
+ if (layout.strokeChanged === 2) {
6090
6088
  this.__updateLocalStrokeBounds();
6091
6089
  } else {
6092
- layout.spreadStrokeCancel();
6090
+ layout.strokeSpread = this.__updateStrokeSpread();
6091
+ if (layout.strokeSpread) {
6092
+ if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
6093
+ this.__updateStrokeBounds();
6094
+ this.__updateLocalStrokeBounds();
6095
+ } else {
6096
+ layout.spreadStrokeCancel();
6097
+ }
6098
+ layout.resized = "inner";
6099
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
6093
6100
  }
6094
6101
  layout.strokeChanged = undefined;
6095
- if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
6096
6102
  if (this.parent) this.parent.__layout.strokeChange();
6097
- layout.resized = "inner";
6098
- if (data.__strokeGeometry) data.__strokeGeometry = undefined;
6099
6103
  }
6100
6104
  if (layout.renderChanged) {
6101
- layout.renderSpread = this.__updateRenderSpread();
6102
- if (layout.renderSpread) {
6103
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
6104
- this.__updateRenderBounds();
6105
+ if (layout.renderChanged === 2) {
6105
6106
  this.__updateLocalRenderBounds();
6106
6107
  } else {
6107
- layout.spreadRenderCancel();
6108
+ layout.renderSpread = this.__updateRenderSpread();
6109
+ if (layout.renderSpread) {
6110
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
6111
+ this.__updateRenderBounds();
6112
+ this.__updateLocalRenderBounds();
6113
+ } else {
6114
+ layout.spreadRenderCancel();
6115
+ }
6108
6116
  }
6109
6117
  layout.renderChanged = undefined;
6110
6118
  if (this.parent) this.parent.__layout.renderChange();
@@ -7072,6 +7080,6 @@ class LeafLevelList {
7072
7080
  }
7073
7081
  }
7074
7082
 
7075
- const version = "2.1.1";
7083
+ const version = "2.1.3";
7076
7084
 
7077
7085
  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, LeaferFilm, LeaferImage, LeaferVideo, 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 };