@leafer-ui/worker 1.9.6 → 1.9.7
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 +10 -1
- package/dist/worker.esm.js +10 -1
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +45 -14
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +47 -15
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.module.js
CHANGED
|
@@ -423,6 +423,15 @@ const MatrixHelper = {
|
|
|
423
423
|
t.c *= scaleY;
|
|
424
424
|
t.d *= scaleY;
|
|
425
425
|
},
|
|
426
|
+
pixelScale(t, pixelRatio, to) {
|
|
427
|
+
to || (to = t);
|
|
428
|
+
to.a = t.a * pixelRatio;
|
|
429
|
+
to.b = t.b * pixelRatio;
|
|
430
|
+
to.c = t.c * pixelRatio;
|
|
431
|
+
to.d = t.d * pixelRatio;
|
|
432
|
+
to.e = t.e * pixelRatio;
|
|
433
|
+
to.f = t.f * pixelRatio;
|
|
434
|
+
},
|
|
426
435
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
427
436
|
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
428
437
|
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
@@ -922,6 +931,10 @@ class Matrix {
|
|
|
922
931
|
this.scaleY *= y || x;
|
|
923
932
|
return this;
|
|
924
933
|
}
|
|
934
|
+
pixelScale(pixelRatio) {
|
|
935
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
936
|
+
return this;
|
|
937
|
+
}
|
|
925
938
|
scaleOfOuter(origin, x, y) {
|
|
926
939
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
927
940
|
return this;
|
|
@@ -2146,7 +2159,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
|
|
|
2146
2159
|
|
|
2147
2160
|
__decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
|
|
2148
2161
|
|
|
2149
|
-
const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2162
|
+
const {copy: copy$8, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2150
2163
|
|
|
2151
2164
|
const minSize = {
|
|
2152
2165
|
width: 1,
|
|
@@ -2247,12 +2260,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2247
2260
|
setWorld(matrix, parentMatrix) {
|
|
2248
2261
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2249
2262
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2250
|
-
|
|
2251
|
-
w.b = matrix.b * pixelRatio;
|
|
2252
|
-
w.c = matrix.c * pixelRatio;
|
|
2253
|
-
w.d = matrix.d * pixelRatio;
|
|
2254
|
-
w.e = matrix.e * pixelRatio;
|
|
2255
|
-
w.f = matrix.f * pixelRatio;
|
|
2263
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2256
2264
|
if (pixelSnap) {
|
|
2257
2265
|
if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
|
|
2258
2266
|
w.f = round$1(w.f);
|
|
@@ -4265,6 +4273,18 @@ function surfaceType(defaultValue) {
|
|
|
4265
4273
|
}));
|
|
4266
4274
|
}
|
|
4267
4275
|
|
|
4276
|
+
function dimType(defaultValue) {
|
|
4277
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4278
|
+
set(value) {
|
|
4279
|
+
if (this.__setAttr(key, value)) {
|
|
4280
|
+
const data = this.__;
|
|
4281
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4282
|
+
this.__layout.surfaceChange();
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
}));
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4268
4288
|
function opacityType(defaultValue) {
|
|
4269
4289
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4270
4290
|
set(value) {
|
|
@@ -4309,7 +4329,7 @@ function sortType(defaultValue) {
|
|
|
4309
4329
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4310
4330
|
set(value) {
|
|
4311
4331
|
if (this.__setAttr(key, value)) {
|
|
4312
|
-
this.__layout.
|
|
4332
|
+
this.__layout.surfaceChange();
|
|
4313
4333
|
this.waitParent(() => {
|
|
4314
4334
|
this.parent.__layout.childrenSortChange();
|
|
4315
4335
|
});
|
|
@@ -4346,7 +4366,7 @@ function hitType(defaultValue) {
|
|
|
4346
4366
|
set(value) {
|
|
4347
4367
|
if (this.__setAttr(key, value)) {
|
|
4348
4368
|
this.__layout.hitCanvasChanged = true;
|
|
4349
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4369
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4350
4370
|
if (this.leafer) this.leafer.updateCursor();
|
|
4351
4371
|
}
|
|
4352
4372
|
}
|
|
@@ -5861,6 +5881,7 @@ const LeafRender = {
|
|
|
5861
5881
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5862
5882
|
if (this.__worldOpacity) {
|
|
5863
5883
|
const data = this.__;
|
|
5884
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5864
5885
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5865
5886
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5866
5887
|
if (this.__.__single) {
|
|
@@ -5909,7 +5930,9 @@ const BranchRender = {
|
|
|
5909
5930
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5910
5931
|
if (this.__worldOpacity) {
|
|
5911
5932
|
const data = this.__;
|
|
5912
|
-
if (data.
|
|
5933
|
+
if (data.__useDim) {
|
|
5934
|
+
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);
|
|
5935
|
+
}
|
|
5913
5936
|
if (data.__single && !this.isBranchLeaf) {
|
|
5914
5937
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5915
5938
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -6751,7 +6774,7 @@ class LeafLevelList {
|
|
|
6751
6774
|
}
|
|
6752
6775
|
}
|
|
6753
6776
|
|
|
6754
|
-
const version = "1.9.
|
|
6777
|
+
const version = "1.9.7";
|
|
6755
6778
|
|
|
6756
6779
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6757
6780
|
get allowBackgroundColor() {
|
|
@@ -7305,7 +7328,7 @@ class Renderer {
|
|
|
7305
7328
|
};
|
|
7306
7329
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7307
7330
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7308
|
-
this.target
|
|
7331
|
+
Platform.render(this.target, canvas, options);
|
|
7309
7332
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7310
7333
|
this.renderOptions = options;
|
|
7311
7334
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7581,6 +7604,15 @@ Object.assign(Creator, {
|
|
|
7581
7604
|
|
|
7582
7605
|
Platform.layout = Layouter.fullLayout;
|
|
7583
7606
|
|
|
7607
|
+
Platform.render = function(target, canvas, options) {
|
|
7608
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7609
|
+
topRendering: true
|
|
7610
|
+
});
|
|
7611
|
+
options.topList = new LeafList;
|
|
7612
|
+
target.__render(canvas, options);
|
|
7613
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7614
|
+
};
|
|
7615
|
+
|
|
7584
7616
|
function effectType(defaultValue) {
|
|
7585
7617
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7586
7618
|
set(value) {
|
|
@@ -8356,9 +8388,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
|
|
|
8356
8388
|
|
|
8357
8389
|
__decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
|
|
8358
8390
|
|
|
8359
|
-
__decorate([
|
|
8391
|
+
__decorate([ dimType(false) ], UI.prototype, "dim", void 0);
|
|
8360
8392
|
|
|
8361
|
-
__decorate([
|
|
8393
|
+
__decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
|
|
8362
8394
|
|
|
8363
8395
|
__decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
|
|
8364
8396
|
|
|
@@ -12584,4 +12616,4 @@ Object.assign(Creator, {
|
|
|
12584
12616
|
|
|
12585
12617
|
useCanvas();
|
|
12586
12618
|
|
|
12587
|
-
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, 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, Resource, 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, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, 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$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
12619
|
+
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, 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, Resource, 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, 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$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|