@leafer/core 1.3.3 → 1.4.0

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.esm.js CHANGED
@@ -3821,10 +3821,10 @@ function autoLayoutType(defaultValue) {
3821
3821
  return decorateLeafAttr(defaultValue, (key) => attr({
3822
3822
  set(value) {
3823
3823
  if (this.__setAttr(key, value)) {
3824
- this.__layout.matrixChanged || this.__layout.matrixChange();
3825
3824
  this.__hasAutoLayout = !!(this.origin || this.around || this.flow);
3826
3825
  if (!this.__local)
3827
3826
  this.__layout.createLocal();
3827
+ doBoundsType(this);
3828
3828
  }
3829
3829
  }
3830
3830
  }));
@@ -4207,55 +4207,62 @@ const LeafHelper = {
4207
4207
  y += t.y;
4208
4208
  transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4209
4209
  },
4210
- zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4211
- L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
4210
+ zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
4211
+ L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
4212
4212
  },
4213
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4214
- copy$3(matrix, t.__localMatrix);
4213
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
4214
+ const o = t.__localMatrix;
4215
+ if (typeof scaleY !== 'number') {
4216
+ if (scaleY)
4217
+ transition = scaleY;
4218
+ scaleY = scaleX;
4219
+ }
4220
+ copy$3(matrix, o);
4215
4221
  scaleOfOuter(matrix, origin, scaleX, scaleY);
4216
4222
  if (t.origin || t.around) {
4217
- L.setTransform(t, matrix, resize);
4223
+ L.setTransform(t, matrix, resize, transition);
4218
4224
  }
4219
4225
  else {
4220
- moveByMatrix(t, matrix);
4221
- t.scaleResize(scaleX, scaleY, resize !== true);
4226
+ const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4227
+ if (transition && !resize)
4228
+ t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4229
+ else
4230
+ t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
4222
4231
  }
4223
4232
  },
4224
- rotateOfWorld(t, origin, angle) {
4225
- L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4233
+ rotateOfWorld(t, origin, angle, transition) {
4234
+ L.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
4226
4235
  },
4227
- rotateOfLocal(t, origin, angle) {
4228
- copy$3(matrix, t.__localMatrix);
4236
+ rotateOfLocal(t, origin, angle, transition) {
4237
+ const o = t.__localMatrix;
4238
+ copy$3(matrix, o);
4229
4239
  rotateOfOuter(matrix, origin, angle);
4230
- if (t.origin || t.around) {
4231
- L.setTransform(t, matrix);
4232
- }
4233
- else {
4234
- moveByMatrix(t, matrix);
4235
- t.rotation = MathHelper.formatRotation(t.rotation + angle);
4236
- }
4240
+ if (t.origin || t.around)
4241
+ L.setTransform(t, matrix, false, transition);
4242
+ else
4243
+ t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4237
4244
  },
4238
- skewOfWorld(t, origin, skewX, skewY, resize) {
4239
- L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4245
+ skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4246
+ L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4240
4247
  },
4241
- skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4248
+ skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4242
4249
  copy$3(matrix, t.__localMatrix);
4243
4250
  skewOfOuter(matrix, origin, skewX, skewY);
4244
- L.setTransform(t, matrix, resize);
4251
+ L.setTransform(t, matrix, resize, transition);
4245
4252
  },
4246
- transformWorld(t, transform, resize) {
4253
+ transformWorld(t, transform, resize, transition) {
4247
4254
  copy$3(matrix, t.worldTransform);
4248
4255
  multiplyParent$2(matrix, transform);
4249
4256
  if (t.parent)
4250
4257
  divideParent(matrix, t.parent.worldTransform);
4251
- L.setTransform(t, matrix, resize);
4258
+ L.setTransform(t, matrix, resize, transition);
4252
4259
  },
4253
- transform(t, transform, resize) {
4260
+ transform(t, transform, resize, transition) {
4254
4261
  copy$3(matrix, t.localTransform);
4255
4262
  multiplyParent$2(matrix, transform);
4256
- L.setTransform(t, matrix, resize);
4263
+ L.setTransform(t, matrix, resize, transition);
4257
4264
  },
4258
- setTransform(t, transform, resize) {
4265
+ setTransform(t, transform, resize, transition) {
4259
4266
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4260
4267
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4261
4268
  if (resize) {
@@ -4270,7 +4277,7 @@ const LeafHelper = {
4270
4277
  t.scaleResize(scaleX, scaleY, false);
4271
4278
  }
4272
4279
  else
4273
- t.set(layout);
4280
+ t.set(layout, transition);
4274
4281
  },
4275
4282
  getFlipTransform(t, axis) {
4276
4283
  const m = getMatrixData();
@@ -4307,11 +4314,6 @@ const LeafHelper = {
4307
4314
  };
4308
4315
  const L = LeafHelper;
4309
4316
  const { updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity, updateAllChange } = L;
4310
- function moveByMatrix(t, matrix) {
4311
- const { e, f } = t.__localMatrix;
4312
- t.x += matrix.e - e;
4313
- t.y += matrix.f - f;
4314
- }
4315
4317
  function getTempLocal(t, world) {
4316
4318
  t.__layout.update();
4317
4319
  return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
@@ -5585,11 +5587,11 @@ let Leaf = class Leaf {
5585
5587
  const layer = this.leafer ? this.leafer.zoomLayer : this;
5586
5588
  return layer.getWorldPoint(page, relative, distance, change);
5587
5589
  }
5588
- setTransform(matrix, resize) {
5589
- setTransform(this, matrix, resize);
5590
+ setTransform(matrix, resize, transition) {
5591
+ setTransform(this, matrix, resize, transition);
5590
5592
  }
5591
- transform(matrix, resize) {
5592
- transform(this, matrix, resize);
5593
+ transform(matrix, resize, transition) {
5594
+ transform(this, matrix, resize, transition);
5593
5595
  }
5594
5596
  move(x, y, transition) {
5595
5597
  moveLocal(this, x, y, transition);
@@ -5597,32 +5599,32 @@ let Leaf = class Leaf {
5597
5599
  moveInner(x, y, transition) {
5598
5600
  moveWorld(this, x, y, true, transition);
5599
5601
  }
5600
- scaleOf(origin, scaleX, scaleY, resize) {
5601
- zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
5602
+ scaleOf(origin, scaleX, scaleY, resize, transition) {
5603
+ zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
5602
5604
  }
5603
- rotateOf(origin, rotation) {
5604
- rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
5605
+ rotateOf(origin, rotation, transition) {
5606
+ rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
5605
5607
  }
5606
- skewOf(origin, skewX, skewY, resize) {
5607
- skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
5608
+ skewOf(origin, skewX, skewY, resize, transition) {
5609
+ skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
5608
5610
  }
5609
- transformWorld(worldTransform, resize) {
5610
- transformWorld(this, worldTransform, resize);
5611
+ transformWorld(worldTransform, resize, transition) {
5612
+ transformWorld(this, worldTransform, resize, transition);
5611
5613
  }
5612
5614
  moveWorld(x, y, transition) {
5613
5615
  moveWorld(this, x, y, false, transition);
5614
5616
  }
5615
- scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5616
- zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
5617
+ scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
5618
+ zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
5617
5619
  }
5618
5620
  rotateOfWorld(worldOrigin, rotation) {
5619
5621
  rotateOfWorld(this, worldOrigin, rotation);
5620
5622
  }
5621
- skewOfWorld(worldOrigin, skewX, skewY, resize) {
5622
- skewOfWorld(this, worldOrigin, skewX, skewY, resize);
5623
+ skewOfWorld(worldOrigin, skewX, skewY, resize, transition) {
5624
+ skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition);
5623
5625
  }
5624
- flip(axis) {
5625
- transform(this, getFlipTransform(this, axis));
5626
+ flip(axis, transition) {
5627
+ transform(this, getFlipTransform(this, axis), false, transition);
5626
5628
  }
5627
5629
  scaleResize(scaleX, scaleY = scaleX, _noResize) {
5628
5630
  this.scaleX *= scaleX;
@@ -6010,6 +6012,7 @@ class LeafLevelList {
6010
6012
  }
6011
6013
  }
6012
6014
 
6013
- const version = "1.3.3";
6015
+ const version = "1.4.0";
6014
6016
 
6015
6017
  export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, 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, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
6018
+ //# sourceMappingURL=core.esm.js.map