modern-canvas 0.6.9 → 0.6.10

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 CHANGED
@@ -7101,29 +7101,26 @@ class CanvasContext extends modernPath2d.Path2D {
7101
7101
  }
7102
7102
  }
7103
7103
  stroke(options) {
7104
- const path = new modernPath2d.Path2D(this);
7105
- let texture = this._defaultStyle;
7106
- if (this.strokeStyle) {
7107
- texture = this._toTexture(this.strokeStyle);
7108
- }
7109
- if (this.curves.length) {
7110
- this._draws.push({
7111
- ...options,
7112
- type: "stroke",
7113
- path,
7114
- texture,
7115
- uvTransform: this.uvTransform,
7116
- vertTransform: this.vertTransform,
7117
- style: {
7118
- alignment: 0.5,
7119
- cap: this.lineCap ?? "butt",
7120
- join: this.lineJoin ?? "miter",
7121
- width: this.lineWidth ?? 1,
7122
- miterLimit: this.miterLimit ?? 10
7123
- }
7124
- });
7125
- super.reset();
7104
+ if (!this.curves.length) {
7105
+ return;
7126
7106
  }
7107
+ const strokeStyle = this.strokeStyle ?? (typeof this.style.stroke === "string" ? this.style.stroke : void 0);
7108
+ this._draws.push({
7109
+ ...options,
7110
+ type: "stroke",
7111
+ path: new modernPath2d.Path2D(this),
7112
+ texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
7113
+ uvTransform: this.uvTransform,
7114
+ vertTransform: this.vertTransform,
7115
+ style: {
7116
+ alignment: 0.5,
7117
+ cap: this.lineCap ?? "butt",
7118
+ join: this.lineJoin ?? "miter",
7119
+ width: this.lineWidth ?? 1,
7120
+ miterLimit: this.miterLimit ?? 10
7121
+ }
7122
+ });
7123
+ super.reset();
7127
7124
  }
7128
7125
  fillRect(x, y, width, height) {
7129
7126
  this.rect(x, y, width, height).fill();
@@ -7132,16 +7129,15 @@ class CanvasContext extends modernPath2d.Path2D {
7132
7129
  this.rect(x, y, width, height).stroke();
7133
7130
  }
7134
7131
  fill(options) {
7135
- const path = new modernPath2d.Path2D(this);
7136
- let texture = this._defaultStyle;
7137
- if (this.fillStyle) {
7138
- texture = this._toTexture(this.fillStyle);
7132
+ if (!this.curves.length) {
7133
+ return;
7139
7134
  }
7135
+ const fillStyle = this.fillStyle ?? (typeof this.style.fill === "string" ? this.style.fill : void 0);
7140
7136
  this._draws.push({
7141
7137
  ...options,
7142
7138
  type: "fill",
7143
- path,
7144
- texture,
7139
+ path: new modernPath2d.Path2D(this),
7140
+ texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
7145
7141
  uvTransform: this.uvTransform,
7146
7142
  vertTransform: this.vertTransform
7147
7143
  });
@@ -9332,15 +9328,13 @@ class BaseElement2DText extends CoreObject {
9332
9328
  draw() {
9333
9329
  const ctx = this.parent.context;
9334
9330
  this.base.update();
9335
- this.base.paragraphs.forEach((p) => {
9336
- p.fragments.forEach((f) => {
9337
- f.characters.forEach((c) => {
9338
- ctx.fillStyle = c.computedStyle.color;
9339
- ctx.addPath(c.path);
9340
- ctx.style.fillRule = "evenodd";
9341
- ctx.closePath();
9342
- ctx.fill();
9343
- });
9331
+ this.base.pathSets.forEach((pathSet) => {
9332
+ pathSet.paths.forEach((path) => {
9333
+ ctx.addPath(path);
9334
+ ctx.style = { ...path.style };
9335
+ ctx.fillStyle = void 0;
9336
+ ctx.strokeStyle = void 0;
9337
+ ctx.fill();
9344
9338
  });
9345
9339
  });
9346
9340
  }
@@ -9389,7 +9383,7 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
9389
9383
  super._updateProperty(key, value, oldValue, declaration);
9390
9384
  switch (key) {
9391
9385
  case "rotation":
9392
- this.updateGlobalTransform();
9386
+ this.requestRelayout();
9393
9387
  break;
9394
9388
  }
9395
9389
  }
@@ -13584,7 +13578,7 @@ exports.CanvasItemEditor = class CanvasItemEditor extends exports.Control {
13584
13578
  style: {
13585
13579
  width: 500,
13586
13580
  height: 500,
13587
- backgroundColor: "#FFFFFFFF",
13581
+ backgroundColor: "#00FFFFFF",
13588
13582
  // overflow: 'hidden',
13589
13583
  pointerEvents: "none"
13590
13584
  // boxShadow: '2px 2px 2px 1px rgba(0, 0, 0, 0.2)',