@netless/app-slide 0.0.20 → 0.0.21

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/main.es.js CHANGED
@@ -30477,6 +30477,18 @@ void main() {
30477
30477
  const i2 = new hs();
30478
30478
  i2.drawRect(0, 0, t2.width, t2.height), this.container.addChild(i2);
30479
30479
  }
30480
+ get width() {
30481
+ return this.json.width;
30482
+ }
30483
+ get height() {
30484
+ return this.json.height;
30485
+ }
30486
+ get x() {
30487
+ return this.json.position.x;
30488
+ }
30489
+ get y() {
30490
+ return this.json.position.y;
30491
+ }
30480
30492
  getTextElement(t2, e2) {
30481
30493
  return t2 === "paragraph" ? this.paragraphs[e2[0]] : null;
30482
30494
  }
@@ -30691,7 +30703,23 @@ void main() {
30691
30703
  render() {
30692
30704
  var t2, e2, n2, r2, i2, o2;
30693
30705
  return $u(this, void 0, void 0, function* () {
30694
- if (yield this.createBackgroundMask(), yield this.createBackground(), yield this.subClassRender(), yield this.createFilledPathMask(), yield this.createPathMask(), yield this.createPathFill(), yield this.createArrow(), this.text && (yield this.text.render()), ((t2 = this.json.textBody) === null || t2 === void 0 ? void 0 : t2.iterateType) === "wd" || ((e2 = this.json.textBody) === null || e2 === void 0 ? void 0 : e2.iterateType) === "lt" ? (this.renderContainer.addChild(this.container), this.text && (this.text.container.position.x = (r2 = (n2 = this.json.position) === null || n2 === void 0 ? void 0 : n2.x) !== null && r2 !== void 0 ? r2 : 0, this.text.container.position.y = (o2 = (i2 = this.json.position) === null || i2 === void 0 ? void 0 : i2.y) !== null && o2 !== void 0 ? o2 : 0, this.renderContainer.addChild(this.text.container))) : (this.text && this.container.addChild(this.text.container), this.renderContainer.addChild(this.container)), this.json.cacheAsBitMap, this.json.id === "background") {
30706
+ if (yield this.createBackgroundMask(), yield this.createBackground(), yield this.subClassRender(), yield this.createFilledPathMask(), yield this.createPathMask(), yield this.createPathFill(), yield this.createArrow(), this.text && (yield this.text.render()), ((t2 = this.json.textBody) === null || t2 === void 0 ? void 0 : t2.iterateType) === "wd" || ((e2 = this.json.textBody) === null || e2 === void 0 ? void 0 : e2.iterateType) === "lt")
30707
+ this.renderContainer.addChild(this.container), this.text && (this.text.container.position.x = (r2 = (n2 = this.json.position) === null || n2 === void 0 ? void 0 : n2.x) !== null && r2 !== void 0 ? r2 : 0, this.text.container.position.y = (o2 = (i2 = this.json.position) === null || i2 === void 0 ? void 0 : i2.y) !== null && o2 !== void 0 ? o2 : 0, this.renderContainer.addChild(this.text.container));
30708
+ else {
30709
+ if (this.text) {
30710
+ if (Object(a.isBoolean)(this.json.textRotateWithShape) && !this.json.textRotateWithShape) {
30711
+ const t3 = this.json.rotation || 0;
30712
+ this.text.container.rotation = -t3;
30713
+ const { width: e3 } = this.text;
30714
+ this.text.container.position.x = e3;
30715
+ }
30716
+ this.container.addChild(this.text.container);
30717
+ }
30718
+ this.renderContainer.addChild(this.container);
30719
+ }
30720
+ if (this.json.cacheAsBitMap && setTimeout(() => {
30721
+ this.renderContainer.cacheAsBitmap = true;
30722
+ }, 333), this.json.id === "background") {
30695
30723
  const t3 = Tn.create({ width: this.json.width, height: this.json.height });
30696
30724
  this.ctx.renderer.render(this.renderContainer, { renderTexture: t3 }), this.ctx.bgTexture = t3;
30697
30725
  }
@@ -31047,7 +31075,7 @@ void main() {
31047
31075
  };
31048
31076
  class ll extends tl {
31049
31077
  constructor(t2, e2, n2) {
31050
- super(Object.assign(Object.assign({}, t2), { type: "Shape", useBgFill: false }), e2, n2), this.picTextureId = "", this.picSprite = new ms(), this.picMask = new ms(), this.cmd = new su(this), this.picFill = t2.picFill, this.media = t2 == null ? void 0 : t2.media;
31078
+ super(Object.assign(Object.assign({}, t2), { type: "Shape", useBgFill: false, textRotateWithShape: true }), e2, n2), this.picTextureId = "", this.picSprite = new ms(), this.picMask = new ms(), this.cmd = new su(this), this.picFill = t2.picFill, this.media = t2 == null ? void 0 : t2.media;
31051
31079
  }
31052
31080
  applyCommand(t2, e2) {
31053
31081
  var n2, r2, i2, o2, s3;
@@ -32632,9 +32660,10 @@ void main(void){
32632
32660
  render(t2) {
32633
32661
  const { items: e2, width: n2, height: r2 } = t2, i2 = new Fe();
32634
32662
  e2.forEach((t3) => {
32635
- if (t3.item.blipFillObject)
32636
- t3.item.blipFillObject.position.x += t3.x + 2, t3.item.blipFillObject.position.y += t3.y + 2, i2.addChild(t3.item.blipFillObject);
32637
- else {
32663
+ if (t3.item.blipFillObject) {
32664
+ const { width: e3, height: n3 } = t3;
32665
+ t3.item.blipFillObject.position.x += t3.x + 2 + e3 / 2, t3.item.blipFillObject.position.y += t3.y + 2 + n3 / 2, t3.item.blipFillObject.anchor.x = 0.5, t3.item.blipFillObject.anchor.y = 0.5, t3.item.blipFillObject.rotation = t3.item.rotate / 180 * Math.PI, i2.addChild(t3.item.blipFillObject);
32666
+ } else {
32638
32667
  const e3 = mh(t3.item.fill, t3.width - 4, t3.height - 4);
32639
32668
  if (e3)
32640
32669
  e3.position.x += t3.x + 2, e3.position.y += t3.y + 2, i2.addChild(e3);
@@ -32664,33 +32693,34 @@ void main(void){
32664
32693
  return this.spriteTextures.getGifFrames(t2);
32665
32694
  }
32666
32695
  addFill(t2, e2, n2, r2) {
32667
- const i2 = JSON.stringify(t2) + e2 + n2, o2 = Au()(i2);
32668
- if (this.textures[o2])
32669
- return o2;
32670
- if (this.fillStyles.findIndex((t3) => t3.id === o2) >= 0)
32671
- return o2;
32696
+ var i2;
32697
+ const o2 = JSON.stringify(t2) + e2 + n2, s3 = Au()(o2);
32698
+ if (this.textures[s3])
32699
+ return s3;
32700
+ if (this.fillStyles.findIndex((t3) => t3.id === s3) >= 0)
32701
+ return s3;
32672
32702
  if (t2.fillType !== "blipFill") {
32673
32703
  const i3 = { x: 0, y: 0 };
32674
- t2.fillType === "solidFill" && (e2 += 2, n2 += 2, i3.x = 1, i3.y = 1), this.fillStyles.push({ fill: t2, width: e2, height: n2, id: o2, name: r2, pivot: i3 });
32704
+ t2.fillType === "solidFill" && (e2 += 2, n2 += 2, i3.x = 1, i3.y = 1), this.fillStyles.push({ fill: t2, width: e2, height: n2, id: s3, name: r2, pivot: i3 });
32675
32705
  } else {
32676
- const e3 = this.spriteTextures.getTexture(t2.src);
32706
+ const e3 = this.spriteTextures.getTexture(t2.src), n3 = this.spriteTextures.getFrameData(t2.src);
32677
32707
  if (e3) {
32678
- const n3 = new ms();
32679
- n3.texture = e3, t2.filters.length > 0 && (n3.filters = function(t3) {
32708
+ const r3 = new ms();
32709
+ r3.texture = e3, t2.filters.length > 0 && (r3.filters = function(t3) {
32680
32710
  const e4 = [];
32681
32711
  return t3.forEach((t4) => {
32682
32712
  if (t4.type === "biLevel")
32683
32713
  e4.push(new xh("biLevel", t4.args[0]));
32684
32714
  else if (t4.type === "clrChange") {
32685
- const n4 = vu(t4.args[0]), r3 = vu(t4.args[1]);
32686
- e4.push(new Sh("clrChange", n4, r3));
32715
+ const n4 = vu(t4.args[0]), r4 = vu(t4.args[1]);
32716
+ e4.push(new Sh("clrChange", n4, r4));
32687
32717
  } else
32688
32718
  t4.type === "alphaModFix" && e4.push(new xh(t4.type, t4.args[0]));
32689
32719
  }), e4;
32690
- }(t2.filters)), this.fillStyles.push({ fill: t2, width: e3.width, height: e3.height, id: o2, blipFillObject: n3, pivot: { x: 0, y: 0 } });
32720
+ }(t2.filters)), this.fillStyles.push({ fill: t2, width: (n3 == null ? void 0 : n3.rotate) ? e3.height : e3.width, height: (n3 == null ? void 0 : n3.rotate) ? e3.width : e3.height, id: s3, blipFillObject: r3, pivot: { x: 0, y: 0 }, rotate: (i2 = n3 == null ? void 0 : n3.rotate) !== null && i2 !== void 0 ? i2 : 0 });
32691
32721
  }
32692
32722
  }
32693
- return o2;
32723
+ return s3;
32694
32724
  }
32695
32725
  pack() {
32696
32726
  const t2 = this.fillStyles.filter((t3) => !(!t3.fill.fillType || t3.fill.fillType === "noFill" || t3.width === 0 || t3.height === 0) || (this.textures[t3.id] = { texture: null, pivot: { x: 0, y: 0 } }, false));
@@ -32816,11 +32846,14 @@ void main(void){
32816
32846
  };
32817
32847
  class Ah {
32818
32848
  constructor(t2) {
32819
- this.gifs = Object.create(null), this.textures = Object.create(null), this.spriteSheets = [], this.isLoaded = false, this.loader = t2;
32849
+ this.gifs = Object.create(null), this.textures = Object.create(null), this.frames = Object.create(null), this.spriteSheets = [], this.isLoaded = false, this.loader = t2;
32820
32850
  }
32821
32851
  getTexture(t2) {
32822
32852
  return this.textures[t2] || null;
32823
32853
  }
32854
+ getFrameData(t2) {
32855
+ return this.frames[t2];
32856
+ }
32824
32857
  getGifFrames(t2) {
32825
32858
  return this.gifs[t2] ? this.gifs[t2].filter((t3) => !!t3) : [];
32826
32859
  }
@@ -32841,7 +32874,7 @@ void main(void){
32841
32874
  const r3 = parseInt(e3[2], 10);
32842
32875
  this.gifs[n3][r3] = a2.textures[t3];
32843
32876
  } else
32844
- this.textures[t3] = a2.textures[t3];
32877
+ this.frames[t3] = r2.frames[t3], this.textures[t3] = a2.textures[t3];
32845
32878
  });
32846
32879
  });
32847
32880
  }