@leafer-ui/worker 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/worker.cjs +6 -5
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.esm.js +6 -5
- package/dist/worker.esm.js.map +1 -0
- package/dist/worker.esm.min.js +2 -1
- package/dist/worker.esm.min.js.map +1 -0
- package/dist/worker.js +66 -64
- package/dist/worker.js.map +1 -0
- package/dist/worker.min.cjs +2 -1
- package/dist/worker.min.cjs.map +1 -0
- package/dist/worker.min.js +2 -1
- package/dist/worker.min.js.map +1 -0
- package/dist/worker.module.js +66 -64
- package/dist/worker.module.js.map +1 -0
- package/dist/worker.module.min.js +2 -1
- package/dist/worker.module.min.js.map +1 -0
- package/package.json +15 -15
package/dist/worker.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$7(matrix$1, o);
|
|
4215
4221
|
scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
|
|
4216
4222
|
if (t.origin || t.around) {
|
|
4217
|
-
L.setTransform(t, matrix$1, resize);
|
|
4223
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4218
4224
|
}
|
|
4219
4225
|
else {
|
|
4220
|
-
|
|
4221
|
-
|
|
4226
|
+
const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.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$7(matrix$1, o);
|
|
4229
4239
|
rotateOfOuter$2(matrix$1, origin, angle);
|
|
4230
|
-
if (t.origin || t.around)
|
|
4231
|
-
L.setTransform(t, matrix$1);
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
moveByMatrix(t, matrix$1);
|
|
4235
|
-
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4236
|
-
}
|
|
4240
|
+
if (t.origin || t.around)
|
|
4241
|
+
L.setTransform(t, matrix$1, false, transition);
|
|
4242
|
+
else
|
|
4243
|
+
t.set({ x: t.x + matrix$1.e - o.e, y: t.y + matrix$1.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$7(matrix$1, t.__localMatrix);
|
|
4243
4250
|
skewOfOuter(matrix$1, origin, skewX, skewY);
|
|
4244
|
-
L.setTransform(t, matrix$1, resize);
|
|
4251
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4245
4252
|
},
|
|
4246
|
-
transformWorld(t, transform, resize) {
|
|
4253
|
+
transformWorld(t, transform, resize, transition) {
|
|
4247
4254
|
copy$7(matrix$1, t.worldTransform);
|
|
4248
4255
|
multiplyParent$2(matrix$1, transform);
|
|
4249
4256
|
if (t.parent)
|
|
4250
4257
|
divideParent(matrix$1, t.parent.worldTransform);
|
|
4251
|
-
L.setTransform(t, matrix$1, resize);
|
|
4258
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4252
4259
|
},
|
|
4253
|
-
transform(t, transform, resize) {
|
|
4260
|
+
transform(t, transform, resize, transition) {
|
|
4254
4261
|
copy$7(matrix$1, t.localTransform);
|
|
4255
4262
|
multiplyParent$2(matrix$1, transform);
|
|
4256
|
-
L.setTransform(t, matrix$1, resize);
|
|
4263
|
+
L.setTransform(t, matrix$1, 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 true; }
|
|
@@ -9515,10 +9517,9 @@ class InteractionBase {
|
|
|
9515
9517
|
}
|
|
9516
9518
|
}
|
|
9517
9519
|
pointerMoveReal(data) {
|
|
9518
|
-
const { dragHover, dragDistance } = this.p;
|
|
9519
9520
|
this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9520
9521
|
if (this.downData) {
|
|
9521
|
-
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
9522
|
+
const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
|
|
9522
9523
|
if (canDrag) {
|
|
9523
9524
|
if (this.waitTap)
|
|
9524
9525
|
this.pointerWaitCancel();
|
|
@@ -9530,9 +9531,8 @@ class InteractionBase {
|
|
|
9530
9531
|
this.updateHoverData(data);
|
|
9531
9532
|
this.checkPath(data);
|
|
9532
9533
|
this.emit(PointerEvent.MOVE, data);
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
if (this.dragger.dragging) {
|
|
9534
|
+
this.pointerHover(data);
|
|
9535
|
+
if (this.dragging) {
|
|
9536
9536
|
this.dragger.dragOverOrOut(data);
|
|
9537
9537
|
this.dragger.dragEnterOrLeave(data);
|
|
9538
9538
|
}
|
|
@@ -9613,7 +9613,8 @@ class InteractionBase {
|
|
|
9613
9613
|
this.updateCursor();
|
|
9614
9614
|
}
|
|
9615
9615
|
pointerHover(data) {
|
|
9616
|
-
if (this.canHover) {
|
|
9616
|
+
if (this.canHover && !(this.dragging && !this.p.dragHover)) {
|
|
9617
|
+
data.path || (data.path = new LeafList());
|
|
9617
9618
|
this.pointerOverOrOut(data);
|
|
9618
9619
|
this.pointerEnterOrLeave(data);
|
|
9619
9620
|
}
|
|
@@ -11260,11 +11261,11 @@ const TextMode = 2;
|
|
|
11260
11261
|
function layoutChar(drawData, style, width, _height) {
|
|
11261
11262
|
const { rows } = drawData;
|
|
11262
11263
|
const { textAlign, paraIndent, letterSpacing } = style;
|
|
11263
|
-
let charX, addWordWidth, indentWidth, mode, wordChar;
|
|
11264
|
+
let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
|
|
11264
11265
|
rows.forEach(row => {
|
|
11265
11266
|
if (row.words) {
|
|
11266
|
-
indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
|
|
11267
|
-
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') &&
|
|
11267
|
+
indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
|
|
11268
|
+
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
|
|
11268
11269
|
mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
|
|
11269
11270
|
if (row.isOverflow && !letterSpacing)
|
|
11270
11271
|
row.textMode = true;
|
|
@@ -11276,7 +11277,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
11276
11277
|
row.x += indentWidth;
|
|
11277
11278
|
charX = row.x;
|
|
11278
11279
|
row.data = [];
|
|
11279
|
-
row.words.forEach(word => {
|
|
11280
|
+
row.words.forEach((word, index) => {
|
|
11280
11281
|
if (mode === WordMode) {
|
|
11281
11282
|
wordChar = { char: '', x: charX };
|
|
11282
11283
|
charX = toWordChar(word.data, charX, wordChar);
|
|
@@ -11286,7 +11287,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
11286
11287
|
else {
|
|
11287
11288
|
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11288
11289
|
}
|
|
11289
|
-
if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
|
|
11290
|
+
if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
|
|
11290
11291
|
charX += addWordWidth;
|
|
11291
11292
|
row.width += addWordWidth;
|
|
11292
11293
|
}
|
|
@@ -11543,3 +11544,4 @@ Object.assign(Creator, {
|
|
|
11543
11544
|
useCanvas();
|
|
11544
11545
|
|
|
11545
11546
|
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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 };
|
|
11547
|
+
//# sourceMappingURL=worker.module.js.map
|