@leafer-ui/miniapp 1.2.2 → 1.3.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 +22 -323
- package/dist/miniapp.esm.js +23 -325
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.module.js +133 -437
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +11 -11
package/dist/miniapp.cjs
CHANGED
|
@@ -416,7 +416,7 @@ class LayoutBlockData {
|
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
const { updateAllMatrix, updateAllChange } = core.LeafHelper;
|
|
419
|
-
const debug$
|
|
419
|
+
const debug$1 = core.Debug.get('Layouter');
|
|
420
420
|
class Layouter {
|
|
421
421
|
constructor(target, userConfig) {
|
|
422
422
|
this.totalTimes = 0;
|
|
@@ -451,7 +451,7 @@ class Layouter {
|
|
|
451
451
|
target.emitEvent(new core.LayoutEvent(core.LayoutEvent.END, this.layoutedBlocks, this.times));
|
|
452
452
|
}
|
|
453
453
|
catch (e) {
|
|
454
|
-
debug$
|
|
454
|
+
debug$1.error(e);
|
|
455
455
|
}
|
|
456
456
|
this.layoutedBlocks = null;
|
|
457
457
|
}
|
|
@@ -465,9 +465,9 @@ class Layouter {
|
|
|
465
465
|
}
|
|
466
466
|
layoutOnce() {
|
|
467
467
|
if (this.layouting)
|
|
468
|
-
return debug$
|
|
468
|
+
return debug$1.warn('layouting');
|
|
469
469
|
if (this.times > 3)
|
|
470
|
-
return debug$
|
|
470
|
+
return debug$1.warn('layout max times');
|
|
471
471
|
this.times++;
|
|
472
472
|
this.totalTimes++;
|
|
473
473
|
this.layouting = true;
|
|
@@ -571,7 +571,7 @@ class Layouter {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
const debug
|
|
574
|
+
const debug = core.Debug.get('Renderer');
|
|
575
575
|
class Renderer {
|
|
576
576
|
get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
|
|
577
577
|
constructor(target, canvas, userConfig) {
|
|
@@ -609,7 +609,7 @@ class Renderer {
|
|
|
609
609
|
const { target } = this;
|
|
610
610
|
this.times = 0;
|
|
611
611
|
this.totalBounds = new core.Bounds();
|
|
612
|
-
debug
|
|
612
|
+
debug.log(target.innerName, '--->');
|
|
613
613
|
try {
|
|
614
614
|
if (!target.isApp)
|
|
615
615
|
target.app.emit(core.RenderEvent.CHILD_START, target);
|
|
@@ -620,9 +620,9 @@ class Renderer {
|
|
|
620
620
|
}
|
|
621
621
|
catch (e) {
|
|
622
622
|
this.rendering = false;
|
|
623
|
-
debug
|
|
623
|
+
debug.error(e);
|
|
624
624
|
}
|
|
625
|
-
debug
|
|
625
|
+
debug.log('-------------|');
|
|
626
626
|
}
|
|
627
627
|
renderAgain() {
|
|
628
628
|
if (this.rendering) {
|
|
@@ -634,9 +634,9 @@ class Renderer {
|
|
|
634
634
|
}
|
|
635
635
|
renderOnce(callback) {
|
|
636
636
|
if (this.rendering)
|
|
637
|
-
return debug
|
|
637
|
+
return debug.warn('rendering');
|
|
638
638
|
if (this.times > 3)
|
|
639
|
-
return debug
|
|
639
|
+
return debug.warn('render max times');
|
|
640
640
|
this.times++;
|
|
641
641
|
this.totalTimes++;
|
|
642
642
|
this.rendering = true;
|
|
@@ -673,7 +673,7 @@ class Renderer {
|
|
|
673
673
|
partRender() {
|
|
674
674
|
const { canvas, updateBlocks: list } = this;
|
|
675
675
|
if (!list)
|
|
676
|
-
return debug
|
|
676
|
+
return debug.warn('PartRender: need update attr');
|
|
677
677
|
this.mergeBlocks();
|
|
678
678
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
679
679
|
this.clipRender(block); });
|
|
@@ -776,7 +776,7 @@ class Renderer {
|
|
|
776
776
|
empty = (!leaf.__world.width || !leaf.__world.height);
|
|
777
777
|
if (empty) {
|
|
778
778
|
if (!leaf.isLeafer)
|
|
779
|
-
debug
|
|
779
|
+
debug.tip(leaf.innerName, ': empty');
|
|
780
780
|
empty = (!leaf.isBranch || leaf.isBranchLeaf);
|
|
781
781
|
}
|
|
782
782
|
return empty;
|
|
@@ -942,143 +942,26 @@ class Picker {
|
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
944
|
|
|
945
|
-
const { Yes, NoAndSkip, YesAndSkip } = core.Answer;
|
|
946
|
-
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
947
945
|
class Selector {
|
|
948
946
|
constructor(target, userConfig) {
|
|
949
947
|
this.config = {};
|
|
950
|
-
this.innerIdMap = {};
|
|
951
|
-
this.idMap = {};
|
|
952
|
-
this.methods = {
|
|
953
|
-
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
954
|
-
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
955
|
-
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
956
|
-
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
957
|
-
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
958
|
-
};
|
|
959
|
-
this.target = target;
|
|
960
948
|
if (userConfig)
|
|
961
949
|
this.config = core.DataHelper.default(userConfig, this.config);
|
|
962
|
-
this.picker = new Picker(target, this);
|
|
963
|
-
|
|
964
|
-
this.__listenEvents();
|
|
965
|
-
}
|
|
966
|
-
getBy(condition, branch, one, options) {
|
|
967
|
-
switch (typeof condition) {
|
|
968
|
-
case 'number':
|
|
969
|
-
const leaf = this.getByInnerId(condition, branch);
|
|
970
|
-
return one ? leaf : (leaf ? [leaf] : []);
|
|
971
|
-
case 'string':
|
|
972
|
-
switch (condition[0]) {
|
|
973
|
-
case '#':
|
|
974
|
-
idCondition.id = condition.substring(1), condition = idCondition;
|
|
975
|
-
break;
|
|
976
|
-
case '.':
|
|
977
|
-
classNameCondition.className = condition.substring(1), condition = classNameCondition;
|
|
978
|
-
break;
|
|
979
|
-
default:
|
|
980
|
-
tagCondition.tag = condition, condition = tagCondition;
|
|
981
|
-
}
|
|
982
|
-
case 'object':
|
|
983
|
-
if (condition.id !== undefined) {
|
|
984
|
-
const leaf = this.getById(condition.id, branch);
|
|
985
|
-
return one ? leaf : (leaf ? [leaf] : []);
|
|
986
|
-
}
|
|
987
|
-
else if (condition.tag) {
|
|
988
|
-
const { tag } = condition, isArray = tag instanceof Array;
|
|
989
|
-
return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? core.DataHelper.toMap(tag) : tag);
|
|
990
|
-
}
|
|
991
|
-
else {
|
|
992
|
-
return this.getByMethod(this.methods.className, branch, one, condition.className);
|
|
993
|
-
}
|
|
994
|
-
case 'function':
|
|
995
|
-
return this.getByMethod(condition, branch, one, options);
|
|
996
|
-
}
|
|
950
|
+
this.picker = new Picker(this.target = target, this);
|
|
951
|
+
this.finder = core.Creator.finder && core.Creator.finder();
|
|
997
952
|
}
|
|
998
953
|
getByPoint(hitPoint, hitRadius, options) {
|
|
999
|
-
if (core.Platform.
|
|
1000
|
-
this.target.
|
|
954
|
+
if (core.Platform.backgrounder && this.target)
|
|
955
|
+
this.target.updateLayout();
|
|
1001
956
|
return this.picker.getByPoint(hitPoint, hitRadius, options);
|
|
1002
957
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
if (cache)
|
|
1006
|
-
return cache;
|
|
1007
|
-
this.eachFind(this.toChildren(branch), this.methods.innerId, null, innerId);
|
|
1008
|
-
return this.findLeaf;
|
|
1009
|
-
}
|
|
1010
|
-
getById(id, branch) {
|
|
1011
|
-
const cache = this.idMap[id];
|
|
1012
|
-
if (cache && core.LeafHelper.hasParent(cache, branch || this.target))
|
|
1013
|
-
return cache;
|
|
1014
|
-
this.eachFind(this.toChildren(branch), this.methods.id, null, id);
|
|
1015
|
-
return this.findLeaf;
|
|
1016
|
-
}
|
|
1017
|
-
getByClassName(className, branch) {
|
|
1018
|
-
return this.getByMethod(this.methods.className, branch, false, className);
|
|
1019
|
-
}
|
|
1020
|
-
getByTag(tag, branch) {
|
|
1021
|
-
return this.getByMethod(this.methods.tag, branch, false, tag);
|
|
1022
|
-
}
|
|
1023
|
-
getByMethod(method, branch, one, options) {
|
|
1024
|
-
const list = one ? null : [];
|
|
1025
|
-
this.eachFind(this.toChildren(branch), method, list, options);
|
|
1026
|
-
return list || this.findLeaf;
|
|
1027
|
-
}
|
|
1028
|
-
eachFind(children, method, list, options) {
|
|
1029
|
-
let child, result;
|
|
1030
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
1031
|
-
child = children[i];
|
|
1032
|
-
result = method(child, options);
|
|
1033
|
-
if (result === Yes || result === YesAndSkip) {
|
|
1034
|
-
if (list) {
|
|
1035
|
-
list.push(child);
|
|
1036
|
-
}
|
|
1037
|
-
else {
|
|
1038
|
-
this.findLeaf = child;
|
|
1039
|
-
return;
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
if (child.isBranch && result < NoAndSkip)
|
|
1043
|
-
this.eachFind(child.children, method, list, options);
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
toChildren(branch) {
|
|
1047
|
-
this.findLeaf = null;
|
|
1048
|
-
return [branch || this.target];
|
|
1049
|
-
}
|
|
1050
|
-
__onRemoveChild(event) {
|
|
1051
|
-
const { id, innerId } = event.child;
|
|
1052
|
-
if (this.idMap[id])
|
|
1053
|
-
delete this.idMap[id];
|
|
1054
|
-
if (this.innerIdMap[innerId])
|
|
1055
|
-
delete this.innerIdMap[innerId];
|
|
1056
|
-
}
|
|
1057
|
-
__checkIdChange(event) {
|
|
1058
|
-
if (event.attrName === 'id') {
|
|
1059
|
-
const id = event.oldValue;
|
|
1060
|
-
if (this.idMap[id])
|
|
1061
|
-
delete this.idMap[id];
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
__listenEvents() {
|
|
1065
|
-
this.__eventIds = [
|
|
1066
|
-
this.target.on_(core.ChildEvent.REMOVE, this.__onRemoveChild, this),
|
|
1067
|
-
this.target.on_(core.PropertyEvent.CHANGE, this.__checkIdChange, this)
|
|
1068
|
-
];
|
|
1069
|
-
}
|
|
1070
|
-
__removeListenEvents() {
|
|
1071
|
-
this.target.off_(this.__eventIds);
|
|
1072
|
-
this.__eventIds.length = 0;
|
|
958
|
+
getBy(condition, branch, one, options) {
|
|
959
|
+
return this.finder ? this.finder.getBy(condition, branch, one, options) : core.Plugin.need('find');
|
|
1073
960
|
}
|
|
1074
961
|
destroy() {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
this.
|
|
1078
|
-
this.findLeaf = null;
|
|
1079
|
-
this.innerIdMap = {};
|
|
1080
|
-
this.idMap = {};
|
|
1081
|
-
}
|
|
962
|
+
this.picker.destroy();
|
|
963
|
+
if (this.finder)
|
|
964
|
+
this.finder.destroy();
|
|
1082
965
|
}
|
|
1083
966
|
}
|
|
1084
967
|
|
|
@@ -2706,197 +2589,12 @@ const ColorConvertModule = {
|
|
|
2706
2589
|
string
|
|
2707
2590
|
};
|
|
2708
2591
|
|
|
2709
|
-
const { setPoint, addPoint, toBounds } = core.TwoPointBoundsHelper;
|
|
2710
|
-
function getTrimBounds(canvas) {
|
|
2711
|
-
const { width, height } = canvas.view;
|
|
2712
|
-
const { data } = canvas.context.getImageData(0, 0, width, height);
|
|
2713
|
-
let x, y, pointBounds, index = 0;
|
|
2714
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
2715
|
-
if (data[i + 3] !== 0) {
|
|
2716
|
-
x = index % width;
|
|
2717
|
-
y = (index - x) / width;
|
|
2718
|
-
pointBounds ? addPoint(pointBounds, x, y) : setPoint(pointBounds = {}, x, y);
|
|
2719
|
-
}
|
|
2720
|
-
index++;
|
|
2721
|
-
}
|
|
2722
|
-
const bounds = new core.Bounds();
|
|
2723
|
-
toBounds(pointBounds, bounds);
|
|
2724
|
-
return bounds.scale(1 / canvas.pixelRatio).ceil();
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
const ExportModule = {
|
|
2728
|
-
export(leaf, filename, options) {
|
|
2729
|
-
this.running = true;
|
|
2730
|
-
const fileType = core.FileHelper.fileType(filename);
|
|
2731
|
-
const isDownload = filename.includes('.');
|
|
2732
|
-
options = core.FileHelper.getExportOptions(options);
|
|
2733
|
-
return addTask((success) => new Promise((resolve) => {
|
|
2734
|
-
const over = (result) => {
|
|
2735
|
-
success(result);
|
|
2736
|
-
resolve();
|
|
2737
|
-
this.running = false;
|
|
2738
|
-
};
|
|
2739
|
-
const { toURL } = core.Platform;
|
|
2740
|
-
const { download } = core.Platform.origin;
|
|
2741
|
-
if (fileType === 'json') {
|
|
2742
|
-
isDownload && download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
|
|
2743
|
-
return over({ data: isDownload ? true : leaf.toJSON(options.json) });
|
|
2744
|
-
}
|
|
2745
|
-
if (fileType === 'svg') {
|
|
2746
|
-
isDownload && download(toURL(leaf.toSVG(), 'svg'), filename);
|
|
2747
|
-
return over({ data: isDownload ? true : leaf.toSVG() });
|
|
2748
|
-
}
|
|
2749
|
-
const { leafer } = leaf;
|
|
2750
|
-
if (leafer) {
|
|
2751
|
-
checkLazy(leaf);
|
|
2752
|
-
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
2753
|
-
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
2754
|
-
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
2755
|
-
const { slice, trim, onCanvas } = options;
|
|
2756
|
-
const smooth = options.smooth === undefined ? leafer.config.smooth : options.smooth;
|
|
2757
|
-
const contextSettings = options.contextSettings || leafer.config.contextSettings;
|
|
2758
|
-
const screenshot = options.screenshot || leaf.isApp;
|
|
2759
|
-
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
2760
|
-
const needFill = core.FileHelper.isOpaqueImage(filename) || fill, matrix = new core.Matrix();
|
|
2761
|
-
if (screenshot) {
|
|
2762
|
-
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
2763
|
-
}
|
|
2764
|
-
else {
|
|
2765
|
-
let relative = options.relative || (isLeafer ? 'inner' : 'local');
|
|
2766
|
-
scaleX = worldTransform.scaleX;
|
|
2767
|
-
scaleY = worldTransform.scaleY;
|
|
2768
|
-
switch (relative) {
|
|
2769
|
-
case 'inner':
|
|
2770
|
-
matrix.set(worldTransform);
|
|
2771
|
-
break;
|
|
2772
|
-
case 'local':
|
|
2773
|
-
matrix.set(worldTransform).divide(leaf.localTransform);
|
|
2774
|
-
scaleX /= leaf.scaleX;
|
|
2775
|
-
scaleY /= leaf.scaleY;
|
|
2776
|
-
break;
|
|
2777
|
-
case 'world':
|
|
2778
|
-
scaleX = 1;
|
|
2779
|
-
scaleY = 1;
|
|
2780
|
-
break;
|
|
2781
|
-
case 'page':
|
|
2782
|
-
relative = leaf.leafer;
|
|
2783
|
-
default:
|
|
2784
|
-
matrix.set(worldTransform).divide(leaf.getTransform(relative));
|
|
2785
|
-
const l = relative.worldTransform;
|
|
2786
|
-
scaleX /= scaleX / l.scaleX;
|
|
2787
|
-
scaleY /= scaleY / l.scaleY;
|
|
2788
|
-
}
|
|
2789
|
-
renderBounds = leaf.getBounds('render', relative);
|
|
2790
|
-
}
|
|
2791
|
-
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
2792
|
-
core.MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
2793
|
-
let pixelRatio = options.pixelRatio || 1;
|
|
2794
|
-
if (leaf.isApp) {
|
|
2795
|
-
scaleData.scaleX *= pixelRatio;
|
|
2796
|
-
scaleData.scaleY *= pixelRatio;
|
|
2797
|
-
pixelRatio = leaf.app.pixelRatio;
|
|
2798
|
-
}
|
|
2799
|
-
const { x, y, width, height } = new core.Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
2800
|
-
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
2801
|
-
let canvas = core.Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
|
|
2802
|
-
let sliceLeaf;
|
|
2803
|
-
if (slice) {
|
|
2804
|
-
sliceLeaf = leaf;
|
|
2805
|
-
sliceLeaf.__worldOpacity = 0;
|
|
2806
|
-
leaf = leafer;
|
|
2807
|
-
renderOptions.bounds = canvas.bounds;
|
|
2808
|
-
}
|
|
2809
|
-
canvas.save();
|
|
2810
|
-
if (isFrame && fill !== undefined) {
|
|
2811
|
-
const oldFill = leaf.get('fill');
|
|
2812
|
-
leaf.fill = '';
|
|
2813
|
-
leaf.__render(canvas, renderOptions);
|
|
2814
|
-
leaf.fill = oldFill;
|
|
2815
|
-
}
|
|
2816
|
-
else {
|
|
2817
|
-
leaf.__render(canvas, renderOptions);
|
|
2818
|
-
}
|
|
2819
|
-
canvas.restore();
|
|
2820
|
-
if (sliceLeaf)
|
|
2821
|
-
sliceLeaf.__updateWorldOpacity();
|
|
2822
|
-
if (trim) {
|
|
2823
|
-
trimBounds = getTrimBounds(canvas);
|
|
2824
|
-
const old = canvas, { width, height } = trimBounds;
|
|
2825
|
-
const config = { x: 0, y: 0, width, height, pixelRatio };
|
|
2826
|
-
canvas = core.Creator.canvas(config);
|
|
2827
|
-
canvas.copyWorld(old, trimBounds, config);
|
|
2828
|
-
}
|
|
2829
|
-
if (needFill)
|
|
2830
|
-
canvas.fillWorld(canvas.bounds, fill || '#FFFFFF', 'destination-over');
|
|
2831
|
-
if (onCanvas)
|
|
2832
|
-
onCanvas(canvas);
|
|
2833
|
-
const data = filename === 'canvas' ? canvas : yield canvas.export(filename, options);
|
|
2834
|
-
over({ data, width: canvas.pixelWidth, height: canvas.pixelHeight, renderBounds, trimBounds });
|
|
2835
|
-
}));
|
|
2836
|
-
}
|
|
2837
|
-
else {
|
|
2838
|
-
over({ data: false });
|
|
2839
|
-
}
|
|
2840
|
-
}));
|
|
2841
|
-
}
|
|
2842
|
-
};
|
|
2843
|
-
let tasker;
|
|
2844
|
-
function addTask(task) {
|
|
2845
|
-
if (!tasker)
|
|
2846
|
-
tasker = new core.TaskProcessor();
|
|
2847
|
-
return new Promise((resolve) => {
|
|
2848
|
-
tasker.add(() => __awaiter(this, void 0, void 0, function* () { return yield task(resolve); }), { parallel: false });
|
|
2849
|
-
});
|
|
2850
|
-
}
|
|
2851
|
-
function checkLazy(leaf) {
|
|
2852
|
-
if (leaf.__.__needComputePaint)
|
|
2853
|
-
leaf.__.__computePaint();
|
|
2854
|
-
if (leaf.isBranch)
|
|
2855
|
-
leaf.children.forEach(child => checkLazy(child));
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
const canvas = core.LeaferCanvasBase.prototype;
|
|
2859
|
-
const debug = core.Debug.get('@leafer-ui/export');
|
|
2860
|
-
canvas.export = function (filename, options) {
|
|
2861
|
-
const { quality, blob } = core.FileHelper.getExportOptions(options);
|
|
2862
|
-
if (filename.includes('.'))
|
|
2863
|
-
return this.saveAs(filename, quality);
|
|
2864
|
-
else if (blob)
|
|
2865
|
-
return this.toBlob(filename, quality);
|
|
2866
|
-
else
|
|
2867
|
-
return this.toDataURL(filename, quality);
|
|
2868
|
-
};
|
|
2869
|
-
canvas.toBlob = function (type, quality) {
|
|
2870
|
-
return new Promise((resolve) => {
|
|
2871
|
-
core.Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
|
|
2872
|
-
resolve(blob);
|
|
2873
|
-
}).catch((e) => {
|
|
2874
|
-
debug.error(e);
|
|
2875
|
-
resolve(null);
|
|
2876
|
-
});
|
|
2877
|
-
});
|
|
2878
|
-
};
|
|
2879
|
-
canvas.toDataURL = function (type, quality) {
|
|
2880
|
-
return core.Platform.origin.canvasToDataURL(this.view, type, quality);
|
|
2881
|
-
};
|
|
2882
|
-
canvas.saveAs = function (filename, quality) {
|
|
2883
|
-
return new Promise((resolve) => {
|
|
2884
|
-
core.Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
|
|
2885
|
-
resolve(true);
|
|
2886
|
-
}).catch((e) => {
|
|
2887
|
-
debug.error(e);
|
|
2888
|
-
resolve(false);
|
|
2889
|
-
});
|
|
2890
|
-
});
|
|
2891
|
-
};
|
|
2892
|
-
|
|
2893
2592
|
Object.assign(draw.TextConvert, TextConvertModule);
|
|
2894
2593
|
Object.assign(draw.ColorConvert, ColorConvertModule);
|
|
2895
2594
|
Object.assign(draw.Paint, PaintModule);
|
|
2896
2595
|
Object.assign(draw.PaintImage, PaintImageModule);
|
|
2897
2596
|
Object.assign(draw.PaintGradient, PaintGradientModule);
|
|
2898
2597
|
Object.assign(draw.Effect, EffectModule);
|
|
2899
|
-
Object.assign(draw.Export, ExportModule);
|
|
2900
2598
|
|
|
2901
2599
|
Object.assign(core.Creator, {
|
|
2902
2600
|
interaction: (target, canvas, selector, options) => new Interaction(target, canvas, selector, options),
|
|
@@ -2943,6 +2641,7 @@ Object.defineProperty(exports, "LeaferImage", {
|
|
|
2943
2641
|
exports.Interaction = Interaction;
|
|
2944
2642
|
exports.Layouter = Layouter;
|
|
2945
2643
|
exports.LeaferCanvas = LeaferCanvas;
|
|
2644
|
+
exports.Picker = Picker;
|
|
2946
2645
|
exports.Renderer = Renderer;
|
|
2947
2646
|
exports.Selector = Selector;
|
|
2948
2647
|
exports.Watcher = Watcher;
|