@leafer-ui/miniapp 1.0.0-rc.26 → 1.0.0-rc.28
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.esm.js +19 -7
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.module.js +111 -63
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -11,8 +11,15 @@ const Platform = {
|
|
|
11
11
|
hitCanvasSize: 100,
|
|
12
12
|
maxCacheSize: 2560 * 1600,
|
|
13
13
|
maxPatternSize: 4096 * 2160,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
crossOrigin: 'anonymous',
|
|
15
|
+
getRealURL(url) {
|
|
16
|
+
const { prefix, suffix } = Platform.image;
|
|
17
|
+
if (suffix && !url.startsWith('data:') && !url.startsWith('blob:'))
|
|
18
|
+
url += (url.includes("?") ? "&" : "?") + suffix;
|
|
19
|
+
if (prefix && url[0] === '/')
|
|
20
|
+
url = prefix + url;
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
};
|
|
18
25
|
|
|
@@ -5126,6 +5133,7 @@ let Leaf = class Leaf {
|
|
|
5126
5133
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
5127
5134
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
5128
5135
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5136
|
+
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5129
5137
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5130
5138
|
constructor(data) {
|
|
5131
5139
|
this.innerId = create(LEAF);
|
|
@@ -5189,6 +5197,9 @@ let Leaf = class Leaf {
|
|
|
5189
5197
|
}
|
|
5190
5198
|
set(_data) { }
|
|
5191
5199
|
get(_name) { return undefined; }
|
|
5200
|
+
setAttr(name, value) { this[name] = value; }
|
|
5201
|
+
getAttr(name) { return this[name]; }
|
|
5202
|
+
getComputedAttr(name) { return this.__[name]; }
|
|
5192
5203
|
toJSON() {
|
|
5193
5204
|
return this.__.__getInputData();
|
|
5194
5205
|
}
|
|
@@ -5207,6 +5218,9 @@ let Leaf = class Leaf {
|
|
|
5207
5218
|
findOne(_condition, _options) { return undefined; }
|
|
5208
5219
|
findId(_id) { return undefined; }
|
|
5209
5220
|
focus(_value) { }
|
|
5221
|
+
updateLayout() {
|
|
5222
|
+
this.__layout.update();
|
|
5223
|
+
}
|
|
5210
5224
|
forceUpdate(attrName) {
|
|
5211
5225
|
if (attrName === undefined)
|
|
5212
5226
|
attrName = 'width';
|
|
@@ -5216,8 +5230,8 @@ let Leaf = class Leaf {
|
|
|
5216
5230
|
this.__[attrName] = value === undefined ? null : undefined;
|
|
5217
5231
|
this[attrName] = value;
|
|
5218
5232
|
}
|
|
5219
|
-
|
|
5220
|
-
this.
|
|
5233
|
+
forceRender(_bounds) {
|
|
5234
|
+
this.forceUpdate('surface');
|
|
5221
5235
|
}
|
|
5222
5236
|
__updateWorldMatrix() { }
|
|
5223
5237
|
__updateLocalMatrix() { }
|
|
@@ -5749,7 +5763,7 @@ class LeafLevelList {
|
|
|
5749
5763
|
}
|
|
5750
5764
|
}
|
|
5751
5765
|
|
|
5752
|
-
const version = "1.0.0-rc.
|
|
5766
|
+
const version = "1.0.0-rc.27";
|
|
5753
5767
|
const inviteCode = {};
|
|
5754
5768
|
|
|
5755
5769
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -5887,12 +5901,12 @@ function useCanvas(_canvasType, app) {
|
|
|
5887
5901
|
});
|
|
5888
5902
|
});
|
|
5889
5903
|
},
|
|
5890
|
-
loadImage(
|
|
5904
|
+
loadImage(src) {
|
|
5891
5905
|
return new Promise((resolve, reject) => {
|
|
5892
5906
|
const img = Platform.canvas.view.createImage();
|
|
5893
5907
|
img.onload = () => { resolve(img); };
|
|
5894
5908
|
img.onerror = (error) => { reject(error); };
|
|
5895
|
-
img.src =
|
|
5909
|
+
img.src = Platform.image.getRealURL(src);
|
|
5896
5910
|
});
|
|
5897
5911
|
},
|
|
5898
5912
|
noRepeat: 'repeat-x'
|
|
@@ -7212,6 +7226,8 @@ const UIRender = {
|
|
|
7212
7226
|
this.__drawRenderPath(canvas);
|
|
7213
7227
|
if (fill && !ignoreFill)
|
|
7214
7228
|
this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7229
|
+
if (this.__.__isCanvas)
|
|
7230
|
+
this.__drawAfterFill(canvas, options);
|
|
7215
7231
|
if (stroke && !ignoreStroke)
|
|
7216
7232
|
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7217
7233
|
}
|
|
@@ -7325,7 +7341,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7325
7341
|
__onUpdateSize() {
|
|
7326
7342
|
if (this.__.__input) {
|
|
7327
7343
|
const data = this.__;
|
|
7328
|
-
(data.lazy && this.
|
|
7344
|
+
(data.lazy && !this.__inLazyBounds && !Export.running) ? data.__needComputePaint = true : data.__computePaint();
|
|
7329
7345
|
}
|
|
7330
7346
|
}
|
|
7331
7347
|
__updateRenderPath() {
|
|
@@ -7634,6 +7650,9 @@ __decorate([
|
|
|
7634
7650
|
__decorate([
|
|
7635
7651
|
dataType()
|
|
7636
7652
|
], UI.prototype, "disabledStyle", void 0);
|
|
7653
|
+
__decorate([
|
|
7654
|
+
dataType({})
|
|
7655
|
+
], UI.prototype, "data", void 0);
|
|
7637
7656
|
__decorate([
|
|
7638
7657
|
rewrite(Leaf.prototype.reset)
|
|
7639
7658
|
], UI.prototype, "reset", null);
|
|
@@ -7880,6 +7899,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7880
7899
|
if (!this.parent)
|
|
7881
7900
|
this.canvas.hittable = newValue;
|
|
7882
7901
|
}
|
|
7902
|
+
else if (attrName === 'zIndex') {
|
|
7903
|
+
this.canvas.zIndex = newValue;
|
|
7904
|
+
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
7905
|
+
}
|
|
7883
7906
|
}
|
|
7884
7907
|
return super.__setAttr(attrName, newValue);
|
|
7885
7908
|
}
|
|
@@ -8476,7 +8499,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8476
8499
|
super(data);
|
|
8477
8500
|
this.canvas = Creator.canvas(this.__);
|
|
8478
8501
|
this.context = this.canvas.context;
|
|
8479
|
-
this.__.__drawAfterFill = true;
|
|
8502
|
+
this.__.__isCanvas = this.__.__drawAfterFill = true;
|
|
8480
8503
|
}
|
|
8481
8504
|
draw(ui, offset, scale, rotation) {
|
|
8482
8505
|
ui.__layout.update();
|
|
@@ -8498,7 +8521,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8498
8521
|
__drawAfterFill(canvas, _options) {
|
|
8499
8522
|
const origin = this.canvas.view;
|
|
8500
8523
|
const { width, height } = this;
|
|
8501
|
-
if (this.__.cornerRadius) {
|
|
8524
|
+
if (this.__.cornerRadius || this.pathInputed) {
|
|
8502
8525
|
canvas.save();
|
|
8503
8526
|
canvas.clip();
|
|
8504
8527
|
canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
|
|
@@ -8544,9 +8567,6 @@ __decorate([
|
|
|
8544
8567
|
__decorate([
|
|
8545
8568
|
resizeType()
|
|
8546
8569
|
], Canvas.prototype, "contextSettings", void 0);
|
|
8547
|
-
__decorate([
|
|
8548
|
-
hitType('all')
|
|
8549
|
-
], Canvas.prototype, "hitFill", void 0);
|
|
8550
8570
|
Canvas = __decorate([
|
|
8551
8571
|
registerUI()
|
|
8552
8572
|
], Canvas);
|
|
@@ -8843,15 +8863,17 @@ let App = class App extends Leafer {
|
|
|
8843
8863
|
this.add(leafer);
|
|
8844
8864
|
return leafer;
|
|
8845
8865
|
}
|
|
8846
|
-
add(leafer) {
|
|
8866
|
+
add(leafer, index) {
|
|
8847
8867
|
if (!leafer.view) {
|
|
8848
8868
|
if (this.realCanvas && !this.canvas.bounds) {
|
|
8849
|
-
setTimeout(() => this.add(leafer), 10);
|
|
8869
|
+
setTimeout(() => this.add(leafer, index), 10);
|
|
8850
8870
|
return;
|
|
8851
8871
|
}
|
|
8852
8872
|
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
8853
8873
|
}
|
|
8854
|
-
super.add(leafer);
|
|
8874
|
+
super.add(leafer, index);
|
|
8875
|
+
if (index !== undefined)
|
|
8876
|
+
leafer.canvas.childIndex = index;
|
|
8855
8877
|
this.__listenChildEvents(leafer);
|
|
8856
8878
|
}
|
|
8857
8879
|
__onPropertyChange() {
|
|
@@ -9013,20 +9035,32 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9013
9035
|
move.x = 0;
|
|
9014
9036
|
return move;
|
|
9015
9037
|
}
|
|
9016
|
-
static getMoveInDragBounds(
|
|
9017
|
-
const x =
|
|
9018
|
-
const right = x +
|
|
9038
|
+
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9039
|
+
const x = childBox.x + move.x, y = childBox.y + move.y;
|
|
9040
|
+
const right = x + childBox.width, bottom = y + childBox.height;
|
|
9019
9041
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9020
9042
|
if (!change)
|
|
9021
9043
|
move = Object.assign({}, move);
|
|
9022
|
-
if (
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9044
|
+
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9045
|
+
if (x > dragBounds.x)
|
|
9046
|
+
move.x += dragBounds.x - x;
|
|
9047
|
+
else if (right < boundsRight)
|
|
9048
|
+
move.x += boundsRight - right;
|
|
9049
|
+
if (y > dragBounds.y)
|
|
9050
|
+
move.y += dragBounds.y - y;
|
|
9051
|
+
else if (bottom < boundsBottom)
|
|
9052
|
+
move.y += boundsBottom - bottom;
|
|
9053
|
+
}
|
|
9054
|
+
else {
|
|
9055
|
+
if (x < dragBounds.x)
|
|
9056
|
+
move.x += dragBounds.x - x;
|
|
9057
|
+
else if (right > boundsRight)
|
|
9058
|
+
move.x += boundsRight - right;
|
|
9059
|
+
if (y < dragBounds.y)
|
|
9060
|
+
move.y += dragBounds.y - y;
|
|
9061
|
+
else if (bottom > boundsBottom)
|
|
9062
|
+
move.y += boundsBottom - bottom;
|
|
9063
|
+
}
|
|
9030
9064
|
return move;
|
|
9031
9065
|
}
|
|
9032
9066
|
getPageMove(total) {
|
|
@@ -9186,13 +9220,15 @@ const LeaferTypeCreator = {
|
|
|
9186
9220
|
};
|
|
9187
9221
|
const { list, register } = LeaferTypeCreator;
|
|
9188
9222
|
register('draw', () => { });
|
|
9223
|
+
register('custom', () => { });
|
|
9189
9224
|
register('design', addInteractionWindow);
|
|
9190
9225
|
register('document', document);
|
|
9191
9226
|
|
|
9192
|
-
Leafer.prototype
|
|
9227
|
+
const leafer = Leafer.prototype;
|
|
9228
|
+
leafer.initType = function (type) {
|
|
9193
9229
|
LeaferTypeCreator.run(type, this);
|
|
9194
9230
|
};
|
|
9195
|
-
|
|
9231
|
+
leafer.getValidMove = function (moveX, moveY) {
|
|
9196
9232
|
const { scroll, disabled } = this.app.config.move;
|
|
9197
9233
|
if (scroll) {
|
|
9198
9234
|
if (Math.abs(moveX) > Math.abs(moveY))
|
|
@@ -9222,7 +9258,7 @@ Leafer.prototype.getValidMove = function (moveX, moveY) {
|
|
|
9222
9258
|
}
|
|
9223
9259
|
return { x: disabled ? 0 : moveX, y: disabled ? 0 : moveY };
|
|
9224
9260
|
};
|
|
9225
|
-
|
|
9261
|
+
leafer.getValidScale = function (changeScale) {
|
|
9226
9262
|
const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
|
|
9227
9263
|
if (absScale < min)
|
|
9228
9264
|
changeScale = min / scaleX;
|
|
@@ -9678,7 +9714,7 @@ const config = {
|
|
|
9678
9714
|
swipeDistance: 20,
|
|
9679
9715
|
preventDefaultMenu: true
|
|
9680
9716
|
},
|
|
9681
|
-
cursor:
|
|
9717
|
+
cursor: true,
|
|
9682
9718
|
keyEvent: true
|
|
9683
9719
|
};
|
|
9684
9720
|
|
|
@@ -9991,7 +10027,7 @@ class InteractionBase {
|
|
|
9991
10027
|
this.hoverData = data;
|
|
9992
10028
|
}
|
|
9993
10029
|
updateCursor(data) {
|
|
9994
|
-
if (this.config.cursor
|
|
10030
|
+
if (!this.config.cursor || !this.config.pointer.hover)
|
|
9995
10031
|
return;
|
|
9996
10032
|
if (!data) {
|
|
9997
10033
|
this.updateHoverData();
|
|
@@ -10146,27 +10182,6 @@ class HitCanvasManager extends CanvasManager {
|
|
|
10146
10182
|
}
|
|
10147
10183
|
}
|
|
10148
10184
|
|
|
10149
|
-
const canvas$1 = LeaferCanvasBase.prototype;
|
|
10150
|
-
canvas$1.hitFill = function (point, fillRule) {
|
|
10151
|
-
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
10152
|
-
};
|
|
10153
|
-
canvas$1.hitStroke = function (point, strokeWidth) {
|
|
10154
|
-
this.strokeWidth = strokeWidth;
|
|
10155
|
-
return this.context.isPointInStroke(point.x, point.y);
|
|
10156
|
-
};
|
|
10157
|
-
canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
10158
|
-
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
10159
|
-
if (offset)
|
|
10160
|
-
x -= offset.x, y -= offset.y;
|
|
10161
|
-
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
10162
|
-
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
10163
|
-
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
10164
|
-
if (data[i + 3] > 0)
|
|
10165
|
-
return true;
|
|
10166
|
-
}
|
|
10167
|
-
return data[3] > 0;
|
|
10168
|
-
};
|
|
10169
|
-
|
|
10170
10185
|
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
10171
10186
|
const inner = {};
|
|
10172
10187
|
const leaf = Leaf.prototype;
|
|
@@ -10203,7 +10218,7 @@ const matrix = new Matrix();
|
|
|
10203
10218
|
const ui$2 = UI.prototype;
|
|
10204
10219
|
ui$2.__updateHitCanvas = function () {
|
|
10205
10220
|
const data = this.__, { hitCanvasManager } = this.leafer;
|
|
10206
|
-
const isHitPixelFill = data.__pixelFill && data.hitFill === 'pixel';
|
|
10221
|
+
const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10207
10222
|
const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
|
|
10208
10223
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10209
10224
|
if (!this.__hitCanvas)
|
|
@@ -10235,11 +10250,11 @@ ui$2.__hit = function (inner) {
|
|
|
10235
10250
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10236
10251
|
return true;
|
|
10237
10252
|
const { hitFill } = data;
|
|
10238
|
-
const needHitFillPath = (data.fill && hitFill
|
|
10253
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__pixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10239
10254
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10240
10255
|
return true;
|
|
10241
10256
|
const { hitStroke, __strokeWidth } = data;
|
|
10242
|
-
const needHitStrokePath = (data.stroke &&
|
|
10257
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__pixelStroke))) || hitStroke === 'all';
|
|
10243
10258
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10244
10259
|
return false;
|
|
10245
10260
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10271,7 +10286,7 @@ ui$2.__hit = function (inner) {
|
|
|
10271
10286
|
const ui$1 = new UI();
|
|
10272
10287
|
const rect = Rect.prototype;
|
|
10273
10288
|
rect.__updateHitCanvas = function () {
|
|
10274
|
-
if (this.stroke || this.cornerRadius || (this.fill && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10289
|
+
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10275
10290
|
ui$1.__updateHitCanvas.call(this);
|
|
10276
10291
|
else if (this.__hitCanvas)
|
|
10277
10292
|
this.__hitCanvas = null;
|
|
@@ -10294,6 +10309,27 @@ group.pick = function (hitPoint, options) {
|
|
|
10294
10309
|
return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this })) : null;
|
|
10295
10310
|
};
|
|
10296
10311
|
|
|
10312
|
+
const canvas$1 = LeaferCanvasBase.prototype;
|
|
10313
|
+
canvas$1.hitFill = function (point, fillRule) {
|
|
10314
|
+
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
10315
|
+
};
|
|
10316
|
+
canvas$1.hitStroke = function (point, strokeWidth) {
|
|
10317
|
+
this.strokeWidth = strokeWidth;
|
|
10318
|
+
return this.context.isPointInStroke(point.x, point.y);
|
|
10319
|
+
};
|
|
10320
|
+
canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
10321
|
+
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
10322
|
+
if (offset)
|
|
10323
|
+
x -= offset.x, y -= offset.y;
|
|
10324
|
+
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
10325
|
+
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
10326
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
10327
|
+
if (data[i + 3] > 0)
|
|
10328
|
+
return true;
|
|
10329
|
+
}
|
|
10330
|
+
return data[3] > 0;
|
|
10331
|
+
};
|
|
10332
|
+
|
|
10297
10333
|
const PointerEventHelper = {
|
|
10298
10334
|
convertTouch(e, local) {
|
|
10299
10335
|
const touch = PointerEventHelper.getTouch(e);
|
|
@@ -10998,7 +11034,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
10998
11034
|
width *= data.scaleX;
|
|
10999
11035
|
height *= data.scaleY;
|
|
11000
11036
|
}
|
|
11001
|
-
allowPaint = width * height > Platform.image.maxCacheSize;
|
|
11037
|
+
allowPaint = (width * height > Platform.image.maxCacheSize) || Export.running;
|
|
11002
11038
|
}
|
|
11003
11039
|
else {
|
|
11004
11040
|
allowPaint = false;
|
|
@@ -11510,7 +11546,8 @@ function createRows(drawData, content, style) {
|
|
|
11510
11546
|
if (breakAll) {
|
|
11511
11547
|
if (wordWidth)
|
|
11512
11548
|
addWord();
|
|
11513
|
-
|
|
11549
|
+
if (rowWidth)
|
|
11550
|
+
addRow();
|
|
11514
11551
|
}
|
|
11515
11552
|
else {
|
|
11516
11553
|
if (!afterBreak)
|
|
@@ -11518,10 +11555,12 @@ function createRows(drawData, content, style) {
|
|
|
11518
11555
|
if (langBreak || afterBreak || charType === Break || charType === Before || charType === Single || (wordWidth + charWidth > realWidth)) {
|
|
11519
11556
|
if (wordWidth)
|
|
11520
11557
|
addWord();
|
|
11521
|
-
|
|
11558
|
+
if (rowWidth)
|
|
11559
|
+
addRow();
|
|
11522
11560
|
}
|
|
11523
11561
|
else {
|
|
11524
|
-
|
|
11562
|
+
if (rowWidth)
|
|
11563
|
+
addRow();
|
|
11525
11564
|
}
|
|
11526
11565
|
}
|
|
11527
11566
|
}
|
|
@@ -11907,6 +11946,7 @@ const ExportModule = {
|
|
|
11907
11946
|
}
|
|
11908
11947
|
const { leafer } = leaf;
|
|
11909
11948
|
if (leafer) {
|
|
11949
|
+
checkLazy(leaf);
|
|
11910
11950
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
11911
11951
|
options = FileHelper.getExportOptions(options);
|
|
11912
11952
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
@@ -11914,6 +11954,8 @@ const ExportModule = {
|
|
|
11914
11954
|
const { slice, trim, onCanvas } = options;
|
|
11915
11955
|
let scale = options.scale || 1;
|
|
11916
11956
|
let pixelRatio = options.pixelRatio || 1;
|
|
11957
|
+
const smooth = options.smooth === undefined ? leafer.config.smooth : options.smooth;
|
|
11958
|
+
const contextSettings = options.contextSettings || leafer.config.contextSettings;
|
|
11917
11959
|
if (leaf.isApp) {
|
|
11918
11960
|
scale *= pixelRatio;
|
|
11919
11961
|
pixelRatio = leaf.app.pixelRatio;
|
|
@@ -11952,7 +11994,7 @@ const ExportModule = {
|
|
|
11952
11994
|
renderBounds = leaf.getBounds('render', relative);
|
|
11953
11995
|
}
|
|
11954
11996
|
const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
|
|
11955
|
-
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
|
|
11997
|
+
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
|
|
11956
11998
|
const renderOptions = { matrix: matrix.scale(1 / scale).invert().translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
11957
11999
|
if (slice) {
|
|
11958
12000
|
leaf = leafer;
|
|
@@ -11998,6 +12040,12 @@ function addTask(task) {
|
|
|
11998
12040
|
tasker.add(() => __awaiter(this, void 0, void 0, function* () { return yield task(resolve); }), { parallel: false });
|
|
11999
12041
|
});
|
|
12000
12042
|
}
|
|
12043
|
+
function checkLazy(leaf) {
|
|
12044
|
+
if (leaf.__.__needComputePaint)
|
|
12045
|
+
leaf.__.__computePaint();
|
|
12046
|
+
if (leaf.isBranch)
|
|
12047
|
+
leaf.children.forEach(child => checkLazy(child));
|
|
12048
|
+
}
|
|
12001
12049
|
|
|
12002
12050
|
const canvas = LeaferCanvasBase.prototype;
|
|
12003
12051
|
const debug = Debug.get('@leafer-ui/export');
|
|
@@ -12085,4 +12133,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
|
|
|
12085
12133
|
}
|
|
12086
12134
|
};
|
|
12087
12135
|
|
|
12088
|
-
export { AlignHelper, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, 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, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, 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, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, inviteCode, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
12136
|
+
export { AlignHelper, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, 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, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, 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, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, addInteractionWindow, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, inviteCode, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|