@leafer/core 1.7.0 → 1.8.0
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/lib/core.cjs +77 -36
- package/lib/core.esm.js +77 -37
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -862,6 +862,12 @@ const AroundHelper = {
|
|
|
862
862
|
}
|
|
863
863
|
if (!onlyBoxSize)
|
|
864
864
|
to.x += box.x, to.y += box.y;
|
|
865
|
+
},
|
|
866
|
+
getPoint(around, box, to) {
|
|
867
|
+
if (!to)
|
|
868
|
+
to = {};
|
|
869
|
+
AroundHelper.toPoint(around, box, to, true);
|
|
870
|
+
return to;
|
|
865
871
|
}
|
|
866
872
|
};
|
|
867
873
|
function get(around) {
|
|
@@ -1790,10 +1796,13 @@ function contextAttr(realName) {
|
|
|
1790
1796
|
return (target, key) => {
|
|
1791
1797
|
if (!realName)
|
|
1792
1798
|
realName = key;
|
|
1793
|
-
|
|
1799
|
+
const property = {
|
|
1794
1800
|
get() { return this.context[realName]; },
|
|
1795
1801
|
set(value) { this.context[realName] = value; }
|
|
1796
|
-
}
|
|
1802
|
+
};
|
|
1803
|
+
if (key === 'strokeCap')
|
|
1804
|
+
property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
|
|
1805
|
+
Object.defineProperty(target, key, property);
|
|
1797
1806
|
};
|
|
1798
1807
|
}
|
|
1799
1808
|
const contextMethodNameList = [];
|
|
@@ -2076,8 +2085,8 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2076
2085
|
get width() { return this.size.width; }
|
|
2077
2086
|
get height() { return this.size.height; }
|
|
2078
2087
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2079
|
-
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2080
|
-
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2088
|
+
get pixelWidth() { return this.width * this.pixelRatio || 0; }
|
|
2089
|
+
get pixelHeight() { return this.height * this.pixelRatio || 0; }
|
|
2081
2090
|
get pixelSnap() { return this.config.pixelSnap; }
|
|
2082
2091
|
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2083
2092
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
@@ -2164,20 +2173,33 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2164
2173
|
if (w)
|
|
2165
2174
|
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2166
2175
|
}
|
|
2167
|
-
setStroke(color, strokeWidth, options) {
|
|
2176
|
+
setStroke(color, strokeWidth, options, childOptions) {
|
|
2168
2177
|
if (strokeWidth)
|
|
2169
2178
|
this.strokeWidth = strokeWidth;
|
|
2170
2179
|
if (color)
|
|
2171
2180
|
this.strokeStyle = color;
|
|
2172
2181
|
if (options)
|
|
2173
|
-
this.setStrokeOptions(options);
|
|
2174
|
-
}
|
|
2175
|
-
setStrokeOptions(options) {
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2182
|
+
this.setStrokeOptions(options, childOptions);
|
|
2183
|
+
}
|
|
2184
|
+
setStrokeOptions(options, childOptions) {
|
|
2185
|
+
let { strokeCap, strokeJoin, dashPattern, dashOffset, miterLimit } = options;
|
|
2186
|
+
if (childOptions) {
|
|
2187
|
+
if (childOptions.strokeCap)
|
|
2188
|
+
strokeCap = childOptions.strokeCap;
|
|
2189
|
+
if (childOptions.strokeJoin)
|
|
2190
|
+
strokeJoin = childOptions.strokeJoin;
|
|
2191
|
+
if (childOptions.dashPattern !== undefined)
|
|
2192
|
+
dashPattern = childOptions.dashPattern;
|
|
2193
|
+
if (childOptions.dashOffset !== undefined)
|
|
2194
|
+
dashOffset = childOptions.dashOffset;
|
|
2195
|
+
if (childOptions.miterLimit)
|
|
2196
|
+
miterLimit = childOptions.miterLimit;
|
|
2197
|
+
}
|
|
2198
|
+
this.strokeCap = strokeCap;
|
|
2199
|
+
this.strokeJoin = strokeJoin;
|
|
2200
|
+
this.dashPattern = dashPattern;
|
|
2201
|
+
this.dashOffset = dashOffset;
|
|
2202
|
+
this.miterLimit = miterLimit;
|
|
2181
2203
|
}
|
|
2182
2204
|
saveBlendMode(blendMode) {
|
|
2183
2205
|
this.savedBlendMode = this.blendMode;
|
|
@@ -3912,6 +3934,13 @@ function defineKey(target, key, descriptor, noConfigurable) {
|
|
|
3912
3934
|
function getDescriptor(object, name) {
|
|
3913
3935
|
return Object.getOwnPropertyDescriptor(object, name);
|
|
3914
3936
|
}
|
|
3937
|
+
function createDescriptor(key, defaultValue) {
|
|
3938
|
+
const privateKey = '_' + key;
|
|
3939
|
+
return {
|
|
3940
|
+
get() { const v = this[privateKey]; return v === undefined ? defaultValue : v; },
|
|
3941
|
+
set(value) { this[privateKey] = value; }
|
|
3942
|
+
};
|
|
3943
|
+
}
|
|
3915
3944
|
function getNames(object) {
|
|
3916
3945
|
return Object.getOwnPropertyNames(object);
|
|
3917
3946
|
}
|
|
@@ -4144,15 +4173,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4144
4173
|
const data = target.__DataProcessor.prototype;
|
|
4145
4174
|
const computedKey = '_' + key;
|
|
4146
4175
|
const setMethodName = getSetMethodName(key);
|
|
4147
|
-
const property =
|
|
4148
|
-
get() {
|
|
4149
|
-
const v = this[computedKey];
|
|
4150
|
-
return v === undefined ? defaultValue : v;
|
|
4151
|
-
},
|
|
4152
|
-
set(value) {
|
|
4153
|
-
this[computedKey] = value;
|
|
4154
|
-
}
|
|
4155
|
-
};
|
|
4176
|
+
const property = createDescriptor(key, defaultValue);
|
|
4156
4177
|
if (defaultValue === undefined) {
|
|
4157
4178
|
property.get = function () { return this[computedKey]; };
|
|
4158
4179
|
}
|
|
@@ -4339,6 +4360,14 @@ const LeafHelper = {
|
|
|
4339
4360
|
}
|
|
4340
4361
|
return true;
|
|
4341
4362
|
},
|
|
4363
|
+
copyCanvasByWorld(leaf, currentCanvas, fromCanvas, fromWorld, blendMode, onlyResetTransform) {
|
|
4364
|
+
if (!fromWorld)
|
|
4365
|
+
fromWorld = leaf.__nowWorld;
|
|
4366
|
+
if (leaf.__worldFlipped || Platform.fullImageShadow)
|
|
4367
|
+
currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform);
|
|
4368
|
+
else
|
|
4369
|
+
currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4370
|
+
},
|
|
4342
4371
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4343
4372
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4344
4373
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
@@ -5271,13 +5300,14 @@ const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorl
|
|
|
5271
5300
|
const { toPoint, tempPoint } = AroundHelper;
|
|
5272
5301
|
const LeafMatrix = {
|
|
5273
5302
|
__updateWorldMatrix() {
|
|
5274
|
-
|
|
5303
|
+
const { parent, __layout } = this;
|
|
5304
|
+
multiplyParent$1(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
|
|
5275
5305
|
},
|
|
5276
5306
|
__updateLocalMatrix() {
|
|
5277
5307
|
if (this.__local) {
|
|
5278
5308
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5279
5309
|
if (layout.affectScaleOrRotation) {
|
|
5280
|
-
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5310
|
+
if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
|
|
5281
5311
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5282
5312
|
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5283
5313
|
}
|
|
@@ -5443,10 +5473,7 @@ const LeafRender = {
|
|
|
5443
5473
|
return this.__renderEraser(canvas, options);
|
|
5444
5474
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5445
5475
|
this.__draw(tempCanvas, options, canvas);
|
|
5446
|
-
|
|
5447
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5448
|
-
else
|
|
5449
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5476
|
+
LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
|
|
5450
5477
|
tempCanvas.recycle(this.__nowWorld);
|
|
5451
5478
|
}
|
|
5452
5479
|
else {
|
|
@@ -5494,7 +5521,7 @@ const BranchRender = {
|
|
|
5494
5521
|
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5495
5522
|
else if (data.dimskip)
|
|
5496
5523
|
options.dimOpacity && (options.dimOpacity = 0);
|
|
5497
|
-
if (data.__single) {
|
|
5524
|
+
if (data.__single && !this.isBranchLeaf) {
|
|
5498
5525
|
if (data.eraser === 'path')
|
|
5499
5526
|
return this.__renderEraser(canvas, options);
|
|
5500
5527
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5516,9 +5543,7 @@ const BranchRender = {
|
|
|
5516
5543
|
else {
|
|
5517
5544
|
const { children } = this;
|
|
5518
5545
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5519
|
-
|
|
5520
|
-
continue;
|
|
5521
|
-
children[i].__render(canvas, options);
|
|
5546
|
+
excludeRenderBounds(children[i], options) || children[i].__render(canvas, options);
|
|
5522
5547
|
}
|
|
5523
5548
|
}
|
|
5524
5549
|
},
|
|
@@ -5526,14 +5551,13 @@ const BranchRender = {
|
|
|
5526
5551
|
if (this.__worldOpacity) {
|
|
5527
5552
|
const { children } = this;
|
|
5528
5553
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5529
|
-
|
|
5530
|
-
continue;
|
|
5531
|
-
children[i].__clip(canvas, options);
|
|
5554
|
+
excludeRenderBounds(children[i], options) || children[i].__clip(canvas, options);
|
|
5532
5555
|
}
|
|
5533
5556
|
}
|
|
5534
5557
|
}
|
|
5535
5558
|
};
|
|
5536
5559
|
|
|
5560
|
+
const tempScaleData = {};
|
|
5537
5561
|
const { LEAF, create } = IncrementId;
|
|
5538
5562
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5539
5563
|
const { toOuterOf } = BoundsHelper;
|
|
@@ -5726,6 +5750,22 @@ exports.Leaf = class Leaf {
|
|
|
5726
5750
|
return this.__world;
|
|
5727
5751
|
}
|
|
5728
5752
|
}
|
|
5753
|
+
getClampRenderScale() {
|
|
5754
|
+
let { scaleX } = this.__nowWorld || this.__world;
|
|
5755
|
+
if (scaleX < 0)
|
|
5756
|
+
scaleX = -scaleX;
|
|
5757
|
+
return scaleX > 1 ? scaleX : 1;
|
|
5758
|
+
}
|
|
5759
|
+
getRenderScaleData(abs, scaleFixed) {
|
|
5760
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld;
|
|
5761
|
+
if (scaleFixed)
|
|
5762
|
+
tempScaleData.scaleX = tempScaleData.scaleY = 1;
|
|
5763
|
+
else if (abs)
|
|
5764
|
+
tempScaleData.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData.scaleY = scaleY < 0 ? -scaleY : scaleY;
|
|
5765
|
+
else
|
|
5766
|
+
tempScaleData.scaleX = scaleX, tempScaleData.scaleY = scaleY;
|
|
5767
|
+
return tempScaleData;
|
|
5768
|
+
}
|
|
5729
5769
|
getTransform(relative) {
|
|
5730
5770
|
return this.__layout.getTransform(relative || 'local');
|
|
5731
5771
|
}
|
|
@@ -6250,7 +6290,7 @@ class LeafLevelList {
|
|
|
6250
6290
|
}
|
|
6251
6291
|
}
|
|
6252
6292
|
|
|
6253
|
-
const version = "1.
|
|
6293
|
+
const version = "1.8.0";
|
|
6254
6294
|
|
|
6255
6295
|
exports.AlignHelper = AlignHelper;
|
|
6256
6296
|
exports.AroundHelper = AroundHelper;
|
|
@@ -6330,6 +6370,7 @@ exports.autoLayoutType = autoLayoutType;
|
|
|
6330
6370
|
exports.boundsType = boundsType;
|
|
6331
6371
|
exports.canvasPatch = canvasPatch;
|
|
6332
6372
|
exports.canvasSizeAttrs = canvasSizeAttrs;
|
|
6373
|
+
exports.createDescriptor = createDescriptor;
|
|
6333
6374
|
exports.cursorType = cursorType;
|
|
6334
6375
|
exports.dataProcessor = dataProcessor;
|
|
6335
6376
|
exports.dataType = dataType;
|
package/lib/core.esm.js
CHANGED
|
@@ -860,6 +860,12 @@ const AroundHelper = {
|
|
|
860
860
|
}
|
|
861
861
|
if (!onlyBoxSize)
|
|
862
862
|
to.x += box.x, to.y += box.y;
|
|
863
|
+
},
|
|
864
|
+
getPoint(around, box, to) {
|
|
865
|
+
if (!to)
|
|
866
|
+
to = {};
|
|
867
|
+
AroundHelper.toPoint(around, box, to, true);
|
|
868
|
+
return to;
|
|
863
869
|
}
|
|
864
870
|
};
|
|
865
871
|
function get(around) {
|
|
@@ -1788,10 +1794,13 @@ function contextAttr(realName) {
|
|
|
1788
1794
|
return (target, key) => {
|
|
1789
1795
|
if (!realName)
|
|
1790
1796
|
realName = key;
|
|
1791
|
-
|
|
1797
|
+
const property = {
|
|
1792
1798
|
get() { return this.context[realName]; },
|
|
1793
1799
|
set(value) { this.context[realName] = value; }
|
|
1794
|
-
}
|
|
1800
|
+
};
|
|
1801
|
+
if (key === 'strokeCap')
|
|
1802
|
+
property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
|
|
1803
|
+
Object.defineProperty(target, key, property);
|
|
1795
1804
|
};
|
|
1796
1805
|
}
|
|
1797
1806
|
const contextMethodNameList = [];
|
|
@@ -2074,8 +2083,8 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2074
2083
|
get width() { return this.size.width; }
|
|
2075
2084
|
get height() { return this.size.height; }
|
|
2076
2085
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2077
|
-
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2078
|
-
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2086
|
+
get pixelWidth() { return this.width * this.pixelRatio || 0; }
|
|
2087
|
+
get pixelHeight() { return this.height * this.pixelRatio || 0; }
|
|
2079
2088
|
get pixelSnap() { return this.config.pixelSnap; }
|
|
2080
2089
|
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2081
2090
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
@@ -2162,20 +2171,33 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2162
2171
|
if (w)
|
|
2163
2172
|
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2164
2173
|
}
|
|
2165
|
-
setStroke(color, strokeWidth, options) {
|
|
2174
|
+
setStroke(color, strokeWidth, options, childOptions) {
|
|
2166
2175
|
if (strokeWidth)
|
|
2167
2176
|
this.strokeWidth = strokeWidth;
|
|
2168
2177
|
if (color)
|
|
2169
2178
|
this.strokeStyle = color;
|
|
2170
2179
|
if (options)
|
|
2171
|
-
this.setStrokeOptions(options);
|
|
2172
|
-
}
|
|
2173
|
-
setStrokeOptions(options) {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2180
|
+
this.setStrokeOptions(options, childOptions);
|
|
2181
|
+
}
|
|
2182
|
+
setStrokeOptions(options, childOptions) {
|
|
2183
|
+
let { strokeCap, strokeJoin, dashPattern, dashOffset, miterLimit } = options;
|
|
2184
|
+
if (childOptions) {
|
|
2185
|
+
if (childOptions.strokeCap)
|
|
2186
|
+
strokeCap = childOptions.strokeCap;
|
|
2187
|
+
if (childOptions.strokeJoin)
|
|
2188
|
+
strokeJoin = childOptions.strokeJoin;
|
|
2189
|
+
if (childOptions.dashPattern !== undefined)
|
|
2190
|
+
dashPattern = childOptions.dashPattern;
|
|
2191
|
+
if (childOptions.dashOffset !== undefined)
|
|
2192
|
+
dashOffset = childOptions.dashOffset;
|
|
2193
|
+
if (childOptions.miterLimit)
|
|
2194
|
+
miterLimit = childOptions.miterLimit;
|
|
2195
|
+
}
|
|
2196
|
+
this.strokeCap = strokeCap;
|
|
2197
|
+
this.strokeJoin = strokeJoin;
|
|
2198
|
+
this.dashPattern = dashPattern;
|
|
2199
|
+
this.dashOffset = dashOffset;
|
|
2200
|
+
this.miterLimit = miterLimit;
|
|
2179
2201
|
}
|
|
2180
2202
|
saveBlendMode(blendMode) {
|
|
2181
2203
|
this.savedBlendMode = this.blendMode;
|
|
@@ -3910,6 +3932,13 @@ function defineKey(target, key, descriptor, noConfigurable) {
|
|
|
3910
3932
|
function getDescriptor(object, name) {
|
|
3911
3933
|
return Object.getOwnPropertyDescriptor(object, name);
|
|
3912
3934
|
}
|
|
3935
|
+
function createDescriptor(key, defaultValue) {
|
|
3936
|
+
const privateKey = '_' + key;
|
|
3937
|
+
return {
|
|
3938
|
+
get() { const v = this[privateKey]; return v === undefined ? defaultValue : v; },
|
|
3939
|
+
set(value) { this[privateKey] = value; }
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3913
3942
|
function getNames(object) {
|
|
3914
3943
|
return Object.getOwnPropertyNames(object);
|
|
3915
3944
|
}
|
|
@@ -4142,15 +4171,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4142
4171
|
const data = target.__DataProcessor.prototype;
|
|
4143
4172
|
const computedKey = '_' + key;
|
|
4144
4173
|
const setMethodName = getSetMethodName(key);
|
|
4145
|
-
const property =
|
|
4146
|
-
get() {
|
|
4147
|
-
const v = this[computedKey];
|
|
4148
|
-
return v === undefined ? defaultValue : v;
|
|
4149
|
-
},
|
|
4150
|
-
set(value) {
|
|
4151
|
-
this[computedKey] = value;
|
|
4152
|
-
}
|
|
4153
|
-
};
|
|
4174
|
+
const property = createDescriptor(key, defaultValue);
|
|
4154
4175
|
if (defaultValue === undefined) {
|
|
4155
4176
|
property.get = function () { return this[computedKey]; };
|
|
4156
4177
|
}
|
|
@@ -4337,6 +4358,14 @@ const LeafHelper = {
|
|
|
4337
4358
|
}
|
|
4338
4359
|
return true;
|
|
4339
4360
|
},
|
|
4361
|
+
copyCanvasByWorld(leaf, currentCanvas, fromCanvas, fromWorld, blendMode, onlyResetTransform) {
|
|
4362
|
+
if (!fromWorld)
|
|
4363
|
+
fromWorld = leaf.__nowWorld;
|
|
4364
|
+
if (leaf.__worldFlipped || Platform.fullImageShadow)
|
|
4365
|
+
currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform);
|
|
4366
|
+
else
|
|
4367
|
+
currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4368
|
+
},
|
|
4340
4369
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4341
4370
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4342
4371
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
@@ -5269,13 +5298,14 @@ const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorl
|
|
|
5269
5298
|
const { toPoint, tempPoint } = AroundHelper;
|
|
5270
5299
|
const LeafMatrix = {
|
|
5271
5300
|
__updateWorldMatrix() {
|
|
5272
|
-
|
|
5301
|
+
const { parent, __layout } = this;
|
|
5302
|
+
multiplyParent$1(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
|
|
5273
5303
|
},
|
|
5274
5304
|
__updateLocalMatrix() {
|
|
5275
5305
|
if (this.__local) {
|
|
5276
5306
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5277
5307
|
if (layout.affectScaleOrRotation) {
|
|
5278
|
-
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5308
|
+
if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
|
|
5279
5309
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5280
5310
|
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5281
5311
|
}
|
|
@@ -5441,10 +5471,7 @@ const LeafRender = {
|
|
|
5441
5471
|
return this.__renderEraser(canvas, options);
|
|
5442
5472
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5443
5473
|
this.__draw(tempCanvas, options, canvas);
|
|
5444
|
-
|
|
5445
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5446
|
-
else
|
|
5447
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5474
|
+
LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
|
|
5448
5475
|
tempCanvas.recycle(this.__nowWorld);
|
|
5449
5476
|
}
|
|
5450
5477
|
else {
|
|
@@ -5492,7 +5519,7 @@ const BranchRender = {
|
|
|
5492
5519
|
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5493
5520
|
else if (data.dimskip)
|
|
5494
5521
|
options.dimOpacity && (options.dimOpacity = 0);
|
|
5495
|
-
if (data.__single) {
|
|
5522
|
+
if (data.__single && !this.isBranchLeaf) {
|
|
5496
5523
|
if (data.eraser === 'path')
|
|
5497
5524
|
return this.__renderEraser(canvas, options);
|
|
5498
5525
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5514,9 +5541,7 @@ const BranchRender = {
|
|
|
5514
5541
|
else {
|
|
5515
5542
|
const { children } = this;
|
|
5516
5543
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5517
|
-
|
|
5518
|
-
continue;
|
|
5519
|
-
children[i].__render(canvas, options);
|
|
5544
|
+
excludeRenderBounds(children[i], options) || children[i].__render(canvas, options);
|
|
5520
5545
|
}
|
|
5521
5546
|
}
|
|
5522
5547
|
},
|
|
@@ -5524,14 +5549,13 @@ const BranchRender = {
|
|
|
5524
5549
|
if (this.__worldOpacity) {
|
|
5525
5550
|
const { children } = this;
|
|
5526
5551
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5527
|
-
|
|
5528
|
-
continue;
|
|
5529
|
-
children[i].__clip(canvas, options);
|
|
5552
|
+
excludeRenderBounds(children[i], options) || children[i].__clip(canvas, options);
|
|
5530
5553
|
}
|
|
5531
5554
|
}
|
|
5532
5555
|
}
|
|
5533
5556
|
};
|
|
5534
5557
|
|
|
5558
|
+
const tempScaleData = {};
|
|
5535
5559
|
const { LEAF, create } = IncrementId;
|
|
5536
5560
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5537
5561
|
const { toOuterOf } = BoundsHelper;
|
|
@@ -5724,6 +5748,22 @@ let Leaf = class Leaf {
|
|
|
5724
5748
|
return this.__world;
|
|
5725
5749
|
}
|
|
5726
5750
|
}
|
|
5751
|
+
getClampRenderScale() {
|
|
5752
|
+
let { scaleX } = this.__nowWorld || this.__world;
|
|
5753
|
+
if (scaleX < 0)
|
|
5754
|
+
scaleX = -scaleX;
|
|
5755
|
+
return scaleX > 1 ? scaleX : 1;
|
|
5756
|
+
}
|
|
5757
|
+
getRenderScaleData(abs, scaleFixed) {
|
|
5758
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld;
|
|
5759
|
+
if (scaleFixed)
|
|
5760
|
+
tempScaleData.scaleX = tempScaleData.scaleY = 1;
|
|
5761
|
+
else if (abs)
|
|
5762
|
+
tempScaleData.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData.scaleY = scaleY < 0 ? -scaleY : scaleY;
|
|
5763
|
+
else
|
|
5764
|
+
tempScaleData.scaleX = scaleX, tempScaleData.scaleY = scaleY;
|
|
5765
|
+
return tempScaleData;
|
|
5766
|
+
}
|
|
5727
5767
|
getTransform(relative) {
|
|
5728
5768
|
return this.__layout.getTransform(relative || 'local');
|
|
5729
5769
|
}
|
|
@@ -6248,6 +6288,6 @@ class LeafLevelList {
|
|
|
6248
6288
|
}
|
|
6249
6289
|
}
|
|
6250
6290
|
|
|
6251
|
-
const version = "1.
|
|
6291
|
+
const version = "1.8.0";
|
|
6252
6292
|
|
|
6253
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
|
|
6293
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, useModule, version, visibleType };
|