@stocksharp/diagram 1.5.0 → 1.5.2

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/ssdiagram.js CHANGED
@@ -2627,15 +2627,17 @@ var SSDiagram = (() => {
2627
2627
  }
2628
2628
  resize(w, h) {
2629
2629
  if (w < 2 || h < 2) return;
2630
+ const dpr = window.devicePixelRatio || 1;
2631
+ if (w === this.width && h === this.height && dpr === this.dpr) return;
2630
2632
  this.width = w;
2631
2633
  this.height = h;
2632
- this.dpr = window.devicePixelRatio || 1;
2634
+ this.dpr = dpr;
2633
2635
  this.canvas.width = Math.round(w * this.dpr);
2634
2636
  this.canvas.height = Math.round(h * this.dpr);
2635
2637
  this.canvas.style.width = `${w}px`;
2636
2638
  this.canvas.style.height = `${h}px`;
2637
2639
  this.ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
2638
- this.scheduleDraw();
2640
+ if (!this.destroyed) this.draw();
2639
2641
  }
2640
2642
  getInteractionPermissions() {
2641
2643
  return { ...this.permissions };
@@ -3725,7 +3727,8 @@ ${runtime.error}`;
3725
3727
  } else if (n2.description.length > 0) {
3726
3728
  text = n2.description;
3727
3729
  } else {
3728
- text = n2.typeId && n2.typeId !== n2.name ? `${n2.name} [${n2.typeId}]` : n2.name;
3730
+ const typed = n2.typeId.length > 0 && n2.typeId !== n2.name && n2.typeId !== n2.id;
3731
+ text = typed ? `${n2.name} [${n2.typeId}]` : n2.name;
3729
3732
  }
3730
3733
  } else {
3731
3734
  return;
@@ -5226,12 +5229,13 @@ ${runtime.error}`;
5226
5229
  this.overviewContainer = options.overviewContainer ?? null;
5227
5230
  this.zoomLabel = options.zoomLabel ?? null;
5228
5231
  this.clipboard = this.resolveClipboard(options.clipboard);
5232
+ this.pageScroll = options.pageScroll ?? false;
5229
5233
  this.canvas = new Diagram({
5230
5234
  host: this.div,
5231
5235
  typeColors: this.portTypeColors(),
5232
5236
  gridSnap: options.gridSnap ?? true,
5233
5237
  gridSize: options.gridSize,
5234
- pageScroll: options.pageScroll ?? false
5238
+ pageScroll: this.pageScroll
5235
5239
  });
5236
5240
  this.fullscreenButtonVisible = options.showFullscreenButton ?? true;
5237
5241
  this.fullscreenLabels = options.fullscreenLabels ?? null;
@@ -5311,10 +5315,16 @@ ${runtime.error}`;
5311
5315
  }
5312
5316
  /** See DiagramOptions.pageScroll. */
5313
5317
  setPageScroll(enabled) {
5314
- this.canvas.setPageScroll(enabled);
5318
+ this.pageScroll = enabled;
5319
+ this.applyPageScroll();
5315
5320
  }
5321
+ /** The requested setting, which stays true while fullscreen suspends it. */
5316
5322
  isPageScrollEnabled() {
5317
- return this.canvas.isPageScrollEnabled();
5323
+ return this.pageScroll;
5324
+ }
5325
+ // Fullscreen covers the page, so there is no page left to scroll and every gesture goes to the diagram.
5326
+ applyPageScroll() {
5327
+ this.canvas.setPageScroll(this.pageScroll && !this.fullscreen);
5318
5328
  }
5319
5329
  nudgeSelection(dx, dy) {
5320
5330
  return this.canvas.nudgeSelection(dx, dy);
@@ -5550,6 +5560,7 @@ ${runtime.error}`;
5550
5560
  setFullscreenState(fullscreen) {
5551
5561
  if (this.fullscreen === fullscreen) return;
5552
5562
  this.fullscreen = fullscreen;
5563
+ this.applyPageScroll();
5553
5564
  this.updateFullscreenButton();
5554
5565
  this.emit("fullscreenChanged", { fullscreen });
5555
5566
  }