@leafer-draw/miniapp 2.2.0 → 2.2.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.
@@ -4531,11 +4531,15 @@ function affectRenderBoundsType(defaultValue) {
4531
4531
  function surfaceType(defaultValue) {
4532
4532
  return decorateLeafAttr(defaultValue, key => attr({
4533
4533
  set(value) {
4534
- this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
4534
+ this.__setAttr(key, value) && doSurfaceType(this);
4535
4535
  }
4536
4536
  }));
4537
4537
  }
4538
4538
 
4539
+ function doSurfaceType(leaf) {
4540
+ leaf.__layout.surfaceChanged || leaf.__layout.surfaceChange();
4541
+ }
4542
+
4539
4543
  function dimType(defaultValue) {
4540
4544
  return decorateLeafAttr(defaultValue, key => attr({
4541
4545
  set(value) {
@@ -4601,12 +4605,12 @@ function sortType(defaultValue) {
4601
4605
  }));
4602
4606
  }
4603
4607
 
4604
- function maskType(defaultValue) {
4608
+ function maskType(defaultValue, updateSelf) {
4605
4609
  return decorateLeafAttr(defaultValue, key => attr({
4606
4610
  set(value) {
4607
4611
  if (this.__setAttr(key, value)) {
4608
4612
  this.__layout.boxChanged || this.__layout.boxChange();
4609
- this.waitParent(() => {
4613
+ updateSelf ? this.__updateMask() : this.waitParent(() => {
4610
4614
  this.parent.__updateMask(value);
4611
4615
  });
4612
4616
  }
@@ -6258,7 +6262,8 @@ const BranchRender = {
6258
6262
  if (this.__worldOpacity && hasSize(nowWorld)) {
6259
6263
  const data = this.__;
6260
6264
  if (data.__useDim) {
6261
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
6265
+ if (data.bright && !options.topRendering) return options.topList.add(this);
6266
+ if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
6262
6267
  }
6263
6268
  if (data.__single && !this.isBranchLeaf) {
6264
6269
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
@@ -6282,6 +6287,7 @@ const BranchRender = {
6282
6287
  child = children[i];
6283
6288
  excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
6284
6289
  }
6290
+ if (this.__hasMask === 0) this.__rerenderMask(canvas, options);
6285
6291
  }
6286
6292
  },
6287
6293
  __clip(canvas, options) {
@@ -6498,11 +6504,19 @@ let Leaf = class Leaf {
6498
6504
  updateLayout() {
6499
6505
  this.__layout.update();
6500
6506
  }
6501
- forceUpdate(attrName) {
6502
- if (isUndefined(attrName)) attrName = "width"; else if (attrName === "surface") attrName = "blendMode";
6503
- const value = this.__.__getInput(attrName);
6504
- this.__[attrName] = isUndefined(value) ? null : undefined;
6505
- this[attrName] = value;
6507
+ forceUpdate(typeOrAttrName) {
6508
+ let quick;
6509
+ if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
6510
+ quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
6511
+ if (quick) {
6512
+ const {leafer: leafer} = this;
6513
+ return leafer && leafer.watcher && leafer.watcher.__onAttrChange({
6514
+ target: this
6515
+ });
6516
+ }
6517
+ const value = this.__.__getInput(typeOrAttrName);
6518
+ this.__[typeOrAttrName] = isUndefined(value) ? null : undefined;
6519
+ this[typeOrAttrName] = value;
6506
6520
  }
6507
6521
  forceRender(_bounds, _sync) {
6508
6522
  this.forceUpdate("surface");
@@ -6521,7 +6535,8 @@ let Leaf = class Leaf {
6521
6535
  canvas.restore();
6522
6536
  }
6523
6537
  __updateMask(_value) {
6524
- this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6538
+ const hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6539
+ this.__hasMask = this.__.maskskip ? hasMask && 0 : hasMask;
6525
6540
  }
6526
6541
  __getNowWorld(options) {
6527
6542
  if (options.matrix) {
@@ -6990,7 +7005,7 @@ class LeafLevelList {
6990
7005
  }
6991
7006
  }
6992
7007
 
6993
- const version = "2.2.0";
7008
+ const version = "2.2.1";
6994
7009
 
6995
7010
  class LeaferCanvas extends LeaferCanvasBase {
6996
7011
  get allowBackgroundColor() {
@@ -8635,6 +8650,8 @@ __decorate([ dataType(false) ], UI.prototype, "editable", void 0);
8635
8650
 
8636
8651
  __decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
8637
8652
 
8653
+ __decorate([ hitType() ], UI.prototype, "hitThrough", void 0);
8654
+
8638
8655
  __decorate([ hitType("path") ], UI.prototype, "hitFill", void 0);
8639
8656
 
8640
8657
  __decorate([ strokeType("path") ], UI.prototype, "hitStroke", void 0);
@@ -10196,7 +10213,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
10196
10213
  data.__naturalWidth = image.width / data.pixelRatio;
10197
10214
  data.__naturalHeight = image.height / data.pixelRatio;
10198
10215
  if (data.__autoSide) {
10199
- ui.forceUpdate("width");
10216
+ ui.forceUpdate();
10200
10217
  LeafHelper.updateBounds(ui);
10201
10218
  ui.__layout.boundsChanged = true;
10202
10219
  if (ui.__proxyData) {
@@ -11472,4 +11489,4 @@ try {
11472
11489
  if (wx) useCanvas("miniapp", wx);
11473
11490
  } catch (_a) {}
11474
11491
 
11475
- 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, 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 };
11492
+ 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 };