@visactor/vutils 0.18.3 → 0.18.4
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IBoundsLike } from '../data-structure';
|
|
2
|
-
export type InsideBoundsAnchorType = 'inside-top' | 'inside-bottom' | 'inside-left' | 'inside-right';
|
|
2
|
+
export type InsideBoundsAnchorType = 'inside' | 'inside-top' | 'inside-bottom' | 'inside-left' | 'inside-right';
|
|
3
3
|
export type BoundsAnchorType = 'top' | 'bottom' | 'left' | 'right' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'center';
|
|
4
|
-
export declare const calculateAnchorOfBounds: (bounds: IBoundsLike, anchorType:
|
|
4
|
+
export declare const calculateAnchorOfBounds: (bounds: IBoundsLike, anchorType: string) => {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphics/bounds-util.ts"],"names":[],"mappings":";;;AAeO,MAAM,uBAAuB,GAAG,CAAC,MAAmB,EAAE,
|
|
1
|
+
{"version":3,"sources":["../src/graphics/bounds-util.ts"],"names":[],"mappings":";;;AAeO,MAAM,uBAAuB,GAAG,CAAC,MAAmB,EAAE,UAAkB,EAAE,EAAE;IACjF,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;IAClC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACrC,IAAI,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,OAAO,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IAE5B,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,IAAI,EAAE,GAAG,CAAC,CAAC;IAEX,QAAQ,UAAU,EAAE;QAClB,KAAK,KAAK,CAAC;QACX,KAAK,YAAY;YACf,EAAE,GAAG,CAAC,GAAG,CAAC;YACV,MAAM;QACR,KAAK,QAAQ,CAAC;QACd,KAAK,eAAe;YAClB,EAAE,GAAG,GAAG,CAAC;YACT,MAAM;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,aAAa;YAChB,EAAE,GAAG,CAAC,GAAG,CAAC;YACV,MAAM;QACR,KAAK,OAAO,CAAC;QACb,KAAK,cAAc;YACjB,EAAE,GAAG,GAAG,CAAC;YACT,MAAM;QACR,KAAK,WAAW;YACd,EAAE,GAAG,GAAG,CAAC;YACT,EAAE,GAAG,CAAC,GAAG,CAAC;YACV,MAAM;QACR,KAAK,UAAU;YACb,EAAE,GAAG,CAAC,GAAG,CAAC;YACV,EAAE,GAAG,CAAC,GAAG,CAAC;YACV,MAAM;QACR,KAAK,cAAc;YACjB,EAAE,GAAG,GAAG,CAAC;YACT,EAAE,GAAG,GAAG,CAAC;YACT,MAAM;QACR,KAAK,aAAa;YAChB,EAAE,GAAG,CAAC,GAAG,CAAC;YACV,EAAE,GAAG,GAAG,CAAC;KACZ;IAED,OAAO,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,OAAO,IAAI,EAAE,GAAG,UAAU,CAAC;IAE3B,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC,CAAC;AAhDW,QAAA,uBAAuB,2BAgDlC","file":"bounds-util.js","sourcesContent":["import type { IBoundsLike } from '../data-structure';\n\nexport type InsideBoundsAnchorType = 'inside' | 'inside-top' | 'inside-bottom' | 'inside-left' | 'inside-right';\n\nexport type BoundsAnchorType =\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-right'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-left'\n | 'center';\n\nexport const calculateAnchorOfBounds = (bounds: IBoundsLike, anchorType: string) => {\n const { x1, x2, y1, y2 } = bounds;\n const rectWidth = Math.abs(x2 - x1);\n const rectHeight = Math.abs(y2 - y1);\n let anchorX = (x1 + x2) / 2;\n let anchorY = (y1 + y2) / 2;\n\n let sx = 0;\n let sy = 0;\n\n switch (anchorType) {\n case 'top':\n case 'inside-top':\n sy = -0.5;\n break;\n case 'bottom':\n case 'inside-bottom':\n sy = 0.5;\n break;\n case 'left':\n case 'inside-left':\n sx = -0.5;\n break;\n case 'right':\n case 'inside-right':\n sx = 0.5;\n break;\n case 'top-right':\n sx = 0.5;\n sy = -0.5;\n break;\n case 'top-left':\n sx = -0.5;\n sy = -0.5;\n break;\n case 'bottom-right':\n sx = 0.5;\n sy = 0.5;\n break;\n case 'bottom-left':\n sx = -0.5;\n sy = 0.5;\n }\n\n anchorX += sx * rectWidth;\n anchorY += sy * rectHeight;\n\n return { x: anchorX, y: anchorY };\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IBoundsLike } from '../data-structure';
|
|
2
|
-
export type InsideBoundsAnchorType = 'inside-top' | 'inside-bottom' | 'inside-left' | 'inside-right';
|
|
2
|
+
export type InsideBoundsAnchorType = 'inside' | 'inside-top' | 'inside-bottom' | 'inside-left' | 'inside-right';
|
|
3
3
|
export type BoundsAnchorType = 'top' | 'bottom' | 'left' | 'right' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'center';
|
|
4
|
-
export declare const calculateAnchorOfBounds: (bounds: IBoundsLike, anchorType:
|
|
4
|
+
export declare const calculateAnchorOfBounds: (bounds: IBoundsLike, anchorType: string) => {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphics/bounds-util.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAmB,EAAE,
|
|
1
|
+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aAAa;YAChB,EAAE,GAAG,CAAC,GAAG,CAAC;YACV,EAAE,GAAG,GAAG,CAAC;KACZ;IAED,OAAO,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,OAAO,IAAI,EAAE,GAAG,UAAU,CAAC;IAE3B,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC,CAAC","file":"bounds-util.js","sourcesContent":["import type { IBoundsLike } from '../data-structure';\n\nexport type InsideBoundsAnchorType = 'inside' | 'inside-top' | 'inside-bottom' | 'inside-left' | 'inside-right';\n\nexport type BoundsAnchorType =\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-right'\n | 'top-left'\n | 'bottom-right'\n | 'bottom-left'\n | 'center';\n\nexport const calculateAnchorOfBounds = (bounds: IBoundsLike, anchorType: string) => {\n const { x1, x2, y1, y2 } = bounds;\n const rectWidth = Math.abs(x2 - x1);\n const rectHeight = Math.abs(y2 - y1);\n let anchorX = (x1 + x2) / 2;\n let anchorY = (y1 + y2) / 2;\n\n let sx = 0;\n let sy = 0;\n\n switch (anchorType) {\n case 'top':\n case 'inside-top':\n sy = -0.5;\n break;\n case 'bottom':\n case 'inside-bottom':\n sy = 0.5;\n break;\n case 'left':\n case 'inside-left':\n sx = -0.5;\n break;\n case 'right':\n case 'inside-right':\n sx = 0.5;\n break;\n case 'top-right':\n sx = 0.5;\n sy = -0.5;\n break;\n case 'top-left':\n sx = -0.5;\n sy = -0.5;\n break;\n case 'bottom-right':\n sx = 0.5;\n sy = 0.5;\n break;\n case 'bottom-left':\n sx = -0.5;\n sy = 0.5;\n }\n\n anchorX += sx * rectWidth;\n anchorY += sy * rectHeight;\n\n return { x: anchorX, y: anchorY };\n};\n"]}
|