@leafer-ui/miniapp 1.4.2 → 1.5.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.
- package/dist/miniapp.cjs +6 -29
- package/dist/miniapp.cjs.map +1 -1
- package/dist/miniapp.esm.js +6 -29
- package/dist/miniapp.esm.js.map +1 -1
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +27 -49
- package/dist/miniapp.module.js.map +1 -1
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/miniapp.module.js
CHANGED
|
@@ -2029,13 +2029,11 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2029
2029
|
this.worldTransform = {};
|
|
2030
2030
|
if (!config)
|
|
2031
2031
|
config = minSize;
|
|
2032
|
-
if (!config.pixelRatio)
|
|
2033
|
-
config.pixelRatio = Platform.devicePixelRatio;
|
|
2034
2032
|
this.manager = manager;
|
|
2035
2033
|
this.innerId = IncrementId.create(IncrementId.CNAVAS);
|
|
2036
2034
|
const { width, height, pixelRatio } = config;
|
|
2037
2035
|
this.autoLayout = !width || !height;
|
|
2038
|
-
this.size.pixelRatio = pixelRatio;
|
|
2036
|
+
this.size.pixelRatio = pixelRatio | Platform.devicePixelRatio;
|
|
2039
2037
|
this.config = config;
|
|
2040
2038
|
this.init();
|
|
2041
2039
|
}
|
|
@@ -2232,7 +2230,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2232
2230
|
tempBounds$1.ceil();
|
|
2233
2231
|
}
|
|
2234
2232
|
isSameSize(size) {
|
|
2235
|
-
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
2233
|
+
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
2236
2234
|
}
|
|
2237
2235
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2238
2236
|
const canvas = this.manager ? this.manager.get(this.size) : Creator.canvas(Object.assign({}, this.size));
|
|
@@ -4070,13 +4068,10 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4070
4068
|
if (defaultValue === undefined) {
|
|
4071
4069
|
property.get = function () { return this[computedKey]; };
|
|
4072
4070
|
}
|
|
4073
|
-
else if (typeof defaultValue === '
|
|
4074
|
-
const { clone } = DataHelper;
|
|
4071
|
+
else if (typeof defaultValue === 'function') {
|
|
4075
4072
|
property.get = function () {
|
|
4076
4073
|
let v = this[computedKey];
|
|
4077
|
-
|
|
4078
|
-
this[computedKey] = v = clone(defaultValue);
|
|
4079
|
-
return v;
|
|
4074
|
+
return v === undefined ? defaultValue(this.__leaf) : v;
|
|
4080
4075
|
};
|
|
4081
4076
|
}
|
|
4082
4077
|
if (key === 'width') {
|
|
@@ -5722,10 +5717,10 @@ let Leaf = class Leaf {
|
|
|
5722
5717
|
static changeAttr(attrName, defaultValue, fn) {
|
|
5723
5718
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5724
5719
|
}
|
|
5725
|
-
static addAttr(attrName, defaultValue, fn) {
|
|
5720
|
+
static addAttr(attrName, defaultValue, fn, helpValue) {
|
|
5726
5721
|
if (!fn)
|
|
5727
5722
|
fn = boundsType;
|
|
5728
|
-
fn(defaultValue)(this.prototype, attrName);
|
|
5723
|
+
fn(defaultValue, helpValue)(this.prototype, attrName);
|
|
5729
5724
|
}
|
|
5730
5725
|
__emitLifeEvent(type) {
|
|
5731
5726
|
if (this.hasEvent(type))
|
|
@@ -6052,7 +6047,7 @@ class LeafLevelList {
|
|
|
6052
6047
|
}
|
|
6053
6048
|
}
|
|
6054
6049
|
|
|
6055
|
-
const version = "1.
|
|
6050
|
+
const version = "1.5.1";
|
|
6056
6051
|
|
|
6057
6052
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6058
6053
|
get allowBackgroundColor() { return false; }
|
|
@@ -7078,7 +7073,11 @@ const State = {
|
|
|
7078
7073
|
setStyleName() { return Plugin.need('state'); },
|
|
7079
7074
|
set() { return Plugin.need('state'); }
|
|
7080
7075
|
};
|
|
7081
|
-
const Transition = {
|
|
7076
|
+
const Transition = {
|
|
7077
|
+
list: {},
|
|
7078
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
7079
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
7080
|
+
};
|
|
7082
7081
|
|
|
7083
7082
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7084
7083
|
const emptyPaint = {};
|
|
@@ -7502,9 +7501,6 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7502
7501
|
this.__drawPathByBox(pen);
|
|
7503
7502
|
return pen;
|
|
7504
7503
|
}
|
|
7505
|
-
get editConfig() { return undefined; }
|
|
7506
|
-
get editOuter() { return ''; }
|
|
7507
|
-
get editInner() { return ''; }
|
|
7508
7504
|
constructor(data) {
|
|
7509
7505
|
super(data);
|
|
7510
7506
|
}
|
|
@@ -7586,8 +7582,11 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7586
7582
|
export(_filename, _options) {
|
|
7587
7583
|
return Plugin.need('export');
|
|
7588
7584
|
}
|
|
7585
|
+
syncExport(_filename, _options) {
|
|
7586
|
+
return Plugin.need('export');
|
|
7587
|
+
}
|
|
7589
7588
|
clone(data) {
|
|
7590
|
-
const json = this.toJSON();
|
|
7589
|
+
const json = DataHelper.clone(this.toJSON());
|
|
7591
7590
|
if (data)
|
|
7592
7591
|
Object.assign(json, data);
|
|
7593
7592
|
return UI_1.one(json);
|
|
@@ -7886,7 +7885,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7886
7885
|
get layoutLocked() { return !this.layouter.running; }
|
|
7887
7886
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7888
7887
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7889
|
-
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7888
|
+
get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || getBoundsData(); }
|
|
7890
7889
|
constructor(userConfig, data) {
|
|
7891
7890
|
super(data);
|
|
7892
7891
|
this.config = {
|
|
@@ -8188,6 +8187,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8188
8187
|
getPagePointByClient(clientPoint, updateClient) {
|
|
8189
8188
|
return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
|
|
8190
8189
|
}
|
|
8190
|
+
getClientPointByWorld(worldPoint) {
|
|
8191
|
+
const { x, y } = this.clientBounds;
|
|
8192
|
+
return { x: x + worldPoint.x, y: y + worldPoint.y };
|
|
8193
|
+
}
|
|
8191
8194
|
updateClientBounds() {
|
|
8192
8195
|
this.canvas && this.canvas.updateClientBounds();
|
|
8193
8196
|
}
|
|
@@ -10156,8 +10159,6 @@ ui$1.__updateHitCanvas = function () {
|
|
|
10156
10159
|
h.setStrokeOptions(data);
|
|
10157
10160
|
};
|
|
10158
10161
|
ui$1.__hit = function (inner) {
|
|
10159
|
-
if (Platform.name === 'miniapp')
|
|
10160
|
-
this.__drawHitPath(this.__hitCanvas);
|
|
10161
10162
|
const data = this.__;
|
|
10162
10163
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10163
10164
|
return true;
|
|
@@ -11617,13 +11618,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
11617
11618
|
}
|
|
11618
11619
|
|
|
11619
11620
|
function layoutText(drawData, style) {
|
|
11620
|
-
const { rows, bounds } = drawData;
|
|
11621
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
11621
11622
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
11622
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
11623
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11623
11624
|
let starY = __baseLine;
|
|
11624
11625
|
if (__clipText && realHeight > height) {
|
|
11625
11626
|
realHeight = Math.max(height, __lineHeight);
|
|
11626
|
-
|
|
11627
|
+
if (countRows > 1)
|
|
11628
|
+
drawData.overflow = countRows;
|
|
11627
11629
|
}
|
|
11628
11630
|
else if (height || autoSizeAlign) {
|
|
11629
11631
|
switch (verticalAlign) {
|
|
@@ -11635,7 +11637,7 @@ function layoutText(drawData, style) {
|
|
|
11635
11637
|
}
|
|
11636
11638
|
starY += y;
|
|
11637
11639
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
11638
|
-
for (let i = 0, len =
|
|
11640
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
11639
11641
|
row = rows[i];
|
|
11640
11642
|
row.x = x;
|
|
11641
11643
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -11704,7 +11706,7 @@ function clipText(drawData, style, x, width) {
|
|
|
11704
11706
|
if (i === end && charRight < right) {
|
|
11705
11707
|
break;
|
|
11706
11708
|
}
|
|
11707
|
-
else if (charRight < right && char.char !== ' ') {
|
|
11709
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
11708
11710
|
row.data.splice(i + 1);
|
|
11709
11711
|
row.width -= char.width;
|
|
11710
11712
|
break;
|
|
@@ -11843,29 +11845,5 @@ try {
|
|
|
11843
11845
|
}
|
|
11844
11846
|
catch (_a) { }
|
|
11845
11847
|
|
|
11846
|
-
const systemInfo = wx.getSystemInfoSync();
|
|
11847
|
-
const platform = systemInfo.platform;
|
|
11848
|
-
if (platform === 'ios') {
|
|
11849
|
-
LeaferImage.prototype.getPattern = function (canvas, repeat, transform, paint) {
|
|
11850
|
-
const pattern = Platform.canvas.createPattern(this.view, repeat);
|
|
11851
|
-
const { width, height } = canvas;
|
|
11852
|
-
if (this.width !== width || this.height !== height) {
|
|
11853
|
-
if (!transform)
|
|
11854
|
-
transform = MatrixHelper.get();
|
|
11855
|
-
MatrixHelper.scale(transform, width / this.width, height / this.height);
|
|
11856
|
-
}
|
|
11857
|
-
try {
|
|
11858
|
-
if (transform && pattern.setTransform) {
|
|
11859
|
-
pattern.setTransform(transform);
|
|
11860
|
-
transform = null;
|
|
11861
|
-
}
|
|
11862
|
-
}
|
|
11863
|
-
catch (_a) { }
|
|
11864
|
-
if (paint)
|
|
11865
|
-
paint.transform = transform;
|
|
11866
|
-
return pattern;
|
|
11867
|
-
};
|
|
11868
|
-
}
|
|
11869
|
-
|
|
11870
11848
|
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, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, 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, 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 };
|
|
11871
11849
|
//# sourceMappingURL=miniapp.module.js.map
|