@leafer-draw/worker 2.2.5 → 2.2.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.
@@ -1904,7 +1904,7 @@ function getNameList(name) {
1904
1904
 
1905
1905
  const D$4 = Debug;
1906
1906
 
1907
- const debug$e = Debug.get("RunTime");
1907
+ const debug$f = Debug.get("RunTime");
1908
1908
 
1909
1909
  const Run = {
1910
1910
  currentId: 0,
@@ -1923,7 +1923,7 @@ const Run = {
1923
1923
  const time = R$1.idMap[id], name = R$1.nameMap[id];
1924
1924
  const duration = microsecond ? (performance.now() - time) / 1e3 : Date.now() - time;
1925
1925
  R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1926
- debug$e.log(name, duration, "ms");
1926
+ debug$f.log(name, duration, "ms");
1927
1927
  },
1928
1928
  endOfName(name, microsecond) {
1929
1929
  const id = R$1.nameToIdMap[name];
@@ -1959,18 +1959,18 @@ const Creator = {
1959
1959
  }
1960
1960
  };
1961
1961
 
1962
- const debug$d = Debug.get("UICreator");
1962
+ const debug$e = Debug.get("UICreator");
1963
1963
 
1964
1964
  const UICreator = {
1965
1965
  list: {},
1966
1966
  register(UI) {
1967
1967
  const {__tag: tag} = UI.prototype;
1968
- if (list$1[tag]) debug$d.repeat(tag);
1968
+ if (list$1[tag]) debug$e.repeat(tag);
1969
1969
  list$1[tag] = UI;
1970
1970
  },
1971
1971
  get(tag, data, x, y, width, height) {
1972
1972
  if (!list$1[tag]) {
1973
- debug$d.warn("not register " + tag);
1973
+ debug$e.warn("not register " + tag);
1974
1974
  return undefined;
1975
1975
  }
1976
1976
  const ui = new list$1[tag](data);
@@ -1986,7 +1986,7 @@ const UICreator = {
1986
1986
 
1987
1987
  const {list: list$1} = UICreator;
1988
1988
 
1989
- const debug$c = Debug.get("EventCreator");
1989
+ const debug$d = Debug.get("EventCreator");
1990
1990
 
1991
1991
  const EventCreator = {
1992
1992
  nameList: {},
@@ -1994,7 +1994,7 @@ const EventCreator = {
1994
1994
  let name;
1995
1995
  Object.keys(Event).forEach(key => {
1996
1996
  name = Event[key];
1997
- if (isString(name)) nameList[name] && debug$c.repeat(name), nameList[name] = Event;
1997
+ if (isString(name)) nameList[name] && debug$d.repeat(name), nameList[name] = Event;
1998
1998
  });
1999
1999
  },
2000
2000
  changeName(oldName, newName) {
@@ -3003,7 +3003,7 @@ const {rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse
3003
3003
 
3004
3004
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
3005
3005
 
3006
- const debug$b = Debug.get("PathConvert");
3006
+ const debug$c = Debug.get("PathConvert");
3007
3007
 
3008
3008
  const setEndPoint$1 = {};
3009
3009
 
@@ -3270,7 +3270,7 @@ const PathConvert = {
3270
3270
  break;
3271
3271
 
3272
3272
  default:
3273
- debug$b.error(`command: ${command} [index:${i}]`, old);
3273
+ debug$c.error(`command: ${command} [index:${i}]`, old);
3274
3274
  return data;
3275
3275
  }
3276
3276
  lastCommand = command;
@@ -3333,7 +3333,10 @@ const {tan: tan, min: min, abs: abs$3} = Math;
3333
3333
 
3334
3334
  const startPoint = {};
3335
3335
 
3336
+ const debug$b = Debug.get("PointsCurve");
3337
+
3336
3338
  const PathCommandDataHelper = {
3339
+ pointsCurveList: {},
3337
3340
  beginPath(data) {
3338
3341
  data.length = 0;
3339
3342
  },
@@ -3403,12 +3406,22 @@ const PathCommandDataHelper = {
3403
3406
  data.push(M$3, startPoint.x, startPoint.y);
3404
3407
  arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
3405
3408
  },
3406
- drawPoints(data, points, curve, close) {
3407
- BezierHelper.points(data, points, curve, close);
3409
+ drawPoints(data, points, curve, close, options) {
3410
+ let type = "Q";
3411
+ if (isObject(curve)) type = curve.type, curve = curve.value;
3412
+ if (!pointsCurveList[type]) debug$b.warn("not found:", type), type = "Q";
3413
+ pointsCurveList[type](data, points, curve, close, options);
3408
3414
  }
3409
3415
  };
3410
3416
 
3411
- const {ellipse: ellipse$3, arc: arc$2} = PathCommandDataHelper;
3417
+ const {ellipse: ellipse$3, arc: arc$2, pointsCurveList: pointsCurveList} = PathCommandDataHelper;
3418
+
3419
+ function registerPointsCurve(type, fn) {
3420
+ if (pointsCurveList[type]) debug$b.repeat(type);
3421
+ pointsCurveList[type] = fn;
3422
+ }
3423
+
3424
+ registerPointsCurve("Q", BezierHelper.points);
3412
3425
 
3413
3426
  const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$1, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3414
3427
 
@@ -7023,7 +7036,7 @@ class LeafLevelList {
7023
7036
  }
7024
7037
  }
7025
7038
 
7026
- const version = "2.2.5";
7039
+ const version = "2.2.6";
7027
7040
 
7028
7041
  class LeaferCanvas extends LeaferCanvasBase {
7029
7042
  get allowBackgroundColor() {
@@ -8168,7 +8181,7 @@ const UIRender = {
8168
8181
  }
8169
8182
  if (data.__useEffect) {
8170
8183
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8171
- stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
8184
+ stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && !(shadow[0].blendMode && shadow[0].blendMode !== "pass-through") && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
8172
8185
  data.__useEffect = !!(shadow || otherEffect);
8173
8186
  }
8174
8187
  data.__checkSingle();
@@ -9226,7 +9239,7 @@ let Polygon = class Polygon extends UI {
9226
9239
  const data = this.__;
9227
9240
  const path = data.path = [];
9228
9241
  if (data.points) {
9229
- drawPoints$1(path, data.points, data.curve, data.closed);
9242
+ drawPoints$1(path, data.points, data.curve, data.closed, data);
9230
9243
  } else {
9231
9244
  const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9232
9245
  const rx = width / 2, ry = height / 2;
@@ -9318,7 +9331,7 @@ let Line = class Line extends UI {
9318
9331
  const data = this.__;
9319
9332
  const path = data.path = [];
9320
9333
  if (data.points) {
9321
- drawPoints(path, data.points, data.curve, data.closed);
9334
+ drawPoints(path, data.points, data.curve, data.closed, data);
9322
9335
  } else {
9323
9336
  moveTo(path, 0, 0);
9324
9337
  lineTo(path, this.width, 0);
@@ -11337,4 +11350,4 @@ Object.assign(Effect, EffectModule);
11337
11350
 
11338
11351
  useCanvas();
11339
11352
 
11340
- export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, doSurfaceType, effectType, 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, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
11353
+ export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, doSurfaceType, effectType, 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, registerPointsCurve, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };