@leafer-ui/node 1.6.0 → 1.6.2
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/node.cjs +63 -53
- package/dist/node.esm.js +63 -53
- package/dist/node.esm.min.js +1 -1
- package/dist/node.esm.min.js.map +1 -1
- package/dist/node.min.cjs +1 -1
- package/dist/node.min.cjs.map +1 -1
- package/package.json +12 -12
- package/dist/node.cjs.map +0 -1
- package/dist/node.esm.js.map +0 -1
package/dist/node.cjs
CHANGED
|
@@ -200,7 +200,7 @@ class Watcher {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
203
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = core.LeafHelper;
|
|
204
204
|
const { pushAllChildBranch, pushAllParent } = core.BranchHelper;
|
|
205
205
|
function updateMatrix(updateList, levelList) {
|
|
206
206
|
let layout;
|
|
@@ -243,15 +243,7 @@ function updateBounds(boundsList) {
|
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
function updateChange(updateList) {
|
|
246
|
-
|
|
247
|
-
updateList.list.forEach(leaf => {
|
|
248
|
-
layout = leaf.__layout;
|
|
249
|
-
if (layout.opacityChanged)
|
|
250
|
-
updateAllWorldOpacity(leaf);
|
|
251
|
-
if (layout.stateStyleChanged)
|
|
252
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
253
|
-
leaf.__updateChange();
|
|
254
|
-
});
|
|
246
|
+
updateList.list.forEach(updateOneChange);
|
|
255
247
|
}
|
|
256
248
|
|
|
257
249
|
const { worldBounds } = core.LeafBoundsHelper;
|
|
@@ -472,6 +464,15 @@ class Renderer {
|
|
|
472
464
|
}
|
|
473
465
|
checkRender() {
|
|
474
466
|
if (this.running) {
|
|
467
|
+
const { target } = this;
|
|
468
|
+
if (target.isApp) {
|
|
469
|
+
target.emit(core.RenderEvent.CHILD_START, target);
|
|
470
|
+
target.children.forEach(leafer => {
|
|
471
|
+
leafer.renderer.FPS = this.FPS;
|
|
472
|
+
leafer.renderer.checkRender();
|
|
473
|
+
});
|
|
474
|
+
target.emit(core.RenderEvent.CHILD_END, target);
|
|
475
|
+
}
|
|
475
476
|
if (this.changed && this.canvas.view)
|
|
476
477
|
this.render();
|
|
477
478
|
this.target.emit(core.RenderEvent.NEXT);
|
|
@@ -557,7 +558,7 @@ class Renderer {
|
|
|
557
558
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
558
559
|
canvas.clearWorld(bounds, true);
|
|
559
560
|
canvas.clipWorld(bounds, true);
|
|
560
|
-
this.__render(bounds,
|
|
561
|
+
this.__render(bounds, realBounds);
|
|
561
562
|
canvas.restore();
|
|
562
563
|
core.Run.end(t);
|
|
563
564
|
}
|
|
@@ -566,12 +567,12 @@ class Renderer {
|
|
|
566
567
|
const { canvas } = this;
|
|
567
568
|
canvas.save();
|
|
568
569
|
canvas.clear();
|
|
569
|
-
this.__render(canvas.bounds
|
|
570
|
+
this.__render(canvas.bounds);
|
|
570
571
|
canvas.restore();
|
|
571
572
|
core.Run.end(t);
|
|
572
573
|
}
|
|
573
|
-
__render(bounds,
|
|
574
|
-
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
574
|
+
__render(bounds, realBounds) {
|
|
575
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
575
576
|
if (this.needFill)
|
|
576
577
|
canvas.fillWorld(bounds, this.config.fill);
|
|
577
578
|
if (core.Debug.showRepaint)
|
|
@@ -598,22 +599,14 @@ class Renderer {
|
|
|
598
599
|
}
|
|
599
600
|
__requestRender() {
|
|
600
601
|
const target = this.target;
|
|
601
|
-
if (target
|
|
602
|
-
return target.parentApp.renderer.update(false);
|
|
603
|
-
if (this.requestTime)
|
|
602
|
+
if (this.requestTime || !target)
|
|
604
603
|
return;
|
|
604
|
+
if (target.parentApp)
|
|
605
|
+
return target.parentApp.requestRender(false);
|
|
605
606
|
const requestTime = this.requestTime = Date.now();
|
|
606
607
|
core.Platform.requestRender(() => {
|
|
607
608
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
608
609
|
this.requestTime = 0;
|
|
609
|
-
if (target.isApp) {
|
|
610
|
-
target.emit(core.RenderEvent.CHILD_START, target);
|
|
611
|
-
target.children.forEach(leafer => {
|
|
612
|
-
leafer.renderer.FPS = this.FPS;
|
|
613
|
-
leafer.renderer.checkRender();
|
|
614
|
-
});
|
|
615
|
-
target.emit(core.RenderEvent.CHILD_END, target);
|
|
616
|
-
}
|
|
617
610
|
this.checkRender();
|
|
618
611
|
});
|
|
619
612
|
}
|
|
@@ -841,8 +834,10 @@ Object.assign(core.Creator, {
|
|
|
841
834
|
core.Platform.layout = Layouter.fullLayout;
|
|
842
835
|
|
|
843
836
|
function fillText(ui, canvas) {
|
|
844
|
-
|
|
845
|
-
|
|
837
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
838
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
839
|
+
canvas.fillStyle = data.placeholderColor;
|
|
840
|
+
let row;
|
|
846
841
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
847
842
|
row = rows[i];
|
|
848
843
|
if (row.text)
|
|
@@ -851,7 +846,7 @@ function fillText(ui, canvas) {
|
|
|
851
846
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
852
847
|
}
|
|
853
848
|
if (decorationY) {
|
|
854
|
-
const { decorationColor, decorationHeight } = data;
|
|
849
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
855
850
|
if (decorationColor)
|
|
856
851
|
canvas.fillStyle = decorationColor;
|
|
857
852
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -860,38 +855,44 @@ function fillText(ui, canvas) {
|
|
|
860
855
|
|
|
861
856
|
function fill(fill, ui, canvas) {
|
|
862
857
|
canvas.fillStyle = fill;
|
|
863
|
-
|
|
858
|
+
fillPathOrText(ui, canvas);
|
|
864
859
|
}
|
|
865
860
|
function fills(fills, ui, canvas) {
|
|
866
861
|
let item;
|
|
867
|
-
const { windingRule, __font } = ui.__;
|
|
868
862
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
869
863
|
item = fills[i];
|
|
870
|
-
if (item.image
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
if (item.blendMode)
|
|
878
|
-
canvas.blendMode = item.blendMode;
|
|
879
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
880
|
-
canvas.restore();
|
|
864
|
+
if (item.image) {
|
|
865
|
+
if (draw.PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
866
|
+
continue;
|
|
867
|
+
if (!item.style) {
|
|
868
|
+
if (!i && item.image.isPlacehold)
|
|
869
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
870
|
+
continue;
|
|
881
871
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
872
|
+
}
|
|
873
|
+
canvas.fillStyle = item.style;
|
|
874
|
+
if (item.transform) {
|
|
875
|
+
canvas.save();
|
|
876
|
+
canvas.transform(item.transform);
|
|
877
|
+
if (item.blendMode)
|
|
878
|
+
canvas.blendMode = item.blendMode;
|
|
879
|
+
fillPathOrText(ui, canvas);
|
|
880
|
+
canvas.restore();
|
|
881
|
+
}
|
|
882
|
+
else {
|
|
883
|
+
if (item.blendMode) {
|
|
884
|
+
canvas.saveBlendMode(item.blendMode);
|
|
885
|
+
fillPathOrText(ui, canvas);
|
|
886
|
+
canvas.restoreBlendMode();
|
|
891
887
|
}
|
|
888
|
+
else
|
|
889
|
+
fillPathOrText(ui, canvas);
|
|
892
890
|
}
|
|
893
891
|
}
|
|
894
892
|
}
|
|
893
|
+
function fillPathOrText(ui, canvas) {
|
|
894
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
895
|
+
}
|
|
895
896
|
|
|
896
897
|
function strokeText(stroke, ui, canvas) {
|
|
897
898
|
const { strokeAlign } = ui.__;
|
|
@@ -1131,6 +1132,7 @@ const PaintModule = {
|
|
|
1131
1132
|
compute,
|
|
1132
1133
|
fill,
|
|
1133
1134
|
fills,
|
|
1135
|
+
fillPathOrText,
|
|
1134
1136
|
fillText,
|
|
1135
1137
|
stroke,
|
|
1136
1138
|
strokes,
|
|
@@ -1323,6 +1325,13 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1323
1325
|
onLoadError(ui, event, error);
|
|
1324
1326
|
leafPaint.loadId = null;
|
|
1325
1327
|
});
|
|
1328
|
+
if (ui.placeholderColor)
|
|
1329
|
+
setTimeout(() => {
|
|
1330
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
1331
|
+
image.isPlacehold = true;
|
|
1332
|
+
ui.forceUpdate('surface');
|
|
1333
|
+
}
|
|
1334
|
+
}, 100);
|
|
1326
1335
|
}
|
|
1327
1336
|
return leafPaint;
|
|
1328
1337
|
}
|
|
@@ -2391,7 +2400,7 @@ const ExportModule = {
|
|
|
2391
2400
|
else {
|
|
2392
2401
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
2393
2402
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
2394
|
-
const { slice, trim, padding, onCanvas } = options;
|
|
2403
|
+
const { slice, clip, trim, padding, onCanvas } = options;
|
|
2395
2404
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
2396
2405
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
2397
2406
|
const screenshot = options.screenshot || leaf.isApp;
|
|
@@ -2435,7 +2444,9 @@ const ExportModule = {
|
|
|
2435
2444
|
scaleData.scaleY *= pixelRatio;
|
|
2436
2445
|
pixelRatio = leaf.app.pixelRatio;
|
|
2437
2446
|
}
|
|
2438
|
-
|
|
2447
|
+
let { x, y, width, height } = new draw.Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
2448
|
+
if (clip)
|
|
2449
|
+
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
2439
2450
|
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
2440
2451
|
let canvas = draw.Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
|
|
2441
2452
|
let sliceLeaf;
|
|
@@ -2591,4 +2602,3 @@ Object.keys(core$1).forEach(function (k) {
|
|
|
2591
2602
|
get: function () { return core$1[k]; }
|
|
2592
2603
|
});
|
|
2593
2604
|
});
|
|
2594
|
-
//# sourceMappingURL=node.cjs.map
|
package/dist/node.esm.js
CHANGED
|
@@ -201,7 +201,7 @@ class Watcher {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
204
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
205
205
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
206
206
|
function updateMatrix(updateList, levelList) {
|
|
207
207
|
let layout;
|
|
@@ -244,15 +244,7 @@ function updateBounds(boundsList) {
|
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
function updateChange(updateList) {
|
|
247
|
-
|
|
248
|
-
updateList.list.forEach(leaf => {
|
|
249
|
-
layout = leaf.__layout;
|
|
250
|
-
if (layout.opacityChanged)
|
|
251
|
-
updateAllWorldOpacity(leaf);
|
|
252
|
-
if (layout.stateStyleChanged)
|
|
253
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
254
|
-
leaf.__updateChange();
|
|
255
|
-
});
|
|
247
|
+
updateList.list.forEach(updateOneChange);
|
|
256
248
|
}
|
|
257
249
|
|
|
258
250
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -473,6 +465,15 @@ class Renderer {
|
|
|
473
465
|
}
|
|
474
466
|
checkRender() {
|
|
475
467
|
if (this.running) {
|
|
468
|
+
const { target } = this;
|
|
469
|
+
if (target.isApp) {
|
|
470
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
471
|
+
target.children.forEach(leafer => {
|
|
472
|
+
leafer.renderer.FPS = this.FPS;
|
|
473
|
+
leafer.renderer.checkRender();
|
|
474
|
+
});
|
|
475
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
476
|
+
}
|
|
476
477
|
if (this.changed && this.canvas.view)
|
|
477
478
|
this.render();
|
|
478
479
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -558,7 +559,7 @@ class Renderer {
|
|
|
558
559
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
559
560
|
canvas.clearWorld(bounds, true);
|
|
560
561
|
canvas.clipWorld(bounds, true);
|
|
561
|
-
this.__render(bounds,
|
|
562
|
+
this.__render(bounds, realBounds);
|
|
562
563
|
canvas.restore();
|
|
563
564
|
Run.end(t);
|
|
564
565
|
}
|
|
@@ -567,12 +568,12 @@ class Renderer {
|
|
|
567
568
|
const { canvas } = this;
|
|
568
569
|
canvas.save();
|
|
569
570
|
canvas.clear();
|
|
570
|
-
this.__render(canvas.bounds
|
|
571
|
+
this.__render(canvas.bounds);
|
|
571
572
|
canvas.restore();
|
|
572
573
|
Run.end(t);
|
|
573
574
|
}
|
|
574
|
-
__render(bounds,
|
|
575
|
-
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
575
|
+
__render(bounds, realBounds) {
|
|
576
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
576
577
|
if (this.needFill)
|
|
577
578
|
canvas.fillWorld(bounds, this.config.fill);
|
|
578
579
|
if (Debug.showRepaint)
|
|
@@ -599,22 +600,14 @@ class Renderer {
|
|
|
599
600
|
}
|
|
600
601
|
__requestRender() {
|
|
601
602
|
const target = this.target;
|
|
602
|
-
if (target
|
|
603
|
-
return target.parentApp.renderer.update(false);
|
|
604
|
-
if (this.requestTime)
|
|
603
|
+
if (this.requestTime || !target)
|
|
605
604
|
return;
|
|
605
|
+
if (target.parentApp)
|
|
606
|
+
return target.parentApp.requestRender(false);
|
|
606
607
|
const requestTime = this.requestTime = Date.now();
|
|
607
608
|
Platform.requestRender(() => {
|
|
608
609
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
609
610
|
this.requestTime = 0;
|
|
610
|
-
if (target.isApp) {
|
|
611
|
-
target.emit(RenderEvent.CHILD_START, target);
|
|
612
|
-
target.children.forEach(leafer => {
|
|
613
|
-
leafer.renderer.FPS = this.FPS;
|
|
614
|
-
leafer.renderer.checkRender();
|
|
615
|
-
});
|
|
616
|
-
target.emit(RenderEvent.CHILD_END, target);
|
|
617
|
-
}
|
|
618
611
|
this.checkRender();
|
|
619
612
|
});
|
|
620
613
|
}
|
|
@@ -842,8 +835,10 @@ Object.assign(Creator, {
|
|
|
842
835
|
Platform.layout = Layouter.fullLayout;
|
|
843
836
|
|
|
844
837
|
function fillText(ui, canvas) {
|
|
845
|
-
|
|
846
|
-
|
|
838
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
839
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
840
|
+
canvas.fillStyle = data.placeholderColor;
|
|
841
|
+
let row;
|
|
847
842
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
848
843
|
row = rows[i];
|
|
849
844
|
if (row.text)
|
|
@@ -852,7 +847,7 @@ function fillText(ui, canvas) {
|
|
|
852
847
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
853
848
|
}
|
|
854
849
|
if (decorationY) {
|
|
855
|
-
const { decorationColor, decorationHeight } = data;
|
|
850
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
856
851
|
if (decorationColor)
|
|
857
852
|
canvas.fillStyle = decorationColor;
|
|
858
853
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -861,38 +856,44 @@ function fillText(ui, canvas) {
|
|
|
861
856
|
|
|
862
857
|
function fill(fill, ui, canvas) {
|
|
863
858
|
canvas.fillStyle = fill;
|
|
864
|
-
|
|
859
|
+
fillPathOrText(ui, canvas);
|
|
865
860
|
}
|
|
866
861
|
function fills(fills, ui, canvas) {
|
|
867
862
|
let item;
|
|
868
|
-
const { windingRule, __font } = ui.__;
|
|
869
863
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
870
864
|
item = fills[i];
|
|
871
|
-
if (item.image
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
if (item.blendMode)
|
|
879
|
-
canvas.blendMode = item.blendMode;
|
|
880
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
881
|
-
canvas.restore();
|
|
865
|
+
if (item.image) {
|
|
866
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
867
|
+
continue;
|
|
868
|
+
if (!item.style) {
|
|
869
|
+
if (!i && item.image.isPlacehold)
|
|
870
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
871
|
+
continue;
|
|
882
872
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
873
|
+
}
|
|
874
|
+
canvas.fillStyle = item.style;
|
|
875
|
+
if (item.transform) {
|
|
876
|
+
canvas.save();
|
|
877
|
+
canvas.transform(item.transform);
|
|
878
|
+
if (item.blendMode)
|
|
879
|
+
canvas.blendMode = item.blendMode;
|
|
880
|
+
fillPathOrText(ui, canvas);
|
|
881
|
+
canvas.restore();
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
884
|
+
if (item.blendMode) {
|
|
885
|
+
canvas.saveBlendMode(item.blendMode);
|
|
886
|
+
fillPathOrText(ui, canvas);
|
|
887
|
+
canvas.restoreBlendMode();
|
|
892
888
|
}
|
|
889
|
+
else
|
|
890
|
+
fillPathOrText(ui, canvas);
|
|
893
891
|
}
|
|
894
892
|
}
|
|
895
893
|
}
|
|
894
|
+
function fillPathOrText(ui, canvas) {
|
|
895
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
896
|
+
}
|
|
896
897
|
|
|
897
898
|
function strokeText(stroke, ui, canvas) {
|
|
898
899
|
const { strokeAlign } = ui.__;
|
|
@@ -1132,6 +1133,7 @@ const PaintModule = {
|
|
|
1132
1133
|
compute,
|
|
1133
1134
|
fill,
|
|
1134
1135
|
fills,
|
|
1136
|
+
fillPathOrText,
|
|
1135
1137
|
fillText,
|
|
1136
1138
|
stroke,
|
|
1137
1139
|
strokes,
|
|
@@ -1324,6 +1326,13 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
1324
1326
|
onLoadError(ui, event, error);
|
|
1325
1327
|
leafPaint.loadId = null;
|
|
1326
1328
|
});
|
|
1329
|
+
if (ui.placeholderColor)
|
|
1330
|
+
setTimeout(() => {
|
|
1331
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
1332
|
+
image.isPlacehold = true;
|
|
1333
|
+
ui.forceUpdate('surface');
|
|
1334
|
+
}
|
|
1335
|
+
}, 100);
|
|
1327
1336
|
}
|
|
1328
1337
|
return leafPaint;
|
|
1329
1338
|
}
|
|
@@ -2392,7 +2401,7 @@ const ExportModule = {
|
|
|
2392
2401
|
else {
|
|
2393
2402
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
2394
2403
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
2395
|
-
const { slice, trim, padding, onCanvas } = options;
|
|
2404
|
+
const { slice, clip, trim, padding, onCanvas } = options;
|
|
2396
2405
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
2397
2406
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
2398
2407
|
const screenshot = options.screenshot || leaf.isApp;
|
|
@@ -2436,7 +2445,9 @@ const ExportModule = {
|
|
|
2436
2445
|
scaleData.scaleY *= pixelRatio;
|
|
2437
2446
|
pixelRatio = leaf.app.pixelRatio;
|
|
2438
2447
|
}
|
|
2439
|
-
|
|
2448
|
+
let { x, y, width, height } = new Bounds$1(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
2449
|
+
if (clip)
|
|
2450
|
+
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
2440
2451
|
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
2441
2452
|
let canvas = Creator$1.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
|
|
2442
2453
|
let sliceLeaf;
|
|
@@ -2570,4 +2581,3 @@ Object.assign(Creator, {
|
|
|
2570
2581
|
});
|
|
2571
2582
|
|
|
2572
2583
|
export { Layouter, LeaferCanvas, Picker, Renderer, Selector, Watcher, useCanvas };
|
|
2573
|
-
//# sourceMappingURL=node.esm.js.map
|