@stemy/ngx-utils 19.9.10 → 19.9.13

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.
@@ -8356,9 +8356,6 @@ class InteractiveItemComponent {
8356
8356
  get id() {
8357
8357
  return null;
8358
8358
  }
8359
- get frame() {
8360
- return this.mFrame;
8361
- }
8362
8359
  get shapes() {
8363
8360
  return this.mShapes;
8364
8361
  }
@@ -8433,6 +8430,17 @@ class InteractiveItemComponent {
8433
8430
  return;
8434
8431
  this.canvas.selectedItem = value ? this : null;
8435
8432
  }
8433
+ get cursor() {
8434
+ switch (this.direction) {
8435
+ case "free":
8436
+ return "all-scroll";
8437
+ case "horizontal":
8438
+ return "col-resize";
8439
+ case "vertical":
8440
+ return "row-resize";
8441
+ }
8442
+ return "pointer";
8443
+ }
8436
8444
  constructor() {
8437
8445
  this.active = false;
8438
8446
  this.index = -1;
@@ -8442,7 +8450,6 @@ class InteractiveItemComponent {
8442
8450
  this.rot = 0;
8443
8451
  this.validRot = 0;
8444
8452
  this.direction = "none";
8445
- this.mFrame = new Rect(0, 0, 3, 3);
8446
8453
  this.mShapes = [];
8447
8454
  }
8448
8455
  draw(ctx, shape) {
@@ -8550,7 +8557,7 @@ class InteractiveItemComponent {
8550
8557
  return !this.canvas ? 1 : (isNaN(value) || value < 0 ? 0 : value) * (this.canvas.ratio ?? 1);
8551
8558
  }
8552
8559
  getMinDistance(other) {
8553
- return !other ? 0 : 10;
8560
+ return !other ? null : 0.1;
8554
8561
  }
8555
8562
  calcShape(x, y) {
8556
8563
  return new Point(x, y);
@@ -8644,9 +8651,7 @@ class InteractiveCanvasComponent {
8644
8651
  /**
8645
8652
  * Canvas params
8646
8653
  */
8647
- this.params = input({}, {
8648
- transform: (v) => v || {}
8649
- });
8654
+ this.params = input({});
8650
8655
  /**
8651
8656
  * Model signal for selected index
8652
8657
  */
@@ -8699,7 +8704,7 @@ class InteractiveCanvasComponent {
8699
8704
  effect(() => {
8700
8705
  const realWidth = this.width();
8701
8706
  const realHeight = this.height();
8702
- const params = this.params();
8707
+ const params = this.params() || {};
8703
8708
  this.xRange = normalizeRange(params.xRange || [0, realWidth]);
8704
8709
  this.yRange = normalizeRange(params.yRange || [0, realHeight]);
8705
8710
  this.resize();
@@ -8835,13 +8840,13 @@ class InteractiveCanvasComponent {
8835
8840
  fixRotation() {
8836
8841
  // No need to track params changes because this function will be called from an effect
8837
8842
  // already depending on params anyway
8838
- const params = untracked(() => this.params());
8843
+ const params = untracked(() => this.params()) || {};
8839
8844
  if (this.fullHeight <= 0)
8840
8845
  return;
8841
8846
  this.rotation = overflow(Math.round(this.rotation * 100) / 100, -180, 180);
8842
8847
  this.basePan = this.rotation / 360 * this.fullHeight
8843
8848
  + this.canvasHeight * untracked(() => this.panOffset());
8844
- this.cycles = this.infinite
8849
+ this.cycles = this.isInfinite
8845
8850
  ? [this.basePan - this.fullHeight, this.basePan, this.basePan + this.fullHeight] : [0];
8846
8851
  this.excludedAreas = (params.excludedAreas || []).map(coords => {
8847
8852
  const x = coords.x * this.ratio;
@@ -8890,23 +8895,11 @@ class InteractiveCanvasComponent {
8890
8895
  return -1;
8891
8896
  }
8892
8897
  updateCursor() {
8893
- const cursor = this.getCursor();
8898
+ if (!this.containerElem)
8899
+ return;
8900
+ const cursor = this.hoveredItem?.cursor ?? "default";
8894
8901
  this.renderer.setStyle(this.containerElem.nativeElement, "cursor", cursor);
8895
8902
  }
8896
- getCursor() {
8897
- const hovered = this.hoveredItem;
8898
- if (!hovered)
8899
- return "default";
8900
- switch (hovered.direction) {
8901
- case "free":
8902
- return "all-scroll";
8903
- case "horizontal":
8904
- return "";
8905
- case "vertical":
8906
- return "row-resize";
8907
- }
8908
- return "pointer";
8909
- }
8910
8903
  redraw() {
8911
8904
  if (!this.shouldDraw)
8912
8905
  return;
@@ -8958,15 +8951,16 @@ class InteractiveCanvasComponent {
8958
8951
  ctx.translate(-this.canvasWidth, 0);
8959
8952
  }
8960
8953
  const renderCtx = untracked(() => this.renderCtx());
8954
+ const params = untracked(() => this.params());
8961
8955
  const beforeItems = untracked(() => this.beforeItems());
8962
8956
  const afterItems = untracked(() => this.afterItems());
8963
8957
  try {
8964
8958
  for (const renderer of beforeItems) {
8965
- await renderer(this, renderCtx);
8959
+ await renderer(this, renderCtx, params);
8966
8960
  }
8967
8961
  await this.drawItems();
8968
8962
  for (const renderer of afterItems) {
8969
- await renderer(this, renderCtx);
8963
+ await renderer(this, renderCtx, params);
8970
8964
  }
8971
8965
  }
8972
8966
  catch (e) {
@@ -8975,17 +8969,17 @@ class InteractiveCanvasComponent {
8975
8969
  ctx.restore();
8976
8970
  }
8977
8971
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: InteractiveCanvasComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8978
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.19", type: InteractiveCanvasComponent, isStandalone: false, selector: "interactive-canvas", inputs: { infinite: { classPropertyName: "infinite", publicName: "infinite", isSignal: true, isRequired: false, transformFunction: null }, resizeMode: { classPropertyName: "resizeMode", publicName: "resizeMode", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: true, isRequired: false, transformFunction: null }, panOffset: { classPropertyName: "panOffset", publicName: "panOffset", isSignal: true, isRequired: false, transformFunction: null }, renderCtx: { classPropertyName: "renderCtx", publicName: "renderCtx", isSignal: true, isRequired: false, transformFunction: null }, beforeItems: { classPropertyName: "beforeItems", publicName: "beforeItems", isSignal: true, isRequired: false, transformFunction: null }, afterItems: { classPropertyName: "afterItems", publicName: "afterItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedIndex: "selectedIndexChange", onRotate: "onRotate", onItemPan: "onItemPan", onItemPanned: "onItemPanned", onPan: "onPan", onPanned: "onPanned" }, host: { listeners: { "window:touchend": "onTouchEnd()", "window:mouseup": "onMouseUp()" } }, queries: [{ propertyName: "itemList", predicate: InteractiveItemComponent, isSignal: true }], viewQueries: [{ propertyName: "containerElem", first: true, predicate: ["containerElem"], descendants: true, static: true }, { propertyName: "canvasElem", first: true, predicate: ["canvasElem"], descendants: true, static: true }], ngImport: i0, template: "<div #containerElem\r\n [ngClass]=\"['interactive-canvas-container', horizontal() ? 'horizontal' : 'vertical']\"\r\n (resize)=\"resize()\"\r\n (touchstart)=\"onTouchStart($event)\"\r\n (mousedown)=\"onMouseDown($event)\"\r\n (mousemove)=\"onMouseMove($event)\"\r\n (mouseleave)=\"onMouseLeave()\"\r\n (panend)=\"onPanEnd()\"\r\n (panmove)=\"onPanMove($event)\"\r\n (panstart)=\"onPanStart()\">\r\n <canvas #canvasElem class=\"interactive-canvas-element\"></canvas>\r\n</div>\r\n", styles: [".interactive-canvas-container{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center}.interactive-canvas-container .interactive-canvas-element{position:absolute;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], encapsulation: i0.ViewEncapsulation.None }); }
8972
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.19", type: InteractiveCanvasComponent, isStandalone: false, selector: "interactive-canvas", inputs: { infinite: { classPropertyName: "infinite", publicName: "infinite", isSignal: true, isRequired: false, transformFunction: null }, resizeMode: { classPropertyName: "resizeMode", publicName: "resizeMode", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: true, isRequired: false, transformFunction: null }, panOffset: { classPropertyName: "panOffset", publicName: "panOffset", isSignal: true, isRequired: false, transformFunction: null }, renderCtx: { classPropertyName: "renderCtx", publicName: "renderCtx", isSignal: true, isRequired: false, transformFunction: null }, beforeItems: { classPropertyName: "beforeItems", publicName: "beforeItems", isSignal: true, isRequired: false, transformFunction: null }, afterItems: { classPropertyName: "afterItems", publicName: "afterItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedIndex: "selectedIndexChange", onRotate: "onRotate", onItemPan: "onItemPan", onItemPanned: "onItemPanned", onPan: "onPan", onPanned: "onPanned" }, host: { listeners: { "window:touchend": "onTouchEnd()", "window:mouseup": "onMouseUp()" } }, queries: [{ propertyName: "itemList", predicate: InteractiveItemComponent, isSignal: true }], viewQueries: [{ propertyName: "containerElem", first: true, predicate: ["containerElem"], descendants: true }, { propertyName: "canvasElem", first: true, predicate: ["canvasElem"], descendants: true }], ngImport: i0, template: "<div #containerElem\r\n [ngClass]=\"['interactive-canvas-container', horizontal() ? 'horizontal' : 'vertical']\"\r\n (resize)=\"resize()\"\r\n (touchstart)=\"onTouchStart($event)\"\r\n (mousedown)=\"onMouseDown($event)\"\r\n (mousemove)=\"onMouseMove($event)\"\r\n (mouseleave)=\"onMouseLeave()\"\r\n (panend)=\"onPanEnd()\"\r\n (panmove)=\"onPanMove($event)\"\r\n (panstart)=\"onPanStart()\">\r\n <canvas #canvasElem class=\"interactive-canvas-element\"></canvas>\r\n</div>\r\n", styles: [".interactive-canvas-container{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center}.interactive-canvas-container .interactive-canvas-element{position:absolute;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], encapsulation: i0.ViewEncapsulation.None }); }
8979
8973
  }
8980
8974
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: InteractiveCanvasComponent, decorators: [{
8981
8975
  type: Component,
8982
8976
  args: [{ standalone: false, selector: "interactive-canvas", encapsulation: ViewEncapsulation.None, template: "<div #containerElem\r\n [ngClass]=\"['interactive-canvas-container', horizontal() ? 'horizontal' : 'vertical']\"\r\n (resize)=\"resize()\"\r\n (touchstart)=\"onTouchStart($event)\"\r\n (mousedown)=\"onMouseDown($event)\"\r\n (mousemove)=\"onMouseMove($event)\"\r\n (mouseleave)=\"onMouseLeave()\"\r\n (panend)=\"onPanEnd()\"\r\n (panmove)=\"onPanMove($event)\"\r\n (panstart)=\"onPanStart()\">\r\n <canvas #canvasElem class=\"interactive-canvas-element\"></canvas>\r\n</div>\r\n", styles: [".interactive-canvas-container{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center}.interactive-canvas-container .interactive-canvas-element{position:absolute;pointer-events:none}\n"] }]
8983
8977
  }], ctorParameters: () => [], propDecorators: { containerElem: [{
8984
8978
  type: ViewChild,
8985
- args: ["containerElem", { static: true }]
8979
+ args: ["containerElem"]
8986
8980
  }], canvasElem: [{
8987
8981
  type: ViewChild,
8988
- args: ["canvasElem", { static: true }]
8982
+ args: ["canvasElem"]
8989
8983
  }], onTouchEnd: [{
8990
8984
  type: HostListener,
8991
8985
  args: ["window:touchend"]