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.mjs
CHANGED
|
@@ -8766,7 +8766,7 @@ let BaseElement2D = class extends Node2D {
|
|
|
8766
8766
|
if (this.style.boxShadow !== "none") {
|
|
8767
8767
|
const node = this.getNode(nodePath);
|
|
8768
8768
|
if (node) ; else {
|
|
8769
|
-
this.appendChild(new ShadowEffect(), "back");
|
|
8769
|
+
this.appendChild(new ShadowEffect({ name: nodePath }), "back");
|
|
8770
8770
|
}
|
|
8771
8771
|
} else {
|
|
8772
8772
|
const node = this.getNode(nodePath);
|
|
@@ -8783,7 +8783,7 @@ let BaseElement2D = class extends Node2D {
|
|
|
8783
8783
|
if (node) {
|
|
8784
8784
|
node.src = maskImage;
|
|
8785
8785
|
} else {
|
|
8786
|
-
this.appendChild(new MaskEffect({ src: maskImage }), "back");
|
|
8786
|
+
this.appendChild(new MaskEffect({ name: nodePath, src: maskImage }), "back");
|
|
8787
8787
|
}
|
|
8788
8788
|
} else {
|
|
8789
8789
|
const node = this.getNode(nodePath);
|
|
@@ -8822,13 +8822,34 @@ let BaseElement2D = class extends Node2D {
|
|
|
8822
8822
|
this._updateOverflow();
|
|
8823
8823
|
}
|
|
8824
8824
|
getRect() {
|
|
8825
|
-
const
|
|
8826
|
-
const
|
|
8825
|
+
const { width: w, height: h } = this.size;
|
|
8826
|
+
const x1 = 0;
|
|
8827
|
+
const y1 = 0;
|
|
8828
|
+
const x2 = x1 + w;
|
|
8829
|
+
const y2 = y1 + h;
|
|
8830
|
+
const [a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
8831
|
+
const points = [
|
|
8832
|
+
[x1, y1],
|
|
8833
|
+
[x1, y2],
|
|
8834
|
+
[x2, y1],
|
|
8835
|
+
[x2, y2]
|
|
8836
|
+
].map((p) => {
|
|
8837
|
+
return [
|
|
8838
|
+
a * p[0] + c * p[1] + tx,
|
|
8839
|
+
b * p[0] + d * p[1] + ty
|
|
8840
|
+
];
|
|
8841
|
+
});
|
|
8842
|
+
const xx = points.map((p) => p[0]);
|
|
8843
|
+
const yy = points.map((p) => p[1]);
|
|
8844
|
+
const minX = Math.min(...xx);
|
|
8845
|
+
const maxX = Math.max(...xx);
|
|
8846
|
+
const minY = Math.min(...yy);
|
|
8847
|
+
const maxY = Math.max(...yy);
|
|
8827
8848
|
return new Rect2(
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8849
|
+
minX,
|
|
8850
|
+
minY,
|
|
8851
|
+
maxX - minX,
|
|
8852
|
+
maxY - minY
|
|
8832
8853
|
);
|
|
8833
8854
|
}
|
|
8834
8855
|
_updateOverflow() {
|