@visactor/vrender-core 0.16.9-alpha.1 → 0.16.10-alpha.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/dist/index.js CHANGED
@@ -11231,9 +11231,7 @@
11231
11231
  (_a = data.waitingMark) === null || _a === void 0 ? void 0 : _a.push(mark);
11232
11232
  }
11233
11233
  else if (mark) {
11234
- application.global.getRequestAnimationFrame()(() => {
11235
- mark.imageLoadSuccess(url, data.data);
11236
- });
11234
+ mark.imageLoadSuccess(url, data.data);
11237
11235
  }
11238
11236
  }
11239
11237
  else {
@@ -12314,12 +12312,12 @@
12314
12312
  this.resources.set(url, cache);
12315
12313
  if (typeof image === 'string') {
12316
12314
  cache.state = 'loading';
12317
- if (vutils.isValidUrl(image) || vutils.isBase64(image)) {
12318
- ResourceLoader.GetImage(image, this);
12315
+ if (image.startsWith('<svg')) {
12316
+ ResourceLoader.GetSvg(image, this);
12319
12317
  this.backgroundImg = this.backgroundImg || background;
12320
12318
  }
12321
- else if (image.startsWith('<svg')) {
12322
- ResourceLoader.GetSvg(image, this);
12319
+ else if (vutils.isValidUrl(image) || image.includes('/') || vutils.isBase64(image)) {
12320
+ ResourceLoader.GetImage(image, this);
12323
12321
  this.backgroundImg = this.backgroundImg || background;
12324
12322
  }
12325
12323
  }
@@ -23642,6 +23640,7 @@
23642
23640
  return this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
23643
23641
  }
23644
23642
  clearScreen(renderService, context, drawContext) {
23643
+ var _a;
23645
23644
  const { clear } = drawContext;
23646
23645
  if (clear) {
23647
23646
  const canvas = context.getCanvas();
@@ -23649,10 +23648,19 @@
23649
23648
  const x = 0;
23650
23649
  const y = 0;
23651
23650
  context.clearRect(x, y, width, height);
23652
- context.fillStyle = createColor(context, clear, {
23653
- AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }
23654
- }, 0, 0);
23655
- context.fillRect(x, y, width, height);
23651
+ const stage = (_a = renderService.drawParams) === null || _a === void 0 ? void 0 : _a.stage;
23652
+ if (stage && stage.backgroundImg && stage.resources) {
23653
+ const res = stage.resources.get(clear);
23654
+ if (res && res.state === 'success' && res.data) {
23655
+ context.drawImage(res.data, x, y, width, height);
23656
+ }
23657
+ }
23658
+ else {
23659
+ context.fillStyle = createColor(context, clear, {
23660
+ AABBBounds: { x1: x, y1: y, x2: x + width, y2: y + height }
23661
+ }, 0, 0);
23662
+ context.fillRect(x, y, width, height);
23663
+ }
23656
23664
  }
23657
23665
  }
23658
23666
  afterDraw(renderService, drawParams) {
@@ -26105,6 +26113,9 @@
26105
26113
  this.ticker.addTimeline(this.timeline);
26106
26114
  this.timeline.pause();
26107
26115
  this.optmize(params.optimize);
26116
+ if (this._background && vutils.isString(this._background)) {
26117
+ this.setAttributes({ background: this._background });
26118
+ }
26108
26119
  }
26109
26120
  optmize(params) {
26110
26121
  this.optmizeRender(params === null || params === void 0 ? void 0 : params.skipRenderWithOutRange);