@visactor/vrender-core 0.16.15-alpha.0 → 0.16.16

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.
Files changed (37) hide show
  1. package/cjs/color-string/colorName.js +1 -1
  2. package/cjs/color-string/index.js +1 -1
  3. package/cjs/color-string/interpolate.js +1 -1
  4. package/cjs/color-string/store.js +1 -1
  5. package/cjs/common/bezier-utils.js +1 -2
  6. package/cjs/common/custom-path2d.js +2 -1
  7. package/cjs/common/split-path.js +1 -2
  8. package/cjs/core/application.js +2 -1
  9. package/cjs/core/global-module.js +2 -0
  10. package/cjs/core/global.js +1 -1
  11. package/cjs/core/graphic-utils.js +1 -1
  12. package/cjs/core/index.js +1 -1
  13. package/cjs/graphic/builtin-symbol/index.js +0 -1
  14. package/cjs/graphic/builtin-symbol/index.js.map +1 -1
  15. package/cjs/graphic/builtin-symbol/rect.d.ts +2 -1
  16. package/cjs/graphic/builtin-symbol/rect.js +11 -6
  17. package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
  18. package/dist/index.js +18 -11
  19. package/dist/index.min.js +1 -1
  20. package/es/color-string/colorName.js +1 -1
  21. package/es/color-string/index.js +1 -1
  22. package/es/color-string/interpolate.js +1 -1
  23. package/es/color-string/store.js +1 -1
  24. package/es/common/bezier-utils.js +1 -2
  25. package/es/common/custom-path2d.js +2 -1
  26. package/es/common/split-path.js +1 -2
  27. package/es/core/application.js +2 -1
  28. package/es/core/global-module.js +2 -0
  29. package/es/core/global.js +1 -1
  30. package/es/core/graphic-utils.js +1 -1
  31. package/es/core/index.js +1 -1
  32. package/es/graphic/builtin-symbol/index.js +0 -1
  33. package/es/graphic/builtin-symbol/index.js.map +1 -1
  34. package/es/graphic/builtin-symbol/rect.d.ts +2 -1
  35. package/es/graphic/builtin-symbol/rect.js +9 -4
  36. package/es/graphic/builtin-symbol/rect.js.map +1 -1
  37. package/package.json +4 -4
@@ -8,4 +8,4 @@ Object.keys(DEFAULT_COLORS).forEach((k => {
8
8
  }));
9
9
 
10
10
  export default parsedColors;
11
- //# sourceMappingURL=colorName.js.map
11
+ //# sourceMappingURL=colorName.js.map
@@ -3,4 +3,4 @@ export * from "./interpolate";
3
3
  export * from "./store";
4
4
 
5
5
  export * from "./colorName";
6
- //# sourceMappingURL=index.js.map
6
+ //# sourceMappingURL=index.js.map
@@ -88,4 +88,4 @@ export function colorStringInterpolationToStr(fromColor, toColor, ratio) {
88
88
  return ColorStore.Get(fromColor, ColorType.Color255, _fromColorRGB), ColorStore.Get(toColor, ColorType.Color255, _toColorRGB),
89
89
  `rgba(${Math.round(_fromColorRGB[0] + (_toColorRGB[0] - _fromColorRGB[0]) * ratio)},${Math.round(_fromColorRGB[1] + (_toColorRGB[1] - _fromColorRGB[1]) * ratio)},${Math.round(_fromColorRGB[2] + (_toColorRGB[2] - _fromColorRGB[2]) * ratio)},${_fromColorRGB[3] + (_toColorRGB[3] - _fromColorRGB[3]) * ratio})`;
90
90
  }
91
- //# sourceMappingURL=interpolate.js.map
91
+ //# sourceMappingURL=interpolate.js.map
@@ -47,4 +47,4 @@ export class ColorStore {
47
47
  }
48
48
 
49
49
  ColorStore.store255 = {}, ColorStore.store1 = {};
50
- //# sourceMappingURL=store.js.map
50
+ //# sourceMappingURL=store.js.map
@@ -22,5 +22,4 @@ export function cubicCalc(p0, p1, p2, p3, t) {
22
22
  export function cubicPointAt(p0, p1, p2, p3, t) {
23
23
  const x = cubicCalc(p0.x, p1.x, p2.x, p3.x, t), y = cubicCalc(p0.y, p1.y, p2.y, p3.y, t);
24
24
  return new Point(x, y);
25
- }
26
- //# sourceMappingURL=bezier-utils.js.map
25
+ }
@@ -334,4 +334,5 @@ function scale(current, sX, sY) {
334
334
  temp[3] = current[3], temp[4] = current[4], temp[5] = current[5], temp[6] = sX * current[6],
335
335
  temp[7] = sY * current[7]; else if ("h" === c || "H" === c) temp[1] = sX * current[1]; else if ("v" === c || "V" === c) temp[1] = sY * current[1]; else for (let i = 1, n = current.length; i < n; ++i) temp[i] = (i % 2 == 1 ? sX : sY) * current[i];
336
336
  return temp;
337
- }
337
+ }
338
+ //# sourceMappingURL=custom-path2d.js.map
@@ -245,5 +245,4 @@ export const splitPath = (path, count) => {
245
245
  remain -= stepCount;
246
246
  }
247
247
  return res;
248
- };
249
- //# sourceMappingURL=split-path.js.map
248
+ };
@@ -1 +1,2 @@
1
- export const ApplicationContribution = Symbol("ApplicationContribution");
1
+ export const ApplicationContribution = Symbol("ApplicationContribution");
2
+ //# sourceMappingURL=application.js.map
@@ -1 +1,3 @@
1
+
2
+
1
3
  //# sourceMappingURL=global-module.js.map
package/es/core/global.js CHANGED
@@ -174,4 +174,4 @@ let DefaultGlobal = class {
174
174
  DefaultGlobal = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(EnvContribution)), __metadata("design:paramtypes", [ Object ]) ], DefaultGlobal);
175
175
 
176
176
  export { DefaultGlobal };
177
- //# sourceMappingURL=global.js.map
177
+ //# sourceMappingURL=global.js.map
@@ -143,4 +143,4 @@ let DefaultTransformUtil = class {
143
143
  DefaultTransformUtil = __decorate([ injectable(), __metadata("design:paramtypes", []) ], DefaultTransformUtil);
144
144
 
145
145
  export { DefaultTransformUtil };
146
- //# sourceMappingURL=graphic-utils.js.map
146
+ //# sourceMappingURL=graphic-utils.js.map
package/es/core/index.js CHANGED
@@ -15,4 +15,4 @@ export * from "./layer-service";
15
15
  export * from "./constants";
16
16
 
17
17
  export * from "../interface/core";
18
- //# sourceMappingURL=index.js.map
18
+ //# sourceMappingURL=index.js.map
@@ -55,7 +55,6 @@ builtinSymbols.forEach((symbol => {
55
55
  export const builtInSymbolStrMap = {
56
56
  arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
57
57
  arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
58
- rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
59
58
  rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
60
59
  roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
61
60
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/builtin-symbol/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAG1B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM;IACN,KAAK;IACL,OAAO;IACP,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,KAAK;IACL,MAAM;IACN,GAAG;IACH,YAAY;IACZ,aAAa;IACb,UAAU;IACV,YAAY;IACZ,UAAU;IACV,WAAW;IACX,QAAQ;IACR,UAAU;IACV,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAiC,EAAE,CAAC;AAElE,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;IAC9B,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,SAAS,EAAE,iCAAiC;IAC5C,UAAU,EAAE,mCAAmC;IAC/C,IAAI,EAAE,mDAAmD;IACzD,SAAS,EAEP,8PAA8P;IAChQ,SAAS,EACP,sNAAsN;CACzN,CAAC;AAEF,cAAc,SAAS,CAAC","file":"index.js","sourcesContent":["import circle from './circle';\nimport cross from './cross';\nimport diamond from './diamond';\nimport square from './square';\nimport triangle from './triangle';\nimport star from './star';\nimport arrow from './arrow';\nimport wedge from './wedge';\nimport stroke from './stroke';\nimport wye from './wye';\nimport triangleLeft from './triangle-left';\nimport triangleRight from './triangle-right';\nimport triangleUp from './triangle-up';\nimport triangleDown from './triangle-down';\nimport thinTriangle from './thin-triangle';\nimport arrow2Left from './arrow2-left';\nimport arrow2Right from './arrow2-right';\nimport arrow2Up from './arrow2-up';\nimport arrow2Down from './arrow2-down';\nimport lineV from './line-v';\nimport lineH from './line-h';\nimport close from './close';\nimport rect from './rect';\nimport type { ISymbolClass } from '../../interface';\n\nexport const builtinSymbols = [\n circle,\n cross,\n diamond,\n square,\n thinTriangle,\n triangle,\n star,\n arrow,\n wedge,\n stroke,\n wye,\n triangleLeft,\n triangleRight,\n triangleUp,\n triangleDown,\n arrow2Left,\n arrow2Right,\n arrow2Up,\n arrow2Down,\n rect,\n lineV,\n lineH,\n close\n];\nexport const builtinSymbolsMap: Record<string, ISymbolClass> = {};\n\nbuiltinSymbols.forEach(symbol => {\n builtinSymbolsMap[symbol.type] = symbol;\n});\n\nexport const builtInSymbolStrMap: Record<string, string> = {\n arrowLeft: 'M 0.25 -0.5 L -0.25 0 l 0.5 0.5',\n arrowRight: 'M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5',\n rect: 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z',\n rectRound:\n // eslint-disable-next-line max-len\n 'M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z',\n roundLine:\n 'M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z'\n};\n\nexport * from './utils';\n"]}
1
+ {"version":3,"sources":["../src/graphic/builtin-symbol/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;A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;IAC9B,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,SAAS,EAAE,iCAAiC;IAC5C,UAAU,EAAE,mCAAmC;IAE/C,SAAS,EAEP,8PAA8P;IAChQ,SAAS,EACP,sNAAsN;CACzN,CAAC;AAEF,cAAc,SAAS,CAAC","file":"index.js","sourcesContent":["import circle from './circle';\nimport cross from './cross';\nimport diamond from './diamond';\nimport square from './square';\nimport triangle from './triangle';\nimport star from './star';\nimport arrow from './arrow';\nimport wedge from './wedge';\nimport stroke from './stroke';\nimport wye from './wye';\nimport triangleLeft from './triangle-left';\nimport triangleRight from './triangle-right';\nimport triangleUp from './triangle-up';\nimport triangleDown from './triangle-down';\nimport thinTriangle from './thin-triangle';\nimport arrow2Left from './arrow2-left';\nimport arrow2Right from './arrow2-right';\nimport arrow2Up from './arrow2-up';\nimport arrow2Down from './arrow2-down';\nimport lineV from './line-v';\nimport lineH from './line-h';\nimport close from './close';\nimport rect from './rect';\nimport type { ISymbolClass } from '../../interface';\n\nexport const builtinSymbols = [\n circle,\n cross,\n diamond,\n square,\n thinTriangle,\n triangle,\n star,\n arrow,\n wedge,\n stroke,\n wye,\n triangleLeft,\n triangleRight,\n triangleUp,\n triangleDown,\n arrow2Left,\n arrow2Right,\n arrow2Up,\n arrow2Down,\n rect,\n lineV,\n lineH,\n close\n];\nexport const builtinSymbolsMap: Record<string, ISymbolClass> = {};\n\nbuiltinSymbols.forEach(symbol => {\n builtinSymbolsMap[symbol.type] = symbol;\n});\n\nexport const builtInSymbolStrMap: Record<string, string> = {\n arrowLeft: 'M 0.25 -0.5 L -0.25 0 l 0.5 0.5',\n arrowRight: 'M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5',\n // rect: 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z',\n rectRound:\n // eslint-disable-next-line max-len\n 'M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z',\n roundLine:\n 'M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z'\n};\n\nexport * from './utils';\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { IContext2d, SymbolType, ISymbolClass } from '../../interface';
2
2
  import { BaseSymbol } from './base';
3
- export declare function rect(ctx: IContext2d, size: [number, number], x: number, y: number): boolean;
3
+ export declare function rectSizeArray(ctx: IContext2d, size: [number, number], x: number, y: number): boolean;
4
+ export declare function rectSize(ctx: IContext2d, size: number, x: number, y: number): boolean;
4
5
  export declare class RectSymbol extends BaseSymbol implements ISymbolClass {
5
6
  type: SymbolType;
6
7
  pathStr: string;
@@ -2,19 +2,24 @@ import { isNumber } from "@visactor/vutils";
2
2
 
3
3
  import { BaseSymbol } from "./base";
4
4
 
5
- export function rect(ctx, size, x, y) {
5
+ export function rectSizeArray(ctx, size, x, y) {
6
6
  return ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]), !1;
7
7
  }
8
8
 
9
+ export function rectSize(ctx, size, x, y) {
10
+ const w = size, h = size / 2;
11
+ return ctx.rect(x - w / 2, y - h / 2, w, h), !1;
12
+ }
13
+
9
14
  export class RectSymbol extends BaseSymbol {
10
15
  constructor() {
11
- super(...arguments), this.type = "rect", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
16
+ super(...arguments), this.type = "rect", this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
12
17
  }
13
18
  draw(ctx, size, x, y) {
14
- return rect(ctx, isNumber(size) ? [ size, size ] : size, x, y);
19
+ return isNumber(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
15
20
  }
16
21
  drawOffset(ctx, size, x, y, offset) {
17
- return rect(ctx, isNumber(size) ? [ size + 2 * offset, size + 2 * offset ] : [ size[0] + 2 * offset, size[1] + 2 * offset ], x, y);
22
+ return isNumber(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [ size[0] + 2 * offset, size[1] + 2 * offset ], x, y);
18
23
  }
19
24
  }
20
25
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graphic/builtin-symbol/rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAiCpC,MAAM,UAAU,IAAI,CAAC,GAAe,EAAE,IAAsB,EAAE,CAAS,EAAE,CAAS;IAChF,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,OAAO,KAAK,CAAC;AACf,CAAC;AAGD,MAAM,OAAO,UAAW,SAAQ,UAAU;IAA1C;;QACE,SAAI,GAAe,MAAM,CAAC;QAC1B,YAAO,GAAW,oBAAoB,CAAC;IAazC,CAAC;IAXC,IAAI,CAAC,GAAe,EAAE,IAA+B,EAAE,CAAS,EAAE,CAAS;QACzE,MAAM,QAAQ,GAAqB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxE,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,UAAU,CAAC,GAAe,EAAE,IAA+B,EAAE,CAAS,EAAE,CAAS,EAAE,MAAc;QAC/F,MAAM,QAAQ,GAAqB,QAAQ,CAAC,IAAI,CAAC;YAC/C,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,MAAM,EAAE,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC;YACxC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;CACF;AAED,eAAe,IAAI,UAAU,EAAE,CAAC","file":"rect.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport { isNumber } from '@visactor/vutils';\nimport type { IContext2d, SymbolType, ISymbolClass } from '../../interface';\nimport { BaseSymbol } from './base';\n\n/**\n * 部分源码参考 https://github.com/vega/vega/blob/main/packages/vega-scenegraph/src/path/symbols.js\n * Copyright (c) 2015-2023, University of Washington Interactive Data Lab\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of the copyright holder nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nexport function rect(ctx: IContext2d, size: [number, number], x: number, y: number) {\n ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);\n return false;\n}\n\n// 以中心为锚点,size为circle外接正方形的面积\nexport class RectSymbol extends BaseSymbol implements ISymbolClass {\n type: SymbolType = 'rect';\n pathStr: string = 'M-0.5,-0.5h1v1h-1Z';\n\n draw(ctx: IContext2d, size: number | [number, number], x: number, y: number) {\n const rectSize: [number, number] = isNumber(size) ? [size, size] : size;\n return rect(ctx, rectSize, x, y);\n }\n\n drawOffset(ctx: IContext2d, size: number | [number, number], x: number, y: number, offset: number) {\n const rectSize: [number, number] = isNumber(size)\n ? [size + 2 * offset, size + 2 * offset]\n : [size[0] + 2 * offset, size[1] + 2 * offset];\n return rect(ctx, rectSize, x, y);\n }\n}\n\nexport default new RectSymbol();\n"]}
1
+ {"version":3,"sources":["../src/graphic/builtin-symbol/rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAA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AE,CAAC,EAAE,CAAC,CAAC,CAAC;SAC/C;QACD,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAChF,CAAC;CACF;AAED,eAAe,IAAI,UAAU,EAAE,CAAC","file":"rect.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport { isNumber } from '@visactor/vutils';\nimport type { IContext2d, SymbolType, ISymbolClass } from '../../interface';\nimport { BaseSymbol } from './base';\n\n/**\n * 部分源码参考 https://github.com/vega/vega/blob/main/packages/vega-scenegraph/src/path/symbols.js\n * Copyright (c) 2015-2023, University of Washington Interactive Data Lab\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n 3. Neither the name of the copyright holder nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nexport function rectSizeArray(ctx: IContext2d, size: [number, number], x: number, y: number) {\n ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);\n return false;\n}\n\nexport function rectSize(ctx: IContext2d, size: number, x: number, y: number) {\n const w = size;\n const h = size / 2;\n ctx.rect(x - w / 2, y - h / 2, w, h);\n return false;\n}\n\n// 以中心为锚点,size为circle外接正方形的面积\nexport class RectSymbol extends BaseSymbol implements ISymbolClass {\n type: SymbolType = 'rect';\n pathStr: string = 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z';\n\n draw(ctx: IContext2d, size: number | [number, number], x: number, y: number) {\n if (isNumber(size)) {\n return rectSize(ctx, size, x, y);\n }\n return rectSizeArray(ctx, size, x, y);\n // const rectSize: [number, number] = ? [size, size] : size;\n // return rect(ctx, rectSize, x, y);\n }\n\n drawOffset(ctx: IContext2d, size: number | [number, number], x: number, y: number, offset: number) {\n if (isNumber(size)) {\n return rectSize(ctx, size + 2 * offset, x, y);\n }\n return rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);\n }\n}\n\nexport default new RectSymbol();\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-core",
3
- "version": "0.16.15-alpha.0",
3
+ "version": "0.16.16",
4
4
  "description": "",
5
5
  "sideEffects": true,
6
6
  "main": "cjs/index.js",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "color-convert": "2.0.1",
16
- "@visactor/vutils": "0.16.8"
16
+ "@visactor/vutils": "~0.16.10"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@rushstack/eslint-patch": "~1.1.4",
@@ -31,8 +31,8 @@
31
31
  "vite": "3.2.6",
32
32
  "typescript": "4.9.5",
33
33
  "@internal/bundler": "0.0.1",
34
- "@internal/ts-config": "0.0.1",
35
- "@internal/eslint-config": "0.0.1"
34
+ "@internal/eslint-config": "0.0.1",
35
+ "@internal/ts-config": "0.0.1"
36
36
  },
37
37
  "keywords": [
38
38
  "VisActor",