@leafer-ui/miniapp 2.2.4 → 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.
@@ -1865,7 +1865,7 @@ function getNameList(name) {
1865
1865
 
1866
1866
  const D$5 = Debug;
1867
1867
 
1868
- const debug$f = Debug.get("RunTime");
1868
+ const debug$g = Debug.get("RunTime");
1869
1869
 
1870
1870
  const Run = {
1871
1871
  currentId: 0,
@@ -1884,7 +1884,7 @@ const Run = {
1884
1884
  const time = R$1.idMap[id], name = R$1.nameMap[id];
1885
1885
  const duration = microsecond ? (performance.now() - time) / 1e3 : Date.now() - time;
1886
1886
  R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1887
- debug$f.log(name, duration, "ms");
1887
+ debug$g.log(name, duration, "ms");
1888
1888
  },
1889
1889
  endOfName(name, microsecond) {
1890
1890
  const id = R$1.nameToIdMap[name];
@@ -1920,18 +1920,18 @@ const Creator = {
1920
1920
  }
1921
1921
  };
1922
1922
 
1923
- const debug$e = Debug.get("UICreator");
1923
+ const debug$f = Debug.get("UICreator");
1924
1924
 
1925
1925
  const UICreator = {
1926
1926
  list: {},
1927
1927
  register(UI) {
1928
1928
  const {__tag: tag} = UI.prototype;
1929
- if (list$1[tag]) debug$e.repeat(tag);
1929
+ if (list$1[tag]) debug$f.repeat(tag);
1930
1930
  list$1[tag] = UI;
1931
1931
  },
1932
1932
  get(tag, data, x, y, width, height) {
1933
1933
  if (!list$1[tag]) {
1934
- debug$e.warn("not register " + tag);
1934
+ debug$f.warn("not register " + tag);
1935
1935
  return undefined;
1936
1936
  }
1937
1937
  const ui = new list$1[tag](data);
@@ -1947,7 +1947,7 @@ const UICreator = {
1947
1947
 
1948
1948
  const {list: list$1} = UICreator;
1949
1949
 
1950
- const debug$d = Debug.get("EventCreator");
1950
+ const debug$e = Debug.get("EventCreator");
1951
1951
 
1952
1952
  const EventCreator = {
1953
1953
  nameList: {},
@@ -1955,7 +1955,7 @@ const EventCreator = {
1955
1955
  let name;
1956
1956
  Object.keys(Event).forEach(key => {
1957
1957
  name = Event[key];
1958
- if (isString(name)) nameList[name] && debug$d.repeat(name), nameList[name] = Event;
1958
+ if (isString(name)) nameList[name] && debug$e.repeat(name), nameList[name] = Event;
1959
1959
  });
1960
1960
  },
1961
1961
  changeName(oldName, newName) {
@@ -3003,7 +3003,7 @@ const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse
3003
3003
 
3004
3004
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
3005
3005
 
3006
- const debug$c = Debug.get("PathConvert");
3006
+ const debug$d = 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$c.error(`command: ${command} [index:${i}]`, old);
3273
+ debug$d.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$1, abs: abs$4} = Math;
3333
3333
 
3334
3334
  const startPoint = {};
3335
3335
 
3336
+ const debug$c = 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$c.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$c.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$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3414
3427
 
@@ -4773,7 +4786,7 @@ function useModule(module, exclude) {
4773
4786
  if (!excludeNames.includes(name) && (!exclude || !exclude.includes(name))) {
4774
4787
  if (module.prototype) {
4775
4788
  const d = getDescriptor(module.prototype, name);
4776
- if (d.writable) target.prototype[name] = module.prototype[name];
4789
+ if (d) Object.defineProperty(target.prototype, name, d);
4777
4790
  } else {
4778
4791
  target.prototype[name] = module[name];
4779
4792
  }
@@ -7023,7 +7036,7 @@ class LeafLevelList {
7023
7036
  }
7024
7037
  }
7025
7038
 
7026
- const version = "2.2.4";
7039
+ const version = "2.2.6";
7027
7040
 
7028
7041
  class LeaferCanvas extends LeaferCanvasBase {
7029
7042
  get allowBackgroundColor() {
@@ -7995,7 +8008,7 @@ class Picker {
7995
8008
  if (child.__hitWorld(point, onlyHitMask && child.mask === "path" ? true : undefined)) {
7996
8009
  const {parent: parent, mask: mask} = child;
7997
8010
  if (parent && parent.__hasMask && mask && !(mask === "clipping" || mask === "clipping-path")) {
7998
- if (!parent.children.some(item => !item.mask && item.__hitWorld(point))) return;
8011
+ if (!parent.children.some(item => !item.mask && this.isHitLeaf(item, point))) return;
7999
8012
  }
8000
8013
  const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
8001
8014
  if (hitThrough) {
@@ -8005,6 +8018,15 @@ class Picker {
8005
8018
  findList.add(leaf);
8006
8019
  }
8007
8020
  }
8021
+ isHitLeaf(leaf, point) {
8022
+ if (leaf.isBranch) {
8023
+ const {findList: findList} = this, old = findList.length;
8024
+ this.eachFind([ leaf ], false);
8025
+ const count = findList.length - old;
8026
+ for (let i = 0; i < count; i++) findList.remove(findList.indexAt(findList.length - 1));
8027
+ return !!count;
8028
+ } else return leaf.__hitWorld(point);
8029
+ }
8008
8030
  clear() {
8009
8031
  this.point = null;
8010
8032
  this.findList = null;
@@ -8523,7 +8545,7 @@ const UIRender = {
8523
8545
  }
8524
8546
  if (data.__useEffect) {
8525
8547
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8526
- 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"));
8548
+ 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"));
8527
8549
  data.__useEffect = !!(shadow || otherEffect);
8528
8550
  }
8529
8551
  data.__checkSingle();
@@ -9581,7 +9603,7 @@ let Polygon = class Polygon extends UI {
9581
9603
  const data = this.__;
9582
9604
  const path = data.path = [];
9583
9605
  if (data.points) {
9584
- drawPoints$1(path, data.points, data.curve, data.closed);
9606
+ drawPoints$1(path, data.points, data.curve, data.closed, data);
9585
9607
  } else {
9586
9608
  const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9587
9609
  const rx = width / 2, ry = height / 2;
@@ -9673,7 +9695,7 @@ let Line = class Line extends UI {
9673
9695
  const data = this.__;
9674
9696
  const path = data.path = [];
9675
9697
  if (data.points) {
9676
- drawPoints(path, data.points, data.curve, data.closed);
9698
+ drawPoints(path, data.points, data.curve, data.closed, data);
9677
9699
  } else {
9678
9700
  moveTo(path, 0, 0);
9679
9701
  lineTo(path, this.width, 0);
@@ -13350,4 +13372,4 @@ try {
13350
13372
  if (wx) useCanvas("miniapp", wx);
13351
13373
  } catch (_a) {}
13352
13374
 
13353
- export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, 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, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
13375
+ export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, 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, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };