leafer-ui 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/README.md +7 -3
- package/dist/web.esm.js +43 -12
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +135 -67
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +135 -68
- package/dist/web.module.min.js +1 -1
- package/package.json +11 -11
package/dist/web.js
CHANGED
|
@@ -14,8 +14,15 @@ var LeaferUI = (function (exports) {
|
|
|
14
14
|
hitCanvasSize: 100,
|
|
15
15
|
maxCacheSize: 2560 * 1600,
|
|
16
16
|
maxPatternSize: 4096 * 2160,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
crossOrigin: 'anonymous',
|
|
18
|
+
getRealURL(url) {
|
|
19
|
+
const { prefix, suffix } = Platform.image;
|
|
20
|
+
if (suffix && !url.startsWith('data:') && !url.startsWith('blob:'))
|
|
21
|
+
url += (url.includes("?") ? "&" : "?") + suffix;
|
|
22
|
+
if (prefix && url[0] === '/')
|
|
23
|
+
url = prefix + url;
|
|
24
|
+
return url;
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
};
|
|
21
28
|
|
|
@@ -5129,6 +5136,7 @@ var LeaferUI = (function (exports) {
|
|
|
5129
5136
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
5130
5137
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
5131
5138
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5139
|
+
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5132
5140
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5133
5141
|
constructor(data) {
|
|
5134
5142
|
this.innerId = create(LEAF);
|
|
@@ -5192,6 +5200,9 @@ var LeaferUI = (function (exports) {
|
|
|
5192
5200
|
}
|
|
5193
5201
|
set(_data) { }
|
|
5194
5202
|
get(_name) { return undefined; }
|
|
5203
|
+
setAttr(name, value) { this[name] = value; }
|
|
5204
|
+
getAttr(name) { return this[name]; }
|
|
5205
|
+
getComputedAttr(name) { return this.__[name]; }
|
|
5195
5206
|
toJSON() {
|
|
5196
5207
|
return this.__.__getInputData();
|
|
5197
5208
|
}
|
|
@@ -5210,6 +5221,9 @@ var LeaferUI = (function (exports) {
|
|
|
5210
5221
|
findOne(_condition, _options) { return undefined; }
|
|
5211
5222
|
findId(_id) { return undefined; }
|
|
5212
5223
|
focus(_value) { }
|
|
5224
|
+
updateLayout() {
|
|
5225
|
+
this.__layout.update();
|
|
5226
|
+
}
|
|
5213
5227
|
forceUpdate(attrName) {
|
|
5214
5228
|
if (attrName === undefined)
|
|
5215
5229
|
attrName = 'width';
|
|
@@ -5219,8 +5233,8 @@ var LeaferUI = (function (exports) {
|
|
|
5219
5233
|
this.__[attrName] = value === undefined ? null : undefined;
|
|
5220
5234
|
this[attrName] = value;
|
|
5221
5235
|
}
|
|
5222
|
-
|
|
5223
|
-
this.
|
|
5236
|
+
forceRender(_bounds) {
|
|
5237
|
+
this.forceUpdate('surface');
|
|
5224
5238
|
}
|
|
5225
5239
|
__updateWorldMatrix() { }
|
|
5226
5240
|
__updateLocalMatrix() { }
|
|
@@ -5752,11 +5766,29 @@ var LeaferUI = (function (exports) {
|
|
|
5752
5766
|
}
|
|
5753
5767
|
}
|
|
5754
5768
|
|
|
5755
|
-
const version = "1.0.0-rc.
|
|
5769
|
+
const version = "1.0.0-rc.27";
|
|
5756
5770
|
const inviteCode = {};
|
|
5757
5771
|
|
|
5758
5772
|
const debug$7 = Debug.get('LeaferCanvas');
|
|
5759
5773
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5774
|
+
set zIndex(zIndex) {
|
|
5775
|
+
const { style } = this.view;
|
|
5776
|
+
style.zIndex = zIndex;
|
|
5777
|
+
this.setAbsolute(this.view);
|
|
5778
|
+
}
|
|
5779
|
+
set childIndex(index) {
|
|
5780
|
+
const { view, parentView } = this;
|
|
5781
|
+
if (view && parentView) {
|
|
5782
|
+
const beforeNode = parentView.children[index];
|
|
5783
|
+
if (beforeNode) {
|
|
5784
|
+
this.setAbsolute(beforeNode);
|
|
5785
|
+
parentView.insertBefore(view, beforeNode);
|
|
5786
|
+
}
|
|
5787
|
+
else {
|
|
5788
|
+
parentView.appendChild(beforeNode);
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5760
5792
|
init() {
|
|
5761
5793
|
const { view } = this.config;
|
|
5762
5794
|
view ? this.__createViewFrom(view) : this.__createView();
|
|
@@ -5801,9 +5833,7 @@ var LeaferUI = (function (exports) {
|
|
|
5801
5833
|
this.__createView();
|
|
5802
5834
|
const view = this.view;
|
|
5803
5835
|
if (parent.hasChildNodes()) {
|
|
5804
|
-
|
|
5805
|
-
style.position = 'absolute';
|
|
5806
|
-
style.top = style.left = '0px';
|
|
5836
|
+
this.setAbsolute(view);
|
|
5807
5837
|
parent.style.position || (parent.style.position = 'relative');
|
|
5808
5838
|
}
|
|
5809
5839
|
parent.appendChild(view);
|
|
@@ -5814,6 +5844,11 @@ var LeaferUI = (function (exports) {
|
|
|
5814
5844
|
this.__createView();
|
|
5815
5845
|
}
|
|
5816
5846
|
}
|
|
5847
|
+
setAbsolute(view) {
|
|
5848
|
+
const { style } = view;
|
|
5849
|
+
style.position = 'absolute';
|
|
5850
|
+
style.top = style.left = '0px';
|
|
5851
|
+
}
|
|
5817
5852
|
updateViewSize() {
|
|
5818
5853
|
const { width, height, pixelRatio } = this;
|
|
5819
5854
|
const { style } = this.view;
|
|
@@ -5933,16 +5968,14 @@ var LeaferUI = (function (exports) {
|
|
|
5933
5968
|
loadImage(src) {
|
|
5934
5969
|
return new Promise((resolve, reject) => {
|
|
5935
5970
|
const img = new Image();
|
|
5936
|
-
const {
|
|
5971
|
+
const { crossOrigin } = Platform.image;
|
|
5937
5972
|
if (crossOrigin) {
|
|
5938
5973
|
img.setAttribute('crossOrigin', crossOrigin);
|
|
5939
5974
|
img.crossOrigin = crossOrigin;
|
|
5940
5975
|
}
|
|
5941
5976
|
img.onload = () => { resolve(img); };
|
|
5942
5977
|
img.onerror = (e) => { reject(e); };
|
|
5943
|
-
|
|
5944
|
-
src += (src.includes("?") ? "&" : "?") + suffix;
|
|
5945
|
-
img.src = src;
|
|
5978
|
+
img.src = Platform.image.getRealURL(src);
|
|
5946
5979
|
});
|
|
5947
5980
|
}
|
|
5948
5981
|
};
|
|
@@ -7227,6 +7260,8 @@ var LeaferUI = (function (exports) {
|
|
|
7227
7260
|
this.__drawRenderPath(canvas);
|
|
7228
7261
|
if (fill && !ignoreFill)
|
|
7229
7262
|
this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7263
|
+
if (this.__.__isCanvas)
|
|
7264
|
+
this.__drawAfterFill(canvas, options);
|
|
7230
7265
|
if (stroke && !ignoreStroke)
|
|
7231
7266
|
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7232
7267
|
}
|
|
@@ -7340,7 +7375,7 @@ var LeaferUI = (function (exports) {
|
|
|
7340
7375
|
__onUpdateSize() {
|
|
7341
7376
|
if (this.__.__input) {
|
|
7342
7377
|
const data = this.__;
|
|
7343
|
-
(data.lazy && this.
|
|
7378
|
+
(data.lazy && !this.__inLazyBounds && !Export.running) ? data.__needComputePaint = true : data.__computePaint();
|
|
7344
7379
|
}
|
|
7345
7380
|
}
|
|
7346
7381
|
__updateRenderPath() {
|
|
@@ -7649,6 +7684,9 @@ var LeaferUI = (function (exports) {
|
|
|
7649
7684
|
__decorate([
|
|
7650
7685
|
dataType()
|
|
7651
7686
|
], exports.UI.prototype, "disabledStyle", void 0);
|
|
7687
|
+
__decorate([
|
|
7688
|
+
dataType({})
|
|
7689
|
+
], exports.UI.prototype, "data", void 0);
|
|
7652
7690
|
__decorate([
|
|
7653
7691
|
rewrite(exports.Leaf.prototype.reset)
|
|
7654
7692
|
], exports.UI.prototype, "reset", null);
|
|
@@ -7895,6 +7933,10 @@ var LeaferUI = (function (exports) {
|
|
|
7895
7933
|
if (!this.parent)
|
|
7896
7934
|
this.canvas.hittable = newValue;
|
|
7897
7935
|
}
|
|
7936
|
+
else if (attrName === 'zIndex') {
|
|
7937
|
+
this.canvas.zIndex = newValue;
|
|
7938
|
+
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
7939
|
+
}
|
|
7898
7940
|
}
|
|
7899
7941
|
return super.__setAttr(attrName, newValue);
|
|
7900
7942
|
}
|
|
@@ -8491,7 +8533,7 @@ var LeaferUI = (function (exports) {
|
|
|
8491
8533
|
super(data);
|
|
8492
8534
|
this.canvas = Creator.canvas(this.__);
|
|
8493
8535
|
this.context = this.canvas.context;
|
|
8494
|
-
this.__.__drawAfterFill = true;
|
|
8536
|
+
this.__.__isCanvas = this.__.__drawAfterFill = true;
|
|
8495
8537
|
}
|
|
8496
8538
|
draw(ui, offset, scale, rotation) {
|
|
8497
8539
|
ui.__layout.update();
|
|
@@ -8513,7 +8555,7 @@ var LeaferUI = (function (exports) {
|
|
|
8513
8555
|
__drawAfterFill(canvas, _options) {
|
|
8514
8556
|
const origin = this.canvas.view;
|
|
8515
8557
|
const { width, height } = this;
|
|
8516
|
-
if (this.__.cornerRadius) {
|
|
8558
|
+
if (this.__.cornerRadius || this.pathInputed) {
|
|
8517
8559
|
canvas.save();
|
|
8518
8560
|
canvas.clip();
|
|
8519
8561
|
canvas.drawImage(this.canvas.view, 0, 0, origin.width, origin.height, 0, 0, width, height);
|
|
@@ -8559,9 +8601,6 @@ var LeaferUI = (function (exports) {
|
|
|
8559
8601
|
__decorate([
|
|
8560
8602
|
resizeType()
|
|
8561
8603
|
], exports.Canvas.prototype, "contextSettings", void 0);
|
|
8562
|
-
__decorate([
|
|
8563
|
-
hitType('all')
|
|
8564
|
-
], exports.Canvas.prototype, "hitFill", void 0);
|
|
8565
8604
|
exports.Canvas = __decorate([
|
|
8566
8605
|
registerUI()
|
|
8567
8606
|
], exports.Canvas);
|
|
@@ -8858,15 +8897,17 @@ var LeaferUI = (function (exports) {
|
|
|
8858
8897
|
this.add(leafer);
|
|
8859
8898
|
return leafer;
|
|
8860
8899
|
}
|
|
8861
|
-
add(leafer) {
|
|
8900
|
+
add(leafer, index) {
|
|
8862
8901
|
if (!leafer.view) {
|
|
8863
8902
|
if (this.realCanvas && !this.canvas.bounds) {
|
|
8864
|
-
setTimeout(() => this.add(leafer), 10);
|
|
8903
|
+
setTimeout(() => this.add(leafer, index), 10);
|
|
8865
8904
|
return;
|
|
8866
8905
|
}
|
|
8867
8906
|
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
8868
8907
|
}
|
|
8869
|
-
super.add(leafer);
|
|
8908
|
+
super.add(leafer, index);
|
|
8909
|
+
if (index !== undefined)
|
|
8910
|
+
leafer.canvas.childIndex = index;
|
|
8870
8911
|
this.__listenChildEvents(leafer);
|
|
8871
8912
|
}
|
|
8872
8913
|
__onPropertyChange() {
|
|
@@ -9028,20 +9069,32 @@ var LeaferUI = (function (exports) {
|
|
|
9028
9069
|
move.x = 0;
|
|
9029
9070
|
return move;
|
|
9030
9071
|
}
|
|
9031
|
-
static getMoveInDragBounds(
|
|
9032
|
-
const x =
|
|
9033
|
-
const right = x +
|
|
9072
|
+
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9073
|
+
const x = childBox.x + move.x, y = childBox.y + move.y;
|
|
9074
|
+
const right = x + childBox.width, bottom = y + childBox.height;
|
|
9034
9075
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9035
9076
|
if (!change)
|
|
9036
9077
|
move = Object.assign({}, move);
|
|
9037
|
-
if (
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9078
|
+
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9079
|
+
if (x > dragBounds.x)
|
|
9080
|
+
move.x += dragBounds.x - x;
|
|
9081
|
+
else if (right < boundsRight)
|
|
9082
|
+
move.x += boundsRight - right;
|
|
9083
|
+
if (y > dragBounds.y)
|
|
9084
|
+
move.y += dragBounds.y - y;
|
|
9085
|
+
else if (bottom < boundsBottom)
|
|
9086
|
+
move.y += boundsBottom - bottom;
|
|
9087
|
+
}
|
|
9088
|
+
else {
|
|
9089
|
+
if (x < dragBounds.x)
|
|
9090
|
+
move.x += dragBounds.x - x;
|
|
9091
|
+
else if (right > boundsRight)
|
|
9092
|
+
move.x += boundsRight - right;
|
|
9093
|
+
if (y < dragBounds.y)
|
|
9094
|
+
move.y += dragBounds.y - y;
|
|
9095
|
+
else if (bottom > boundsBottom)
|
|
9096
|
+
move.y += boundsBottom - bottom;
|
|
9097
|
+
}
|
|
9045
9098
|
return move;
|
|
9046
9099
|
}
|
|
9047
9100
|
getPageMove(total) {
|
|
@@ -9201,13 +9254,15 @@ var LeaferUI = (function (exports) {
|
|
|
9201
9254
|
};
|
|
9202
9255
|
const { list, register } = LeaferTypeCreator;
|
|
9203
9256
|
register('draw', () => { });
|
|
9257
|
+
register('custom', () => { });
|
|
9204
9258
|
register('design', addInteractionWindow);
|
|
9205
9259
|
register('document', document$1);
|
|
9206
9260
|
|
|
9207
|
-
exports.Leafer.prototype
|
|
9261
|
+
const leafer = exports.Leafer.prototype;
|
|
9262
|
+
leafer.initType = function (type) {
|
|
9208
9263
|
LeaferTypeCreator.run(type, this);
|
|
9209
9264
|
};
|
|
9210
|
-
|
|
9265
|
+
leafer.getValidMove = function (moveX, moveY) {
|
|
9211
9266
|
const { scroll, disabled } = this.app.config.move;
|
|
9212
9267
|
if (scroll) {
|
|
9213
9268
|
if (Math.abs(moveX) > Math.abs(moveY))
|
|
@@ -9237,7 +9292,7 @@ var LeaferUI = (function (exports) {
|
|
|
9237
9292
|
}
|
|
9238
9293
|
return { x: disabled ? 0 : moveX, y: disabled ? 0 : moveY };
|
|
9239
9294
|
};
|
|
9240
|
-
|
|
9295
|
+
leafer.getValidScale = function (changeScale) {
|
|
9241
9296
|
const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
|
|
9242
9297
|
if (absScale < min)
|
|
9243
9298
|
changeScale = min / scaleX;
|
|
@@ -9693,7 +9748,7 @@ var LeaferUI = (function (exports) {
|
|
|
9693
9748
|
swipeDistance: 20,
|
|
9694
9749
|
preventDefaultMenu: true
|
|
9695
9750
|
},
|
|
9696
|
-
cursor:
|
|
9751
|
+
cursor: true,
|
|
9697
9752
|
keyEvent: true
|
|
9698
9753
|
};
|
|
9699
9754
|
|
|
@@ -10006,7 +10061,7 @@ var LeaferUI = (function (exports) {
|
|
|
10006
10061
|
this.hoverData = data;
|
|
10007
10062
|
}
|
|
10008
10063
|
updateCursor(data) {
|
|
10009
|
-
if (this.config.cursor
|
|
10064
|
+
if (!this.config.cursor || !this.config.pointer.hover)
|
|
10010
10065
|
return;
|
|
10011
10066
|
if (!data) {
|
|
10012
10067
|
this.updateHoverData();
|
|
@@ -10161,27 +10216,6 @@ var LeaferUI = (function (exports) {
|
|
|
10161
10216
|
}
|
|
10162
10217
|
}
|
|
10163
10218
|
|
|
10164
|
-
const canvas$1 = LeaferCanvasBase.prototype;
|
|
10165
|
-
canvas$1.hitFill = function (point, fillRule) {
|
|
10166
|
-
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
10167
|
-
};
|
|
10168
|
-
canvas$1.hitStroke = function (point, strokeWidth) {
|
|
10169
|
-
this.strokeWidth = strokeWidth;
|
|
10170
|
-
return this.context.isPointInStroke(point.x, point.y);
|
|
10171
|
-
};
|
|
10172
|
-
canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
10173
|
-
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
10174
|
-
if (offset)
|
|
10175
|
-
x -= offset.x, y -= offset.y;
|
|
10176
|
-
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
10177
|
-
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
10178
|
-
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
10179
|
-
if (data[i + 3] > 0)
|
|
10180
|
-
return true;
|
|
10181
|
-
}
|
|
10182
|
-
return data[3] > 0;
|
|
10183
|
-
};
|
|
10184
|
-
|
|
10185
10219
|
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
10186
10220
|
const inner = {};
|
|
10187
10221
|
const leaf = exports.Leaf.prototype;
|
|
@@ -10218,7 +10252,7 @@ var LeaferUI = (function (exports) {
|
|
|
10218
10252
|
const ui$2 = exports.UI.prototype;
|
|
10219
10253
|
ui$2.__updateHitCanvas = function () {
|
|
10220
10254
|
const data = this.__, { hitCanvasManager } = this.leafer;
|
|
10221
|
-
const isHitPixelFill = data.__pixelFill && data.hitFill === 'pixel';
|
|
10255
|
+
const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10222
10256
|
const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
|
|
10223
10257
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10224
10258
|
if (!this.__hitCanvas)
|
|
@@ -10250,11 +10284,11 @@ var LeaferUI = (function (exports) {
|
|
|
10250
10284
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10251
10285
|
return true;
|
|
10252
10286
|
const { hitFill } = data;
|
|
10253
|
-
const needHitFillPath = (data.fill && hitFill
|
|
10287
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__pixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10254
10288
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10255
10289
|
return true;
|
|
10256
10290
|
const { hitStroke, __strokeWidth } = data;
|
|
10257
|
-
const needHitStrokePath = (data.stroke &&
|
|
10291
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__pixelStroke))) || hitStroke === 'all';
|
|
10258
10292
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10259
10293
|
return false;
|
|
10260
10294
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10286,7 +10320,7 @@ var LeaferUI = (function (exports) {
|
|
|
10286
10320
|
const ui$1 = new exports.UI();
|
|
10287
10321
|
const rect = exports.Rect.prototype;
|
|
10288
10322
|
rect.__updateHitCanvas = function () {
|
|
10289
|
-
if (this.stroke || this.cornerRadius || (this.fill && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10323
|
+
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10290
10324
|
ui$1.__updateHitCanvas.call(this);
|
|
10291
10325
|
else if (this.__hitCanvas)
|
|
10292
10326
|
this.__hitCanvas = null;
|
|
@@ -10309,6 +10343,27 @@ var LeaferUI = (function (exports) {
|
|
|
10309
10343
|
return this.leafer ? this.leafer.selector.getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this })) : null;
|
|
10310
10344
|
};
|
|
10311
10345
|
|
|
10346
|
+
const canvas$1 = LeaferCanvasBase.prototype;
|
|
10347
|
+
canvas$1.hitFill = function (point, fillRule) {
|
|
10348
|
+
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
10349
|
+
};
|
|
10350
|
+
canvas$1.hitStroke = function (point, strokeWidth) {
|
|
10351
|
+
this.strokeWidth = strokeWidth;
|
|
10352
|
+
return this.context.isPointInStroke(point.x, point.y);
|
|
10353
|
+
};
|
|
10354
|
+
canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
10355
|
+
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
10356
|
+
if (offset)
|
|
10357
|
+
x -= offset.x, y -= offset.y;
|
|
10358
|
+
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
10359
|
+
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
10360
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
10361
|
+
if (data[i + 3] > 0)
|
|
10362
|
+
return true;
|
|
10363
|
+
}
|
|
10364
|
+
return data[3] > 0;
|
|
10365
|
+
};
|
|
10366
|
+
|
|
10312
10367
|
const PointerEventHelper = {
|
|
10313
10368
|
convert(e, local) {
|
|
10314
10369
|
const base = InteractionHelper.getBase(e);
|
|
@@ -11255,7 +11310,7 @@ var LeaferUI = (function (exports) {
|
|
|
11255
11310
|
width *= data.scaleX;
|
|
11256
11311
|
height *= data.scaleY;
|
|
11257
11312
|
}
|
|
11258
|
-
allowPaint = width * height > Platform.image.maxCacheSize;
|
|
11313
|
+
allowPaint = (width * height > Platform.image.maxCacheSize) || Export.running;
|
|
11259
11314
|
}
|
|
11260
11315
|
else {
|
|
11261
11316
|
allowPaint = false;
|
|
@@ -11767,7 +11822,8 @@ var LeaferUI = (function (exports) {
|
|
|
11767
11822
|
if (breakAll) {
|
|
11768
11823
|
if (wordWidth)
|
|
11769
11824
|
addWord();
|
|
11770
|
-
|
|
11825
|
+
if (rowWidth)
|
|
11826
|
+
addRow();
|
|
11771
11827
|
}
|
|
11772
11828
|
else {
|
|
11773
11829
|
if (!afterBreak)
|
|
@@ -11775,10 +11831,12 @@ var LeaferUI = (function (exports) {
|
|
|
11775
11831
|
if (langBreak || afterBreak || charType === Break || charType === Before || charType === Single || (wordWidth + charWidth > realWidth)) {
|
|
11776
11832
|
if (wordWidth)
|
|
11777
11833
|
addWord();
|
|
11778
|
-
|
|
11834
|
+
if (rowWidth)
|
|
11835
|
+
addRow();
|
|
11779
11836
|
}
|
|
11780
11837
|
else {
|
|
11781
|
-
|
|
11838
|
+
if (rowWidth)
|
|
11839
|
+
addRow();
|
|
11782
11840
|
}
|
|
11783
11841
|
}
|
|
11784
11842
|
}
|
|
@@ -12164,6 +12222,7 @@ var LeaferUI = (function (exports) {
|
|
|
12164
12222
|
}
|
|
12165
12223
|
const { leafer } = leaf;
|
|
12166
12224
|
if (leafer) {
|
|
12225
|
+
checkLazy(leaf);
|
|
12167
12226
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
12168
12227
|
options = FileHelper.getExportOptions(options);
|
|
12169
12228
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
@@ -12171,6 +12230,8 @@ var LeaferUI = (function (exports) {
|
|
|
12171
12230
|
const { slice, trim, onCanvas } = options;
|
|
12172
12231
|
let scale = options.scale || 1;
|
|
12173
12232
|
let pixelRatio = options.pixelRatio || 1;
|
|
12233
|
+
const smooth = options.smooth === undefined ? leafer.config.smooth : options.smooth;
|
|
12234
|
+
const contextSettings = options.contextSettings || leafer.config.contextSettings;
|
|
12174
12235
|
if (leaf.isApp) {
|
|
12175
12236
|
scale *= pixelRatio;
|
|
12176
12237
|
pixelRatio = leaf.app.pixelRatio;
|
|
@@ -12209,7 +12270,7 @@ var LeaferUI = (function (exports) {
|
|
|
12209
12270
|
renderBounds = leaf.getBounds('render', relative);
|
|
12210
12271
|
}
|
|
12211
12272
|
const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
|
|
12212
|
-
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
|
|
12273
|
+
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
|
|
12213
12274
|
const renderOptions = { matrix: matrix.scale(1 / scale).invert().translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
12214
12275
|
if (slice) {
|
|
12215
12276
|
leaf = leafer;
|
|
@@ -12255,6 +12316,12 @@ var LeaferUI = (function (exports) {
|
|
|
12255
12316
|
tasker.add(() => __awaiter(this, void 0, void 0, function* () { return yield task(resolve); }), { parallel: false });
|
|
12256
12317
|
});
|
|
12257
12318
|
}
|
|
12319
|
+
function checkLazy(leaf) {
|
|
12320
|
+
if (leaf.__.__needComputePaint)
|
|
12321
|
+
leaf.__.__computePaint();
|
|
12322
|
+
if (leaf.isBranch)
|
|
12323
|
+
leaf.children.forEach(child => checkLazy(child));
|
|
12324
|
+
}
|
|
12258
12325
|
|
|
12259
12326
|
const canvas = LeaferCanvasBase.prototype;
|
|
12260
12327
|
const debug = Debug.get('@leafer-ui/export');
|
|
@@ -12420,6 +12487,7 @@ var LeaferUI = (function (exports) {
|
|
|
12420
12487
|
exports.WaitHelper = WaitHelper;
|
|
12421
12488
|
exports.WatchEvent = WatchEvent;
|
|
12422
12489
|
exports.Watcher = Watcher;
|
|
12490
|
+
exports.addInteractionWindow = addInteractionWindow;
|
|
12423
12491
|
exports.affectRenderBoundsType = affectRenderBoundsType;
|
|
12424
12492
|
exports.affectStrokeBoundsType = affectStrokeBoundsType;
|
|
12425
12493
|
exports.arrowType = arrowType;
|