vue-safe-force-graph 2.0.80 → 2.0.81

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.
@@ -27867,23 +27867,23 @@ const KG = {
27867
27867
  },
27868
27868
  svgToUrl() {
27869
27869
  return ze(this, null, function* () {
27870
- this.$parent.centerAndZoom();
27870
+ this.$parent.centerAndZoom(), this.$parent.addCanvasBg();
27871
27871
  const t = this.$parent.getCanvasStage().toDataURL({
27872
27872
  mimeType: "image/png"
27873
27873
  });
27874
- return this.$parent.reset(), t;
27874
+ return this.$parent.removeCanvasBg(), this.$parent.reset(), t;
27875
27875
  });
27876
27876
  },
27877
27877
  svgToBlob() {
27878
27878
  return ze(this, null, function* () {
27879
- this.$parent.centerAndZoom();
27879
+ this.$parent.centerAndZoom(), this.$parent.addCanvasBg();
27880
27880
  const e = this.$parent.getCanvasStage();
27881
27881
  e.find("Image").forEach((n) => {
27882
27882
  const r = n.image();
27883
27883
  r && (r.crossOrigin = "Anonymous");
27884
27884
  });
27885
27885
  const t = yield e.toBlob();
27886
- return this.$parent.reset(), t;
27886
+ return this.$parent.removeCanvasBg(), this.$parent.reset(), t;
27887
27887
  });
27888
27888
  },
27889
27889
  deleteNodes() {
@@ -38393,7 +38393,7 @@ const qoe = /* @__PURE__ */ Xt(ooe, [["render", Voe], ["__scopeId", "data-v-194a
38393
38393
  utime: "2019-05-06 15:08:10",
38394
38394
  children: []
38395
38395
  }
38396
- ], zoe = "vue-safe-force-graph", Hoe = "2.0.80", Goe = "force_graph in security area", Woe = "jason zhang", Koe = "./lib/vue-safe-force-graph.js", Yoe = "./lib/vue-safe-force-graph.umd.cjs", Joe = "module", Xoe = [
38396
+ ], zoe = "vue-safe-force-graph", Hoe = "2.0.81", Goe = "force_graph in security area", Woe = "jason zhang", Koe = "./lib/vue-safe-force-graph.js", Yoe = "./lib/vue-safe-force-graph.umd.cjs", Joe = "module", Xoe = [
38397
38397
  "/lib/"
38398
38398
  ], Qoe = {
38399
38399
  ".": {
@@ -38813,7 +38813,7 @@ const { toClipboard: sae } = Wd(), oae = "Arial,Helvetica Neue,Helvetica,PingFan
38813
38813
  id: "grab",
38814
38814
  x: 0,
38815
38815
  y: 0
38816
- }), this.layer.add(this.grab), this.addCanvasBg();
38816
+ }), this.layer.add(this.grab);
38817
38817
  const r = this.layer.getCanvas()._canvas;
38818
38818
  this.canvasElement = r, this.stage.on("mousemove", (s) => {
38819
38819
  if (!this.mousedownNode || !s.evt[this.actKey]) {
@@ -38894,7 +38894,7 @@ const { toClipboard: sae } = Wd(), oae = "Arial,Helvetica Neue,Helvetica,PingFan
38894
38894
  id: "grab",
38895
38895
  x: 0,
38896
38896
  y: 0
38897
- }), this.layer.add(this.grab), this.addCanvasBg();
38897
+ }), this.layer.add(this.grab);
38898
38898
  },
38899
38899
  paintNodes() {
38900
38900
  const e = this.stage.width() / 2, t = this.stage.height() / 2, n = this.selection.map((r) => r.id);
@@ -40140,18 +40140,20 @@ const { toClipboard: sae } = Wd(), oae = "Arial,Helvetica Neue,Helvetica,PingFan
40140
40140
  });
40141
40141
  },
40142
40142
  addCanvasBg() {
40143
+ const e = this.stage.scaleX(), t = this.stage.x(), n = this.stage.y();
40143
40144
  this.darkBgRect = new Et.Rect({
40144
- x: 0,
40145
- y: 0,
40146
- width: this.stage.width() / this.scale,
40147
- height: this.stage.height() / this.scale,
40145
+ x: -t / e,
40146
+ // 反向补偿偏移
40147
+ y: -n / e,
40148
+ width: this.stage.width() / e,
40149
+ height: this.stage.height() / e,
40148
40150
  fill: this.canvasBg,
40149
40151
  listening: !1,
40150
40152
  draggable: !1
40151
- }), this.layer.add(this.darkBgRect), this.darkBgRect.moveToBottom(), this.stage.draw();
40153
+ }), this.layer.add(this.darkBgRect), this.darkBgRect.moveToBottom(), this.layer.batchDraw();
40152
40154
  },
40153
40155
  removeCanvasBg() {
40154
- this.darkBgRect && this.darkBgRect.destroy(), this.darkBgRect = null, this.stage.draw();
40156
+ this.darkBgRect && this.darkBgRect.destroy(), this.darkBgRect = null, this.layer.batchDraw();
40155
40157
  }
40156
40158
  }
40157
40159
  }, uae = {
@@ -40966,7 +40968,7 @@ const Nae = {
40966
40968
  },
40967
40969
  mounted() {
40968
40970
  return ze(this, null, function* () {
40969
- console.log('"2024/11/22 15:49:51"', "2024/11/22 15:49:51"), this.initializeGraphApi(), window.onresize = () => {
40971
+ console.log('"2024/11/26 16:58:01"', "2024/11/26 16:58:01"), this.initializeGraphApi(), window.onresize = () => {
40970
40972
  this.fullScreen = !!document.fullscreenElement, this.screenHeight = document.body.clientHeight;
40971
40973
  }, this.margin = this.changeMargin(), ps(nt, "emitDataLoaded", () => {
40972
40974
  this.emitDataLoaded();