modern-canvas 0.12.4 → 0.12.6
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 +33 -10
- package/dist/index.d.cts +4 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +14 -14
- package/dist/index.mjs +33 -10
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6244,9 +6244,12 @@ let Node = class extends CoreObject {
|
|
|
6244
6244
|
}
|
|
6245
6245
|
findOne(callbackfn) {
|
|
6246
6246
|
for (const child of this._children.default) {
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6247
|
+
if (callbackfn(child)) {
|
|
6248
|
+
return child;
|
|
6249
|
+
}
|
|
6250
|
+
const res = child.findOne(callbackfn);
|
|
6251
|
+
if (res) {
|
|
6252
|
+
return res;
|
|
6250
6253
|
}
|
|
6251
6254
|
}
|
|
6252
6255
|
return void 0;
|
|
@@ -6254,9 +6257,8 @@ let Node = class extends CoreObject {
|
|
|
6254
6257
|
findAll(callbackfn) {
|
|
6255
6258
|
const items = [];
|
|
6256
6259
|
for (const child of this._children.default) {
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
items.push(value);
|
|
6260
|
+
if (callbackfn(child)) {
|
|
6261
|
+
items.push(child);
|
|
6260
6262
|
}
|
|
6261
6263
|
items.push(...child.findAll(callbackfn));
|
|
6262
6264
|
}
|
|
@@ -6265,7 +6267,10 @@ let Node = class extends CoreObject {
|
|
|
6265
6267
|
findAncestor(callbackfn) {
|
|
6266
6268
|
const parent = this._parent;
|
|
6267
6269
|
if (parent) {
|
|
6268
|
-
|
|
6270
|
+
if (callbackfn(parent)) {
|
|
6271
|
+
return parent;
|
|
6272
|
+
}
|
|
6273
|
+
const value = parent.findAncestor(callbackfn);
|
|
6269
6274
|
if (value) {
|
|
6270
6275
|
return value;
|
|
6271
6276
|
}
|
|
@@ -10279,10 +10284,25 @@ class BaseElement2DText extends CoreObject {
|
|
|
10279
10284
|
}
|
|
10280
10285
|
draw() {
|
|
10281
10286
|
const ctx = this.parent.context;
|
|
10282
|
-
|
|
10283
|
-
|
|
10287
|
+
let drawMode;
|
|
10288
|
+
if (this.drawMode === "auto") {
|
|
10289
|
+
if (!!this.effects?.length || this.content.some((p) => {
|
|
10290
|
+
return p.fragments.some((f) => !!f.highlightImage);
|
|
10291
|
+
})) {
|
|
10292
|
+
drawMode = "texture";
|
|
10293
|
+
} else {
|
|
10294
|
+
drawMode = "path";
|
|
10295
|
+
}
|
|
10284
10296
|
} else {
|
|
10285
|
-
this.
|
|
10297
|
+
drawMode = this.drawMode;
|
|
10298
|
+
}
|
|
10299
|
+
switch (drawMode) {
|
|
10300
|
+
case "texture":
|
|
10301
|
+
this._textureDraw(ctx);
|
|
10302
|
+
break;
|
|
10303
|
+
case "path":
|
|
10304
|
+
this._pathDraw(ctx);
|
|
10305
|
+
break;
|
|
10286
10306
|
}
|
|
10287
10307
|
}
|
|
10288
10308
|
}
|
|
@@ -10310,6 +10330,9 @@ __decorateClass$f([
|
|
|
10310
10330
|
__decorateClass$f([
|
|
10311
10331
|
property({ alias: "base.fonts" })
|
|
10312
10332
|
], BaseElement2DText.prototype, "fonts");
|
|
10333
|
+
__decorateClass$f([
|
|
10334
|
+
property({ internal: true, default: "auto" })
|
|
10335
|
+
], BaseElement2DText.prototype, "drawMode");
|
|
10313
10336
|
|
|
10314
10337
|
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
10315
10338
|
var __decorateClass$e = (decorators, target, key, kind) => {
|