@leafer-draw/miniapp 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/dist/miniapp.cjs +6 -5
- package/dist/miniapp.cjs.map +1 -0
- package/dist/miniapp.esm.js +6 -5
- package/dist/miniapp.esm.js.map +1 -0
- package/dist/miniapp.esm.min.js +2 -1
- package/dist/miniapp.esm.min.js.map +1 -0
- package/dist/miniapp.min.cjs +2 -1
- package/dist/miniapp.min.cjs.map +1 -0
- package/dist/miniapp.module.js +61 -58
- package/dist/miniapp.module.js.map +1 -0
- package/dist/miniapp.module.min.js +2 -1
- package/dist/miniapp.module.min.js.map +1 -0
- package/package.json +13 -13
package/dist/miniapp.module.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
|
-
|
|
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$6(matrix, o);
|
|
4215
4221
|
scaleOfOuter$2(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
|
-
|
|
4221
|
-
|
|
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
|
-
|
|
4236
|
+
rotateOfLocal(t, origin, angle, transition) {
|
|
4237
|
+
const o = t.__localMatrix;
|
|
4238
|
+
copy$6(matrix, o);
|
|
4229
4239
|
rotateOfOuter$2(matrix, origin, angle);
|
|
4230
|
-
if (t.origin || t.around)
|
|
4231
|
-
L.setTransform(t, matrix);
|
|
4232
|
-
|
|
4233
|
-
|
|
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$6(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$6(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$6(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$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = 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,7 +6012,7 @@ class LeafLevelList {
|
|
|
6010
6012
|
}
|
|
6011
6013
|
}
|
|
6012
6014
|
|
|
6013
|
-
const version = "1.
|
|
6015
|
+
const version = "1.4.0";
|
|
6014
6016
|
|
|
6015
6017
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6016
6018
|
get allowBackgroundColor() { return false; }
|
|
@@ -9955,11 +9957,11 @@ const TextMode = 2;
|
|
|
9955
9957
|
function layoutChar(drawData, style, width, _height) {
|
|
9956
9958
|
const { rows } = drawData;
|
|
9957
9959
|
const { textAlign, paraIndent, letterSpacing } = style;
|
|
9958
|
-
let charX, addWordWidth, indentWidth, mode, wordChar;
|
|
9960
|
+
let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
|
|
9959
9961
|
rows.forEach(row => {
|
|
9960
9962
|
if (row.words) {
|
|
9961
|
-
indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
|
|
9962
|
-
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') &&
|
|
9963
|
+
indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
|
|
9964
|
+
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
|
|
9963
9965
|
mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
|
|
9964
9966
|
if (row.isOverflow && !letterSpacing)
|
|
9965
9967
|
row.textMode = true;
|
|
@@ -9971,7 +9973,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
9971
9973
|
row.x += indentWidth;
|
|
9972
9974
|
charX = row.x;
|
|
9973
9975
|
row.data = [];
|
|
9974
|
-
row.words.forEach(word => {
|
|
9976
|
+
row.words.forEach((word, index) => {
|
|
9975
9977
|
if (mode === WordMode) {
|
|
9976
9978
|
wordChar = { char: '', x: charX };
|
|
9977
9979
|
charX = toWordChar(word.data, charX, wordChar);
|
|
@@ -9981,7 +9983,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
9981
9983
|
else {
|
|
9982
9984
|
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
9983
9985
|
}
|
|
9984
|
-
if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
|
|
9986
|
+
if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
|
|
9985
9987
|
charX += addWordWidth;
|
|
9986
9988
|
row.width += addWordWidth;
|
|
9987
9989
|
}
|
|
@@ -10237,3 +10239,4 @@ try {
|
|
|
10237
10239
|
catch (_a) { }
|
|
10238
10240
|
|
|
10239
10241
|
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, 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, 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, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
10242
|
+
//# sourceMappingURL=miniapp.module.js.map
|