leafer-ui 1.10.0 → 1.10.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/web.cjs +39 -41
- package/dist/web.esm.js +39 -41
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +41 -43
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +41 -43
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.module.js
CHANGED
|
@@ -6835,7 +6835,7 @@ class LeafLevelList {
|
|
|
6835
6835
|
}
|
|
6836
6836
|
}
|
|
6837
6837
|
|
|
6838
|
-
const version = "1.10.
|
|
6838
|
+
const version = "1.10.1";
|
|
6839
6839
|
|
|
6840
6840
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6841
6841
|
|
|
@@ -8550,7 +8550,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8550
8550
|
drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
|
|
8551
8551
|
} else drawer.rect(x, y, width, height);
|
|
8552
8552
|
}
|
|
8553
|
-
drawImagePlaceholder(
|
|
8553
|
+
drawImagePlaceholder(_paint, canvas, renderOptions) {
|
|
8554
8554
|
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
|
|
8555
8555
|
}
|
|
8556
8556
|
animate(keyframe, _options, _type, _isTemp) {
|
|
@@ -11631,30 +11631,31 @@ function fill(fill, ui, canvas, renderOptions) {
|
|
|
11631
11631
|
}
|
|
11632
11632
|
|
|
11633
11633
|
function fills(fills, ui, canvas, renderOptions) {
|
|
11634
|
-
let item;
|
|
11634
|
+
let item, originPaint, countImage;
|
|
11635
11635
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
11636
|
-
item = fills[i];
|
|
11636
|
+
item = fills[i], originPaint = item.originPaint;
|
|
11637
11637
|
if (item.image) {
|
|
11638
|
+
countImage ? countImage++ : countImage = 1;
|
|
11638
11639
|
if (PaintImage.checkImage(item, !ui.__.__font, ui, canvas, renderOptions)) continue;
|
|
11639
11640
|
if (!item.style) {
|
|
11640
|
-
if (
|
|
11641
|
+
if (countImage === 1 && item.image.isPlacehold) ui.drawImagePlaceholder(item, canvas, renderOptions);
|
|
11641
11642
|
continue;
|
|
11642
11643
|
}
|
|
11643
11644
|
}
|
|
11644
11645
|
canvas.fillStyle = item.style;
|
|
11645
|
-
if (item.transform ||
|
|
11646
|
+
if (item.transform || originPaint.scaleFixed) {
|
|
11646
11647
|
canvas.save();
|
|
11647
11648
|
if (item.transform) canvas.transform(item.transform);
|
|
11648
|
-
if (
|
|
11649
|
+
if (originPaint.scaleFixed) {
|
|
11649
11650
|
const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11650
|
-
if (
|
|
11651
|
+
if (originPaint.scaleFixed === true || originPaint.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
|
|
11651
11652
|
}
|
|
11652
|
-
if (
|
|
11653
|
+
if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
|
|
11653
11654
|
fillPathOrText(ui, canvas, renderOptions);
|
|
11654
11655
|
canvas.restore();
|
|
11655
11656
|
} else {
|
|
11656
|
-
if (
|
|
11657
|
-
canvas.saveBlendMode(
|
|
11657
|
+
if (originPaint.blendMode) {
|
|
11658
|
+
canvas.saveBlendMode(originPaint.blendMode);
|
|
11658
11659
|
fillPathOrText(ui, canvas, renderOptions);
|
|
11659
11660
|
canvas.restoreBlendMode();
|
|
11660
11661
|
} else fillPathOrText(ui, canvas, renderOptions);
|
|
@@ -11807,8 +11808,8 @@ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderO
|
|
|
11807
11808
|
const {strokeStyle: strokeStyle} = item;
|
|
11808
11809
|
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
11809
11810
|
} else canvas.strokeStyle = item.style;
|
|
11810
|
-
if (item.blendMode) {
|
|
11811
|
-
canvas.saveBlendMode(item.blendMode);
|
|
11811
|
+
if (item.originPaint.blendMode) {
|
|
11812
|
+
canvas.saveBlendMode(item.originPaint.blendMode);
|
|
11812
11813
|
isText ? Paint.drawTextStroke(ui, canvas, renderOptions) : canvas.stroke();
|
|
11813
11814
|
canvas.restoreBlendMode();
|
|
11814
11815
|
} else {
|
|
@@ -11905,62 +11906,63 @@ function compute(attrName, ui) {
|
|
|
11905
11906
|
if (leafPaints.some(item => item.image)) isAlphaPixel = true;
|
|
11906
11907
|
isTransparent = true;
|
|
11907
11908
|
}
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11909
|
+
if (attrName === "fill") {
|
|
11910
|
+
stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
|
|
11911
|
+
stintSet(data, "__isTransparentFill", isTransparent);
|
|
11912
|
+
} else {
|
|
11913
|
+
stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
|
|
11914
|
+
stintSet(data, "__isTransparentStroke", isTransparent);
|
|
11915
|
+
stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
11916
|
+
}
|
|
11912
11917
|
} else {
|
|
11913
|
-
|
|
11914
|
-
stintSet(data, "__isTransparentStroke", isTransparent);
|
|
11915
|
-
stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
|
|
11918
|
+
data.__removePaint(attrName, false);
|
|
11916
11919
|
}
|
|
11917
11920
|
}
|
|
11918
11921
|
|
|
11919
11922
|
function getLeafPaint(attrName, paint, ui) {
|
|
11920
11923
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
11921
|
-
let
|
|
11924
|
+
let leafPaint;
|
|
11922
11925
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
11923
11926
|
switch (paint.type) {
|
|
11924
11927
|
case "image":
|
|
11925
|
-
|
|
11928
|
+
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11926
11929
|
break;
|
|
11927
11930
|
|
|
11928
11931
|
case "linear":
|
|
11929
|
-
|
|
11932
|
+
leafPaint = PaintGradient.linearGradient(paint, boxBounds);
|
|
11930
11933
|
break;
|
|
11931
11934
|
|
|
11932
11935
|
case "radial":
|
|
11933
|
-
|
|
11936
|
+
leafPaint = PaintGradient.radialGradient(paint, boxBounds);
|
|
11934
11937
|
break;
|
|
11935
11938
|
|
|
11936
11939
|
case "angular":
|
|
11937
|
-
|
|
11940
|
+
leafPaint = PaintGradient.conicGradient(paint, boxBounds);
|
|
11938
11941
|
break;
|
|
11939
11942
|
|
|
11940
11943
|
case "solid":
|
|
11941
11944
|
const {type: type, color: color, opacity: opacity} = paint;
|
|
11942
|
-
|
|
11945
|
+
leafPaint = {
|
|
11943
11946
|
type: type,
|
|
11944
11947
|
style: ColorConvert.string(color, opacity)
|
|
11945
11948
|
};
|
|
11946
11949
|
break;
|
|
11947
11950
|
|
|
11948
11951
|
default:
|
|
11949
|
-
if (!isUndefined(paint.r))
|
|
11952
|
+
if (!isUndefined(paint.r)) leafPaint = {
|
|
11950
11953
|
type: "solid",
|
|
11951
11954
|
style: ColorConvert.string(paint)
|
|
11952
11955
|
};
|
|
11953
11956
|
}
|
|
11954
|
-
if (
|
|
11955
|
-
|
|
11957
|
+
if (leafPaint) {
|
|
11958
|
+
leafPaint.originPaint = paint;
|
|
11959
|
+
if (isString(leafPaint.style) && hasTransparent$1(leafPaint.style)) leafPaint.isTransparent = true;
|
|
11956
11960
|
if (paint.style) {
|
|
11957
11961
|
if (paint.style.strokeWidth === 0) return undefined;
|
|
11958
|
-
|
|
11962
|
+
leafPaint.strokeStyle = paint.style;
|
|
11959
11963
|
}
|
|
11960
|
-
if (paint.editing) data.editing = paint.editing;
|
|
11961
|
-
if (paint.blendMode) data.blendMode = paint.blendMode;
|
|
11962
11964
|
}
|
|
11963
|
-
return
|
|
11965
|
+
return leafPaint;
|
|
11964
11966
|
}
|
|
11965
11967
|
|
|
11966
11968
|
const PaintModule = {
|
|
@@ -12093,10 +12095,6 @@ const tempScaleData = {};
|
|
|
12093
12095
|
const tempImage = {};
|
|
12094
12096
|
|
|
12095
12097
|
function createData(leafPaint, image, paint, box) {
|
|
12096
|
-
const {changeful: changeful, sync: sync, scaleFixed: scaleFixed} = paint;
|
|
12097
|
-
if (changeful) leafPaint.changeful = changeful;
|
|
12098
|
-
if (sync) leafPaint.sync = sync;
|
|
12099
|
-
if (scaleFixed) leafPaint.scaleFixed = scaleFixed;
|
|
12100
12098
|
leafPaint.data = PaintImage.getPatternData(paint, box, image);
|
|
12101
12099
|
}
|
|
12102
12100
|
|
|
@@ -12323,14 +12321,14 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
|
12323
12321
|
|
|
12324
12322
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
12325
12323
|
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
12326
|
-
const {image: image, data: data} = paint, {exporting: exporting} = renderOptions;
|
|
12324
|
+
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
|
|
12327
12325
|
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
12328
12326
|
return false;
|
|
12329
12327
|
} else {
|
|
12330
12328
|
if (drawImage) {
|
|
12331
12329
|
if (data.repeat) {
|
|
12332
12330
|
drawImage = false;
|
|
12333
|
-
} else if (!(
|
|
12331
|
+
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
12334
12332
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
12335
12333
|
}
|
|
12336
12334
|
}
|
|
@@ -12342,16 +12340,16 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
12342
12340
|
PaintImage.drawImage(paint, scaleX, scaleY, ui, canvas, renderOptions);
|
|
12343
12341
|
return true;
|
|
12344
12342
|
} else {
|
|
12345
|
-
if (!paint.style ||
|
|
12343
|
+
if (!paint.style || originPaint.sync || exporting) PaintImage.createPattern(paint, ui, canvas, renderOptions); else PaintImage.createPatternTask(paint, ui, canvas, renderOptions);
|
|
12346
12344
|
return false;
|
|
12347
12345
|
}
|
|
12348
12346
|
}
|
|
12349
12347
|
}
|
|
12350
12348
|
|
|
12351
12349
|
function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions) {
|
|
12352
|
-
const {data: data, image: image, blendMode: blendMode} = paint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
|
|
12350
|
+
const {data: data, image: image} = paint, {blendMode: blendMode} = paint.originPaint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
|
|
12353
12351
|
let {width: width, height: height} = image, clipUI;
|
|
12354
|
-
if (transform && !transform.onlyScale ||
|
|
12352
|
+
if ((clipUI = transform && !transform.onlyScale || u.path || u.cornerRadius) || opacity || blendMode) {
|
|
12355
12353
|
canvas.save();
|
|
12356
12354
|
clipUI && canvas.clipUI(ui);
|
|
12357
12355
|
blendMode && (canvas.blendMode = blendMode);
|
|
@@ -12366,7 +12364,7 @@ function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions
|
|
|
12366
12364
|
}
|
|
12367
12365
|
|
|
12368
12366
|
function getImageRenderScaleData(paint, ui, canvas, _renderOptions) {
|
|
12369
|
-
const scaleData = ui.getRenderScaleData(true, paint.scaleFixed), {data: data} = paint;
|
|
12367
|
+
const scaleData = ui.getRenderScaleData(true, paint.originPaint.scaleFixed), {data: data} = paint;
|
|
12370
12368
|
if (canvas) {
|
|
12371
12369
|
const {pixelRatio: pixelRatio} = canvas;
|
|
12372
12370
|
scaleData.scaleX *= pixelRatio;
|