modern-canvas 0.4.0 → 0.4.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/index.cjs +29 -8
- package/dist/index.js +6 -6
- package/dist/index.mjs +29 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8772,7 +8772,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
8772
8772
|
if (this.style.boxShadow !== "none") {
|
|
8773
8773
|
const node = this.getNode(nodePath);
|
|
8774
8774
|
if (node) ; else {
|
|
8775
|
-
this.appendChild(new exports.ShadowEffect(), "back");
|
|
8775
|
+
this.appendChild(new exports.ShadowEffect({ name: nodePath }), "back");
|
|
8776
8776
|
}
|
|
8777
8777
|
} else {
|
|
8778
8778
|
const node = this.getNode(nodePath);
|
|
@@ -8789,7 +8789,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
8789
8789
|
if (node) {
|
|
8790
8790
|
node.src = maskImage;
|
|
8791
8791
|
} else {
|
|
8792
|
-
this.appendChild(new exports.MaskEffect({ src: maskImage }), "back");
|
|
8792
|
+
this.appendChild(new exports.MaskEffect({ name: nodePath, src: maskImage }), "back");
|
|
8793
8793
|
}
|
|
8794
8794
|
} else {
|
|
8795
8795
|
const node = this.getNode(nodePath);
|
|
@@ -8828,13 +8828,34 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
8828
8828
|
this._updateOverflow();
|
|
8829
8829
|
}
|
|
8830
8830
|
getRect() {
|
|
8831
|
-
const
|
|
8832
|
-
const
|
|
8831
|
+
const { width: w, height: h } = this.size;
|
|
8832
|
+
const x1 = 0;
|
|
8833
|
+
const y1 = 0;
|
|
8834
|
+
const x2 = x1 + w;
|
|
8835
|
+
const y2 = y1 + h;
|
|
8836
|
+
const [a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
8837
|
+
const points = [
|
|
8838
|
+
[x1, y1],
|
|
8839
|
+
[x1, y2],
|
|
8840
|
+
[x2, y1],
|
|
8841
|
+
[x2, y2]
|
|
8842
|
+
].map((p) => {
|
|
8843
|
+
return [
|
|
8844
|
+
a * p[0] + c * p[1] + tx,
|
|
8845
|
+
b * p[0] + d * p[1] + ty
|
|
8846
|
+
];
|
|
8847
|
+
});
|
|
8848
|
+
const xx = points.map((p) => p[0]);
|
|
8849
|
+
const yy = points.map((p) => p[1]);
|
|
8850
|
+
const minX = Math.min(...xx);
|
|
8851
|
+
const maxX = Math.max(...xx);
|
|
8852
|
+
const minY = Math.min(...yy);
|
|
8853
|
+
const maxY = Math.max(...yy);
|
|
8833
8854
|
return new Rect2(
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8855
|
+
minX,
|
|
8856
|
+
minY,
|
|
8857
|
+
maxX - minX,
|
|
8858
|
+
maxY - minY
|
|
8838
8859
|
);
|
|
8839
8860
|
}
|
|
8840
8861
|
_updateOverflow() {
|